Compare commits

..

No commits in common. "69aadf366cec2f425a6293ebdce65a374b6422e0" and "1deee25d96b57eb4761d98a32b64a67a51b6d122" have entirely different histories.

16 changed files with 13 additions and 336 deletions

View file

@ -17,7 +17,7 @@ jobs:
steps:
- uses: actions/checkout@v3.1.0
- name: setup-jdk-${{ matrix.java }}
uses: actions/setup-java@v3.5.1
uses: actions/setup-java@v2.3.0
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}

View file

@ -11,7 +11,7 @@ jobs:
steps:
- uses: actions/checkout@v3.1.0
- name: Set up JDK
uses: actions/setup-java@v3.5.1
uses: actions/setup-java@v2.3.0
with:
distribution: 'temurin'
java-version: 17

View file

@ -9,6 +9,6 @@ jobs:
update_draft_release:
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5.21.0
- uses: release-drafter/release-drafter@v5.16.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

149
README.md
View file

@ -91,13 +91,11 @@ Rule|Level|Source|Enabled|Suppressible
[AvoidConditionInversion](#avoidconditioninversion)|complexity|sevntu||
[AvoidConstantAsFirstOperandInCondition](#avoidconstantasfirstoperandincondition)|tweaks|sevntu|Yes|
[AvoidDefaultSerializableInInnerClasses](#avoiddefaultserializableininnerclasses)|tweaks|sevntu|Yes|
[AvoidDoubleBraceInitialization](#avoiddoublebraceinitialization)|tweaks|checkstyle|Yes|
[AvoidEscapedUnicodeCharacters](#avoidescapedunicodecharacters)|tweaks|checkstyle|Yes|
[AvoidHidingCauseException](#avoidhidingcauseexception)|tweaks|sevntu|Yes|
[AvoidInlineConditionals](#avoidinlineconditionals)|complexity|checkstyle|Yes|
[AvoidModifiersForTypes](#avoidmodifiersfortypes)|unspecified|sevntu||
[AvoidNestedBlocks](#avoidnestedblocks)|complexity|checkstyle|Yes|
[AvoidNoArgumentSuperConstructorCall](#avoidnoargumentsuperconstructorcall)|tweaks|checkstyle|Yes|
[AvoidNotShortCircuitOperatorsForBoolean](#avoidnotshortcircuitoperatorsforboolean)|tweaks|sevntu|Yes|
[AvoidStarImport](#avoidstarimport)|layout|checkstyle||
[AvoidStaticImport](#avoidstaticimport)|complexity|checkstyle||
@ -166,8 +164,7 @@ Rule|Level|Source|Enabled|Suppressible
[InterfaceMemberImpliedModifier](#interfacememberimpliedmodifier)|tweaks|checkstyle||
[InterfaceTypeParameterName](#interfacetypeparametername)|naming|checkstyle|Yes|
[JavadocMethod](#javadocmethod)|javadoc|checkstyle||
[JavadocMissingLeadingAsterisk](#javadocmissingleadingasterisk)|javadoc|checkstyle|Yes|
[JavadocMissingWhitespaceAfterAsterisk](#javadocmissingwhitespaceafterasterisk)|javadoc|checkstyle|Yes|
[JavadocMissingLeadingAsterisk](#javadocmissingleadingasterisk)|layout|checkstyle|Yes|
[JavadocPackage](#javadocpackage)|javadoc|checkstyle|Yes|
[JavadocParagraph](#javadocparagraph)|javadoc|checkstyle|Yes|
[JavadocStyle](#javadocstyle)|javadoc|checkstyle|Yes|
@ -276,7 +273,6 @@ Rule|Level|Source|Enabled|Suppressible
[UniformEnumConstantName](#uniformenumconstantname)|naming|sevntu|Yes|
[UniqueProperties](#uniqueproperties)|javadoc|checkstyle|Yes|
[UnnecessaryParentheses](#unnecessaryparentheses)|layout|checkstyle|Yes|
[UnnecessarySemicolonAfterOuterTypeDeclaration](#unnecessarysemicolonafteroutertypedeclaration)|layout|checkstyle|Yes|
[UnusedImports](#unusedimports)|layout|checkstyle|Yes|
[UpperEll](#upperell)|layout|checkstyle|Yes|
[UselessSingleCatch](#uselesssinglecatch)|tweaks|sevntu|Yes|
@ -383,38 +379,6 @@ Javadoc `@` clauses must be in the order:
* @deprecated ...
*/
````
#### [AvoidDoubleBraceInitialization](https://checkstyle.sourceforge.io/config_coding.html#AvoidDoubleBraceInitialization)
Detects double brace initialization.
Rationale: Double brace initialization (set of Instance Initializers in class
body) may look cool, but it is considered as anti-pattern and should be avoided.
This is also can lead to a hard-to-detect memory leak, if the anonymous class
instance is returned outside and other object(s) hold reference to it. Created
anonymous class is not static, it holds an implicit reference to the outer class
instance. See this
[blog post](https://blog.jooq.org/2014/12/08/dont-be-clever-the-double-curly-braces-anti-pattern/)
and
[article](https://www.baeldung.com/java-double-brace-initialization)
for more details. Check ignores any comments and semicolons in class body.
Invalid:
````java
class MyClass {
List<Integer> list1 = new ArrayList<>() { // violation
{
add(1);
}
};
List<String> list2 = new ArrayList<>() { // violation
;
// comments and semicolons are ignored
{
add("foo");
}
};
}
````
#### [AvoidEscapedUnicodeCharacters](http://checkstyle.sourceforge.net/config_misc.html#AvoidEscapedUnicodeCharacters)
Prevents use of obscure escape codes (e.g. `\u221e`). However, non-printable/control characters are still permitted.
@ -450,34 +414,6 @@ Invalid:
// ...
}
````
#### [AvoidNoArgumentSuperConstructorCall](https://checkstyle.sourceforge.io/config_coding.html#AvoidNoArgumentSuperConstructorCall)
Checks if call to superclass constructor without arguments is present. Such invocation is redundant
because constructor body implicitly begins with a superclass constructor invocation super();
See
[specification](https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-8.8.7)
for detailed information.
Valid:
````java
class MyClass extends SomeOtherClass {
MyClass(int arg) {
super(arg); // OK, call with argument have to be explicit
}
MyClass(long arg) {
// OK, call is implicit
}
}
````
Invalid:
````java
class MyClass extends SomeOtherClass {
MyClass() {
super(); // violation
}
}
````
#### [BooleanExpressionComplexity](http://checkstyle.sourceforge.net/config_metrics.html#BooleanExpressionComplexity)
Restrict the number of number of &&, ||, &, | and ^ in an expression to 2.
@ -1247,40 +1183,6 @@ class Wrapped {}
*/
class Code {}
````
#### [JavadocMissingWhitespaceAfterAsterisk](https://checkstyle.sourceforge.io/config_javadoc.html#JavadocMissingWhitespaceAfterAsterisk)
Checks that there is at least one whitespace after the leading asterisk.
Although spaces after asterisks are optional in the Javadoc comments, their
absence makes the documentation difficult to read. It is the de facto standard
to put at least one whitespace after the leading asterisk.
Valid:
````java
/** This is valid single-line Javadoc. */
class TestClass {
/**
* This is valid Javadoc.
*/
void validJavaDocMethod() {
}
/** This is valid single-line Javadoc. */
void validSingleLineJavaDocMethod() {
}
}
````
Invalid:
````java
class TestClass {
/**
*This is invalid Javadoc.
*/
int invalidJavaDoc;
/**This is invalid single-line Javadoc. */
void invalidSingleLineJavaDocMethod() {
}
}
````
#### [JavadocPackage](http://checkstyle.sourceforge.net/config_javadoc.html#JavadocPackage)
Checks that each package has a `package-info.java` file.
@ -2197,55 +2099,6 @@ Invalid:
````
if ((a < 1)) {}
````
#### [UnnecessarySemicolonAfterOuterTypeDeclaration](https://checkstyle.sourceforge.io/config_coding.html#UnnecessarySemicolonAfterOuterTypeDeclaration)
Checks if unnecessary semicolon is used after type declaration.
Valid:
````java
class A {
class Nested {
}; // OK, nested type declarations are ignored
}
interface B {
}
enum C {
}
@interface D {
}
````
Invalid:
````java
class A {
class Nested {
}; // OK, nested type declarations are ignored
}; // violation
interface B {
}; // violation
enum C {
}; // violation
@interface D {
}; // violation
````
#### [UnusedImports](http://checkstyle.sourceforge.net/config_imports.html#UnusedImports)
Checks for unused imports. Does not inspect wildcard imports, which should be blocked by [AvoidStarImport](#avoidstarimport) anyway.

View file

@ -24,17 +24,17 @@
<tiles-maven-plugin.version>2.23</tiles-maven-plugin.version>
<kemitix-maven-tiles.version>3.1.1</kemitix-maven-tiles.version>
<checkstyle.version>8.45.1</checkstyle.version>
<checkstyle.version>8.45</checkstyle.version>
<sevntu.version>1.40.0</sevntu.version>
<sevntu-plugin.version>1.35.0</sevntu-plugin.version>
<lombok.version>1.18.24</lombok.version>
<lombok.version>1.18.20</lombok.version>
<spring-platform.version>Brussels-SR6</spring-platform.version>
<spring-boot.version>2.7.4</spring-boot.version>
<mapstream.version>3.2.10</mapstream.version>
<map-builder.version>1.0.0</map-builder.version>
<mockito.version>4.8.0</mockito.version>
<mockito.version>3.11.2</mockito.version>
<assertj.version>3.20.2</assertj.version>
<classgraph.version>4.8.149</classgraph.version>
<classgraph.version>4.8.113</classgraph.version>
<maven-checkstyle-plugin.version>3.1.2</maven-checkstyle-plugin.version>
<kemitix.checkstyle.ruleset.version>${project.version}</kemitix.checkstyle.ruleset.version>

View file

@ -1548,7 +1548,7 @@ rules:
-
name: JavadocMissingLeadingAsterisk
parent: TREEWALKER
level: JAVADOC
level: LAYOUT
enabled: true
source: CHECKSTYLE
uri: https://checkstyle.sourceforge.io/config_javadoc.html#JavadocMissingLeadingAsterisk
@ -1566,31 +1566,4 @@ rules:
enabled: true
source: CHECKSTYLE
uri: https://checkstyle.sourceforge.io/config_misc.html#NoCodeInFile
-
name: JavadocMissingWhitespaceAfterAsterisk
parent: TREEWALKER
level: JAVADOC
enabled: true
source: CHECKSTYLE
uri: https://checkstyle.sourceforge.io/config_javadoc.html#JavadocMissingWhitespaceAfterAsterisk
-
name: UnnecessarySemicolonAfterOuterTypeDeclaration
parent: TREEWALKER
level: LAYOUT
enabled: true
source: CHECKSTYLE
uri: https://checkstyle.sourceforge.io/config_coding.html#UnnecessarySemicolonAfterOuterTypeDeclaration
-
name: AvoidDoubleBraceInitialization
parent: TREEWALKER
level: TWEAKS
enabled: true
source: CHECKSTYLE
uri: https://checkstyle.sourceforge.io/config_coding.html#AvoidDoubleBraceInitialization
-
name: AvoidNoArgumentSuperConstructorCall
parent: TREEWALKER
level: TWEAKS
enabled: true
source: CHECKSTYLE
uri: https://checkstyle.sourceforge.io/config_coding.html#AvoidNoArgumentSuperConstructorCall

View file

@ -1,31 +0,0 @@
Detects double brace initialization.
Rationale: Double brace initialization (set of Instance Initializers in class
body) may look cool, but it is considered as anti-pattern and should be avoided.
This is also can lead to a hard-to-detect memory leak, if the anonymous class
instance is returned outside and other object(s) hold reference to it. Created
anonymous class is not static, it holds an implicit reference to the outer class
instance. See this
[blog post](https://blog.jooq.org/2014/12/08/dont-be-clever-the-double-curly-braces-anti-pattern/)
and
[article](https://www.baeldung.com/java-double-brace-initialization)
for more details. Check ignores any comments and semicolons in class body.
Invalid:
````java
class MyClass {
List<Integer> list1 = new ArrayList<>() { // violation
{
add(1);
}
};
List<String> list2 = new ArrayList<>() { // violation
;
// comments and semicolons are ignored
{
add("foo");
}
};
}
````

View file

@ -1,27 +0,0 @@
Checks if call to superclass constructor without arguments is present. Such invocation is redundant
because constructor body implicitly begins with a superclass constructor invocation super();
See
[specification](https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-8.8.7)
for detailed information.
Valid:
````java
class MyClass extends SomeOtherClass {
MyClass(int arg) {
super(arg); // OK, call with argument have to be explicit
}
MyClass(long arg) {
// OK, call is implicit
}
}
````
Invalid:
````java
class MyClass extends SomeOtherClass {
MyClass() {
super(); // violation
}
}
````

View file

@ -1,33 +0,0 @@
Checks that there is at least one whitespace after the leading asterisk.
Although spaces after asterisks are optional in the Javadoc comments, their
absence makes the documentation difficult to read. It is the de facto standard
to put at least one whitespace after the leading asterisk.
Valid:
````java
/** This is valid single-line Javadoc. */
class TestClass {
/**
* This is valid Javadoc.
*/
void validJavaDocMethod() {
}
/** This is valid single-line Javadoc. */
void validSingleLineJavaDocMethod() {
}
}
````
Invalid:
````java
class TestClass {
/**
*This is invalid Javadoc.
*/
int invalidJavaDoc;
/**This is invalid single-line Javadoc. */
void invalidSingleLineJavaDocMethod() {
}
}
````

View file

@ -1,48 +0,0 @@
Checks if unnecessary semicolon is used after type declaration.
Valid:
````java
class A {
class Nested {
}; // OK, nested type declarations are ignored
}
interface B {
}
enum C {
}
@interface D {
}
````
Invalid:
````java
class A {
class Nested {
}; // OK, nested type declarations are ignored
}; // violation
interface B {
}; // violation
enum C {
}; // violation
@interface D {
}; // violation
````

View file

@ -53,8 +53,8 @@
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceBeforeCaseDefaultColonCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMissingLeadingAsteriskCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.NoCodeInFileCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.coding.UnnecessarySemicolonAfterOuterTypeDeclarationCheck"/>
</module><!-- /TreeWalker -->

View file

@ -80,8 +80,8 @@
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceBeforeCaseDefaultColonCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMissingLeadingAsteriskCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.NoCodeInFileCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.coding.UnnecessarySemicolonAfterOuterTypeDeclarationCheck"/>
</module><!-- /TreeWalker -->

View file

@ -101,8 +101,6 @@
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceBeforeCaseDefaultColonCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMissingLeadingAsteriskCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.NoCodeInFileCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMissingWhitespaceAfterAsteriskCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.coding.UnnecessarySemicolonAfterOuterTypeDeclarationCheck"/>
</module><!-- /TreeWalker -->

View file

@ -144,10 +144,6 @@
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceBeforeCaseDefaultColonCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMissingLeadingAsteriskCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.NoCodeInFileCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMissingWhitespaceAfterAsteriskCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.coding.UnnecessarySemicolonAfterOuterTypeDeclarationCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.coding.AvoidDoubleBraceInitializationCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.coding.AvoidNoArgumentSuperConstructorCallCheck"/>
</module><!-- /TreeWalker -->

View file

@ -191,10 +191,6 @@
<module name="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMissingLeadingAsteriskCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.sizes.LambdaBodyLengthCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.NoCodeInFileCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMissingWhitespaceAfterAsteriskCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.coding.UnnecessarySemicolonAfterOuterTypeDeclarationCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.coding.AvoidDoubleBraceInitializationCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.coding.AvoidNoArgumentSuperConstructorCallCheck"/>
</module><!-- /TreeWalker -->

View file

@ -21,7 +21,7 @@
<kemitix-maven-tiles.version>3.1.1</kemitix-maven-tiles.version>
<maven-checkstyle-plugin.version>3.1.2</maven-checkstyle-plugin.version>
<checkstyle.version>8.45.1</checkstyle.version>
<checkstyle.version>8.45</checkstyle.version>
<sevntu.version>1.35.0</sevntu.version>
<kemitix.checkstyle.ruleset.version>${project.version}</kemitix.checkstyle.ruleset.version>