Checkstyle configuration

I spent yesterday configuration Jenkins for my current projects. Unless your team formatted their code to a high standard, checkstyle threw up a lot of noise about things that no team member would undertake to fix. Like excess white spaces, tabs, or Java docs for getters and setters. (Personally I loath tabs, but many editors put tabs in by default).

I couldn’t be the only one who wanted to run all checkstyle checks by default, except the ones I specifically exclude? I didn’t care that the checks included each installation of checkstyle might differ. I simply wanted to reduce the signal to noise ratio by removing the noisiest offender.

However, checkstyle configuration didn’t work on the principle of exclusion. If a configuration file was provided, then all the checks to be run must be specified in the configuration. I have tried fiddling with the suppression filter but could not get it to work this way either.

The only way to achieve this seemed to be adopting one of the checkstyle.xml templates one could find on the web. In the end, I used this one which claimed to be the Sun Coding Convention.

2 Replies to “Checkstyle configuration”

    1. Hi, thanks for the link to the google group. On the other hand, the example configuration you linked confirmed my complaint about it. If you create only one rule in checkstyle.xml, like

      <module name="Checker">
         <module name="FileTabCharacter">
             <property name="severity" value="ignore"/>
        </module>
      </module>
      

      Then checkstyle will not run any tests.

Comments are closed.