Share this page 

Disable Checkstyle from code Tag(s): OpenSource


Checkstyle is a useful to enforce coding style but ...

sometime it may be to strict. Hopefully, there is a way to disable Checkstyle checking for a certain area to ebable to reach to the glory of having a Checkstyle == 0 ;-)

<module name="Checker">
    <property name="severity" value="warning"/>
    <property name="localeLanguage" value="fr"/>
    <module name="SuppressionCommentFilter"/>
    <module name="TreeWalker">
                <module name="FileContentsHolder"/>
...
                <module name="HideUtilityClassConstructor"/>
    </module>
</module>
Then to disable Checkstyle, you use //CHECKSTYLE:OFF and //CHECKSTYLE:ON (default values) in your code.

In this example, we want the disable it because we don't want to get the warning for the missing Javadoc tags for the getter/setter methods.

//CHECKSTYLE:OFF
public void setDriverFileName(String driverFileName) { this.driverFileName = driverFileName;}
public String getDriverFileName () { return this.driverFileName;}
//CHECKSTYLE:ON

mail_outline
Send comment, question or suggestion to howto@rgagnon.com