ofbiz-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacques Le Roux <jacques.le.r...@les7arts.com>
Subject Re: Call to action: fixing defects reported by code analysis tools
Date Tue, 13 Dec 2016 18:57:02 GMT
Le 13/12/2016 à 18:35, Jacopo Cappellato a écrit :
> Hi all,
>
> thanks to Gradle we have now an easy way to run source code analysis tools
> on our codebase.
> Tools like PMD and FindBugs generate useful reports containing pointers to
> code that may need to be improved or fixed.
> In fact I have executed them on trunk and I got reports with thousands of
> "rule violations": some of them are probably false positives but others
> really represent code that can be improved, simplified or, in some cases,
> fixed.
>
> I think that it would be great if this community will work together to fix
> as many defects as possible: it may lead to a cleaner codebase, may
> increase the confidence of potential adopters that use these tools to get
> some insight on our code quality, and may make it easier for new
> contributors to help the project.
>
> So here are the steps to quickly start the process:
>
> 1) get a clean checkout of the trunk
>
> svn co http://svn.apache.org/repos/asf/ofbiz/trunk
>
> 2) edit the build.gradle file to enable the PMD or FindBugs plugins.
> For PMD you can add the following line to the file, after the other "apply
> plugin" commands:
>
> apply plugin: 'pmd'
>
> For FindBugs add the following lines:
>
> apply plugin: 'findbugs'
> tasks.withType(FindBugs) {
>      reports {
>          xml.enabled false
>          html.enabled true
>      }
> }
>
> Apply only pmd or findbugs, not both: the two tools provide different
> analysis with plenty of defects but the two tools will spot the same ones
> in most cases, so please choose the tool of your preference and then start
> fixing the code.
>
> 3) run the analysis with the command:
> ./gradlew check
>
> 4) review the report;
> for PMD the report is:
> build/reports/pmd/main.html
> for FindBugs the report is:
> build/reports/findbugs/main.html
>
> 5) fix some bugs and test; then go back to #3
>
> 6) create a patch and submit it to Jira, mentioning that it fixes defects
> reported by PMD/FindBugs
>
> Feel free to ask here any question!
>
> Jacopo
>
Thanks Jacopo!

Just as a note I find very useful to run these tools in Eclipse (the FindBug plugin for instance
is conveniently integrated). But I rarely find the 
time to work on the reported issues :/

Jacques


Mime
View raw message