Skip to content

Checkstyle

By default, plugin is activated if java sources available (src/main/java).

Default config contains all possible checks, but some of them are disabled (note that some checkstyle rules are opposite and never intended to be used together). Uncomment check to enable it.

Output

8 Checkstyle rule violations were found in 2 files

[Misc | NewlineAtEndOfFile] sample.(Sample.java:0)
  File does not end with a newline.
  http://checkstyle.sourceforge.net/config_misc.html#NewlineAtEndOfFile

...

Config

Tool config options with defaults:

quality {
    checkstyleVersion = '8.12'
    checkstyle = true // false to disable automatic plugin activation
}

Suppress

To suppress violation:

@SuppressWarnings("NewlineAtEndOfFile")

Or with prefix (but require lower cased name):

@SuppressWarnings("checkstyle:newlineatendoffile")

To suppress all violations:

@SuppressWarnings("all")

Or using comments:

// CHECKSTYLE:OFF
..anything..
// CHECKSTYLE:ON