richersoon
richersoon

Reputation: 4902

Checkstyle off is not working for Checkstyle Gradle

I would like to use //@checkstyle:off and //@checkstyle:on to exempt certain part of the code from being check by checkstyle but it is still complaining.

public void invoke() {
    //@checkstyle:off
    String foo="Don't scan me please";
    //@checkstyle:on
}

Upvotes: 2

Views: 2119

Answers (1)

PeaceIsPearl
PeaceIsPearl

Reputation: 339

https://checkstyle.org/filters/suppressioncommentfilter.html#SuppressionCommentFilter. Please add the module to your checkstyle.xml

You can add comments to your code to turn off checkstyle (at various levels) and then back on again through the use of comments in your code. E.g.
//CHECKSTYLE:OFF
public void someMethod(String arg1, String arg2, String arg3, String arg4) {
//CHECKSTYLE:ON

Upvotes: 4

Related Questions