Cover by John Ferguson Smart

Safari, the world’s most comprehensive technology and business learning platform.

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required

O'Reilly logo

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 ...

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required