New version 2.6.0 of checkstyle is out!
Along with it vscode-checkstyle extension version 1.5.0 is available on VSCode marketplace.
Breaking change Configuration setting MethodLength.countEmpty
was changed to MethodLength.ignoreEmptyLines
New checkstyle comes with a few new checks:
- CodeSimilarity - find similar or identical code blocks
It operates on token level (operators, identifiers, keywords, parens, etc.).- Similar code blocks share the same structure, but use different identifiers, operators or values.
It disregards comments and whitespace and classifies operators into different groups (arithmetic, logical, comparison, etc.), and allows variations within each group.
So changing a+
to-
will still trigger a similarity warning, whereas swapping+
with&&
will not. - Identical code blocks use the same structure, identifiers, operators and values. It also disregards comments and whitespace.
- Similar code blocks share the same structure, but use different identifiers, operators or values.
- EnforceVarTypeHint - ensures that all vars have a type hint
- AvoidIdentifier - discourages use of user defined identifiers
- ArrowFunction - checks for curlies, nested functions and returns in arrow functions
- NestedControlFlow - limits nested control flow expressions (e.g.
if
,for
,while
,do/while
,switch
andtry
)
It’s a stricter version ofNestedForDepth
,NestedIfDepth
andNestedTryDepth
checks. e.g.NestedIfDepth
only checked nesting levels ofif
withif
.NestedControlFlow
check will emit a warning for any nested combination of control flow expressions violating itsmax
value.
Renamed AvoidInlineConditionals
to AvoidTernaryOperator
and InlineFinal
to Final
(old names still supported).
Updated reported positions for a few checks, so they don’t mark full function bodies or larger than necessary areas of code. Mostly useful for IDE integration like vscode-checkstyle extension.