O'Reilly logo

Jenkins: The Definitive Guide by John Ferguson Smart

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Reporting on Code Quality Issues with the Violations Plugin

One of the most useful code quality plugins for Jenkins is the Violations plugin. This plugin will not analyse your project source code (you need to configure your build to do that), but it does a great job on reporting on the code quality metrics generated for individual builds and trends over time. The plugin caters for reports on code quality metrics coming from a large range of static analysis tools, including:

For Java

Checkstyle, CPD, PMD, FindBugs, and jcreport

For Groovy

codenarc

For JavaScript

jslint

For .Net

gendarme and stylecop

Installing the plugin is straightforward. Just go to the Plugin Manager screen and select the Jenkins Violations plugin. Once you have installed the plugin and restarted Jenkins, you will be able to use it for your projects.

The Violations plugin does not generate the code quality metrics data itself—you need to configure your built to do that, as shown in the previous section. An example of doing this for a Maven build job is illustrated in Figure 9-3. Notice that here we are invoking the Maven plugin goals directly. We could also just run mvn site, but if we are only interested in the code quality metrics, and not the other elements of the Maven-generated site, calling the plugins directly will result in faster builds.

Generating code quality reports in a Maven build

Figure 9-3. Generating code quality reports in a Maven build

Once you have set ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required