-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Discussing the checkstyle, code coverage and code analysis plugins in new build process. #603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
In my experience, adding automatic code coverage analysis to a project with already fairly high coverage often is an expensive cost/benefit choice, especially when you bring on board the cost of forward maintenance. Checkstyle and code analysis could be interesting. The first step would probably be to choose one of these analyses, run it on the code, and come to an agreement that fixing the problems identified would be an improvement. |
I agree that checkstyle and code analysis might be applicable in our environment. I do not have spare time to make an analysis in the near future. Any volunteers ? |
I'm personally a fan of Sonar, but do not have a public facing instance. Perhaps there are third parties which provide such service; never looked into that. Anyway, I guess I could run a Sonar analysis against the current HEAD and see what comes up; might do that this weekend. |
@Stephan202 |
@Tibor17: Understood. Sonar basically "bundles" a bunch of analysis tools, among which the ones you mentioned, and can be run as a Maven plugin. Ideally it is automatically invoked by a CI system, either after each commit or according to some schedule. At my work we use Jenkins for this, the "glue" is provided by the Sonar plugin. (That plugin is not strictly necessary, since one could just invoke The alternative is to add some of the analysis tools you mentioned as separate maven plugins. These can then generate reports that can be included in the Maven site. This approach doesn't require any additional services, but doesn't provide the benefit of a collaborative environment catered towards code review and automatic build-up of a code quality history. Anyway, this was but one suggestion, let's explore all possibilities :) |
@Stephan202 |
@Stephan202 |
For example Sonar reports of open source projects, see the Nemo site. Cloudbees offers a Sonar service for open source systems. I assume @stephenc can provide more information. |
For code coverage of JUnit itself, Cobertura is better suited than Emma/EclEmma/JaCoCo, since the latter does not report coverage of code raising exceptions (which JUnit uses a lot). Cobertura runs out of the box with maven -- it just follows the Surefire settings to execute the right test cases. I just included the cobertura configuration in my pom.xml so that html reports are generated -- I can put that in a pull request if there is interest. |
Code coverage would be very helpful, especially for our test source folder. Since we're manually maintaing an AllTests suite, we would be able to find tests missing from the list there. Cobertura sounds good, especially since the free FOSS plan of CloudBees includes the Cobertura plugin. 👍 Regarding Sonar: To me it looks like CloudBees does not provide a free instance to FOSS projects anymore. However, we can ask the guys at SonarSource to include JUnit on their Nemo site once we have sensible checks up and running. Regarding Checkstyle: IMHO the default rules are not very helpful, so we would have to discuss what checks and how to set limits etc. 👎 Findbugs and PMD both have reasonable and helpful defaults, I'm open to try them out and see what they find. |
@marcphilipp http://findbugs.cs.umd.edu/cloud/intellij.jnlp Let's see how we can visualize findbug plugin report. |
Jenkins comes with a FindBugs plugin that is included in the free plan so we could simply use that as a start. |
Violations plugin is the one to use IMHO as it supports all the static Just a question of adding the appropriate configurations to the maven On 18 January 2013 08:40, Marc Philipp [email protected] wrote:
|
Sounds good, thanks! |
I've had a look at the default findbugs checks. Currently there are about 30 issues, perhaps 50% are real, the other 50% are things like:
So, all in all not a bad code base. Should be possible to get that down to 0 (fix the half that are bugs, add exclusion flags to the bits findbugs should ignore) For Checkstyle, it will be a case of mapping the existing codestyle to a set of checkstyle rules... that can be trickier... once that is set up a simple reformat commit using the formatting rules in an IDE will get that down to 0. Code coverage, reported by cobertura, is running at about 85% line and 82% branch. Here are the worst All in all, coverage is not bad at all. |
@stephenc I would like to have |
btw, the findbugs 2.0.1 was wrong in enums saying that the field has to be final. So other like findbugs requires In 3.x code, most of the time a File passed by a method parameter was deleted, which findbugs does not like. This I do not like either, the javadoc does not say that, and anyway we cannot take it back. Other things in 3.x like closing Properties, which is missing. Realistically what I can fix in main code which does not change the behavior but would look nicer to the plugin
|
@Stephan202 |
Please let's not start discussing potential "fixes" right away. First, everyone should have a chance to look at the warnings generated by Findbugs and other tools in a central location, e.g. our Jenkins instance at CloudBees. I would strongly recommend starting with code coverage as soon as #614 is merged. No need to hurry, though. ;-) |
@marcphilipp |
To some extent, yes, but not in such a detail. I'd rather try some tool for a while and then reflect whether it has been useful. |
@marcphilipp I have to pull abstractions on ParallelComputer asap, and the OSGi IT tests after #614. :) |
@Tibor17 Please do not feel obligated to submit pull requests for all these tools. It was great that you started this discussion in the first place, thanks! |
Actually there is only one or two small changes needed to support most of Findbugs is supported out f the box with the #614 Pom Cobertura just needs one tweak for Jenkins to be able to pick up the results Checkstyle is the most work in that you are most likely not using exactly I'll probably do a pull request once I get the ok from @marcphilipp to go On Friday, 18 January 2013, Marc Philipp wrote:
|
@marcphilipp It was not my ambition to submit pull for these tools meanwhile the discussion is in progress. The most important in past was to persuade you and @dsaff to accept Maven and let you try to deploy. I would like to request for two things:
|
From a prioritization standpoint, if someone has cycles to work on automating code correctness and cleanliness tasks, I think that getting formatting settings for Eclipse and IDEA checked in is the first order of business, and then we move on to considering some of these. Your thoughts? |
@dsaff For IDEA it would only mean to install FindBugs-IDEA plugin, and nothing special just to press a button to start code analysis. Settings -> Plugins -> Available, then search FindBugs-IDEA, right click, download and install. Custom project files is perhaps not good idea to submit. |
Why are you using that plugin. Since IDEA 8 or 9 there has been no On Wednesday, 23 January 2013, Tibor Digana wrote:
|
Yes I agree that the code formatting style configurations for each IDE On Tuesday, 22 January 2013, David Saff wrote:
|
@dsaff |
The default IDE for JUnit is and has always been Eclipse. Eclipse This would help us a lot when reviewing pull requests, especially if AFAIK IntelliJ can import Eclipse projects, right? Thus, providing |
yes, it can import eclipse. |
You're right. There's already an issue for it: #426. |
@marcphilipp In the interest of cleaning up the issues, I think this one could be closed. |
After #511 we may now discuss addons of Maven plugins which may automate the development process we are doing manually like checking the code style, checking code issues and test coverage.
@avandeursen mentioned his link in #511 which forced me to start this discussion.
http://avandeursen.wordpress.com/2012/12/21/line-coverage-lessons-from-junit
After little searching on google:
http://maven.apache.org/plugins/maven-checkstyle-plugin/index.html
EMMA does not integrate with JUnit, and there might be more other plugins in these categories.
How much can we benefit from reports produced by these plugins ?
How can we integrate these reports in CloudBees/Jenkins ?
The text was updated successfully, but these errors were encountered: