Is SonarQube Replacement for Checkstyle, PMD, FindBugs?

Johnny picture Johnny · Mar 29, 2011 · Viewed 67.1k times · Source

We are working on a web project from scratch and are looking at the following static code analysis tools.

  • Conventions (Checkstyle)
  • Bad practices (PMD)
  • Potential bugs (FindBugs)

The project is built on Maven. Instead of using multiple tools for the purpose, I was looking at a single flexible solution and came across SonarQube.

Is it true that we can achieve the results from Checkstyle, PMD and Findbugs with SonarQube?

Answer

Olivier Gourment picture Olivier Gourment · Sep 19, 2011

Sonar will run CheckStyle, FindBugs and PMD, as well as a few other "plugins" such as Cobertura (code coverage) by default for Java projects. The main added value, however, is that it stores the history in a database. You can then see the trend. Are you improving the code base or are you doing the opposite? Only a tool with memory can tell you that.

You should run Sonar in your CI system so that even things that take some time to execute (such as CPD – copy paste detector) can run. And you'll have your history. Whereas with an Eclipse plugin, for example, you'll detect violations sooner – which is great – but you will be tempted to run it less often if it starts taking too long, or run less "quality plugins" (such as skipping CPD or skipping code coverage analysis). And you won't have history.

Also, Sonar generates visual reports, "Dashboard" style. Which makes it very easy to grasp. With Sonar in Jenkins, you'll be able to show developers and your management the effects of the work that was performed on the quality of the code base over the last few weeks and months.