Refactoring / Code Improvements discussion
Issue by metaprime
Wednesday May 24, 2017 at 18:34 GMT
Originally opened as https://github.com/4pr0n/ripme/issues/557
@Gaboso Let's talk about which changes need to be done, style guidelines, etc. If we're going to make a push to improve code quality, let's also strive for consistency.
@metaprime I've been out for a while, because of other projects, but now be able to follow up with greater frequency.
Exploring the project in general, I found some inconsistencies and points to improve, especially on rippers.
I believe that the initial focus for improvements should be to clean up the code and also fix issues.
To scan the code I used the SonarQube server on my machine, but to use it on the project I think it would be interesting to create an account in the SonarQube cloud.
^ What everything can SonarQube do, assuming there's no need to pay ?
It's free for open source projects.
SonarQube supports analysis of:
- Bugs and code vulnerabilities.
- Issues.
- Coverage of code by unit tests.
- Complexity of code.
- Code duplication.
The paid version has as a differential, more plugins and support to other languages, besides Java, JavaScript, C, C ++ and C#. But the ripme uses Java and is open source, so it has free access in the cloud.
Follow the SonarQube cloud link: https://about.sonarcloud.io/
^
SonarQube supports analysis of: Issues.
What issues ?
While running an analysis, SonarQube raises an issue every time a piece of code breaks a coding rule. The set of coding rules is defined through the quality profile associated with the project. Each issue has one of five severities:
BLOCKER Bug with a high probability to impact the behavior of the application in production: memory leak, unclosed JDBC connection, .... The code MUST be immediately fixed.
CRITICAL Either a bug with a low probability to impact the behavior of the application in production or an issue which represents a security flaw: empty catch block, SQL injection, ... The code MUST be immediately reviewed. MAJOR Quality flaw which can highly impact the developer productivity: uncovered piece of code, duplicated blocks, unused parameters, ...
MINOR Quality flaw which can slightly impact the developer productivity: lines should not be too long, "switch" statements should have at least 3 cases, ...
INFO Neither a bug nor a quality flaw, just a finding.
Source: https://docs.sonarqube.org/display/SONAR/Issues
^ You dunno anything the docs doesn't tell ?
In fact, I did not say anything, I just forwarded the content that explains how SonarQube handles an issue and its internal ratings. They probably explained better than I did.
Attached is a print of an analysis performed on the ripme:

^ Those are orders of magnitude worse things than my rather extremely limited Java understanding and knowledge had. I mean, I knew RipMe could use refactoring and improving (and I even have some things in mind) but those things are, like, really bad in comparison.
Just, wow.
Any news on this ? I'm mainly doing code cleanup for now and this would be really useful.