jenkins the definitive guide

(Jeff_L) #1

Figure 9.11. Installing the Checkstyle and Static Analysis Utilities plugins


Once you have installed these plugins, you can set up the reporting in your project configuration. Tick
the “Publish Checkstyle analysis results” checkbox. In a freestyle build, you will need to specify a path
pattern to find the Checkstyle XML reports; in a Maven 2 build, Jenkins will figure out where to look
for them by itself.


This will provide basic Checkstyle reporting, but as usual you can fine-tune things further by clicking
on the Advanced button. In a Maven 2 build, you can configure the health threshold values (how many
violations will cause the build to go from sunny to stormy), and also filter the priority violations you
want to include in this calculation. For example, you may only want high priority issues to be taken into
account for the weather icon status.


The Freestyle builds have a few more options you can configure: in particular, you can cause the build
to become unstable (yellow ball) or even to fail (red ball) if there are more than a given number of
violations, or if there are more than a given number of new violations (see Figure 9.12, “Configuring the
Checkstyle plugin”). So, in the configuration in the illustration, if there are more than 50 new checkstyle
violations of any priority in a build, the build will be flagged as unstable. This certainly has its uses for
Checkstyle, but it can also come in very handy with FindBugs, where high priority issues often represent
dangerous and potentially show-stopping bugs.

Free download pdf