简体   繁体   中英

Intellij IDEA build-in inspection code vs checkstyle, PMD & findbugs

Recently i'm looking about the best tool set to do code inspection. My IDE is Intellij 15.0 and i know there is a good inspection capabilities there but when i look over the internet i didn't found good comparison between Intellij build-in inspection code and those three. Can someone that tried them all can give some best practice what to use? is Intellij cover all of them?

I know findbugs run in binary level but still let it stay in the comparison.

In Checkstyle project itself, we use all of these tools: Checkstyle , PMD , FindBugs and IntelliJ IDEA inspections .

Here are my observations:

  • There is no replacement for Checkstyle when it comes to formatting, whitespaces, braces placement, Javadoc and general code style. There's some overlap with IntelliJ at naming and some bad practices, but that's it.
  • PMD rules are quite similar to the IntelliJ's ones. Both tools aim mainly to detect typical mistakes or bad practices. You will still find some unique useful PMD rules though, just some random examples: BigIntegerInstantiation , CommentDefaultAccessModifier , SingletonClassReturningNewInstance .
  • I would never resign from FindBugs in favour of some other tool. FindBugs focuses just on finding real bugs in code with low rate of false-positives. Usually, it doesn't require almost any configuration - just enable all rules and sleep safe. Of course there is some overlap with IntelliJ, but the more bugs detected, the better.

IntelliJ IDEA inspections are a great tool, as they contain lots of unique and reliable rules. And it's not only Java - you can out of the box detect problems in XML, Properties, SQL, Spring, HTML, CSS, etc. They require a lot of configuration and picking a right rule set though. Enabling all rules would report hundreds of thousands violations on every larger project. And it's hard to embed these inspections in Maven or Gradle build so that project is self-validating.

My recommendation is to make use of all of these tools, as each of them contains at least a dozen (sometimes dozen of dozens) of useful checks that are not available anywhere else.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM