IG/Inspections compared to PMD + CheckStyle

Has anyone done a comparison of IDEA's & TeamCity's set of Inspections to those available in PMD & CheckStyle? My client has a set of passive PMD/CheckStyle rules and I'm working on convincing them to use the active JetBrains inspections. Clearly, the fact that TeamCity can enforce the inspections during pre-commit is an advantage but the question comes up as to how good are those JetBrain inspections compared to PMD/CheckStyle?

Thanks,
Jon

13 comments
Comment actions Permalink

I'm pretty sure that IDEA + IG's rule set is contains everything in PMD + CheckStyle, with the exception of CheckStyle rules regarding code layout. PMD and CheckStyle were certainly mined for rules during initial development of IG, as were FindBugs, Parasoft's JTest, and Instantiations CodePro. In general, you are safe to assume that IG contains essentially all of the rules of those products as well.

--Dave Griffith

0
Comment actions Permalink

Thanks, Dave, and that's good to hear. Any chance that you, Bas, or anyone has kept up with the releases of these other 5 products since the initial development and has a snapshot of how IDEA's inspection set currently compares?

Jon

0
Comment actions Permalink

Would continually comparing the products really be worth the effort? Personally I feel the comparison would be quite unfair.

PMD by my count has 237 different "rules". CheckStyle has 125 "checks".
InspectionGadgets alone currently has 589 different inspections. And then I do not count all the Java inspections provided by IDEA itself. Not to mention all the inspection for JavaScript, Html, Css and all the other languages and libraries.

It is like IDEA has a headstart of 75 meters on the 100 meter dash. Who do you think would win?

Bas

0
Comment actions Permalink

Bas - Thanks for the insight. My bet was always on IDEA's Inspections, but many people in the Java world have absolutely no clue of how far ahead IDEA is, no clue how industry shaping it is as, for example, is the case with Inspections.

Jon

0
Comment actions Permalink

So I just went through the PMD list, and here's the gaps I found.

CollapsableIfStatement, UnusedNullCheckInEquals, BooleanInversion, UseSingleton, MissingStaticMethodInNonInstantiatableClass, AccessorClassGeneration, AvoidDeeplyNestedIfStmts, FinalizeOverloaded, UnnecessaryBooleanAssertion, UseCorrectExceptionLogging, JUnitUseExpected, JUnit4TestShouldUse* (for JUnit3 -> JUnit4 migration), UnnecessaryCaseChange, InefficientEmptyStringCheck, StringBufferInstantiationWithChar

Notes:

1)I didn't do gap analysis on PMD's JSP or JSF rules, because I am not familiar with IDEA's functionality in this area.

2)Many of the missing rules are kind of silly or promote some odd coding choices, but a few would be valuable in IDEA. I would certainly recommend AvoidDeeplyNestedIfStmts, FinalizeOverloaded, UnnecessaryCaseChange and StringBufferInstantiationWithChar for inclusion into InspectionGadgets.

3)A tool for converting JUnit 3 test cases to JUnit 4 would be handy, but inspections seem a strange choice for the underlying technology (particularly without quickfixes, as with PMD).

Looking through CheckStyle, I don't see any gaps, with the exception of code layout rules. If your clients aren't using IDEA for doing code layout, there might be value there.

Hope that helps.

--Dave Griffith

0
Comment actions Permalink

Hey Dave,

2)Many of the missing rules are kind of silly or
promote some odd coding choices, but a few would be
valuable in IDEA. I would certainly recommend
AvoidDeeplyNestedIfStmts, FinalizeOverloaded,
UnnecessaryCaseChange and
StringBufferInstantiationWithChar for inclusion into
InspectionGadgets.


Cool, I am on those. About FinalizeOverloaded, would it be useful to have that for equals, hashCode, compareTo and clone too? Maybe others?

Bas

0
Comment actions Permalink

Nice. I also meant to report two more I thought of last week. "Synchronization on local variable" and "Synchronization on method parameter". They'll need the standard doc boilerplate about "While there are coding patterns in which these constructs are useful, most likely it's a screwup." Missing those cost me about three hours work last week, and I imagine you can write the inspections in about five minutes.

--Dave Griffith

0
Comment actions Permalink

Here's a question. I wonder why these open source products don't mine IDEA for its wealth of Inspections?

Jon

0
Comment actions Permalink

I suspect it's because, as you noted, either they have no idea how far ahead it is, and also might not realise that the source is available.

I'm always amazed IJ don't push the inspections more as a selling point.

Cheers,
Colin

0
Comment actions Permalink

Agreed. I am trying to convince people here at where I work whenever they are working on a certain class, look for any inspections being run and any feedback given by the IDE. If there are any yellow, do what the IDE says and get rid of them. Problem is though I am the only one using the Selena M1 release whereas everyone else is either on poopy Eclipse or on Intellij 4.5.4.

I don't know but I do not think it would be too hard to sell my company on getting Intellij 7 licenses once it comes out ;)

0
Comment actions Permalink

Checkstyle mostly works on the syntax tree of single java source files only. We're well aware that tools that operate on a full java model, like IDEs, have a much better chance to detect coding problems than Checkstyle does.

Indeed I didn't realize that the inspections source code is available. Where can I find the source code and what is the license? Could we integrate the idea inspections in Checkstyle (which is LGPL)?

Cheers,
Lars, Checkstyle development team

0
Comment actions Permalink

You'll get the source as part of the plugin development package that can be downloaded here:
http://www.jetbrains.net/confluence/display/IDEADEV/Selena+EAP

As far as I can see the licence is Apache, so you probably won't be able to use the code in an LGPL application.

0
Comment actions Permalink

Thanks for the link. A zip inside a zip on an early access page - that's well hidden indeed :)

0

Please sign in to leave a comment.