Merge pull request #61 from kemitix/release/3.3.0

Release 3.3.0
This commit is contained in:
Paul Campbell 2017-07-13 22:49:05 +01:00 committed by GitHub
commit cce981ccc6
25 changed files with 385 additions and 77 deletions

View file

@ -1,6 +1,21 @@
CHANGELOG CHANGELOG
========= =========
3.3.0
-----
* Upgrade spring boot to 1.5.4
* Upgrade platform to Brussels-SR3
* Upgrade checkstyle to 8.0
* Upgrade immutables to 2.5.6
* Upgrade mockito to 2.8.47
* Upgrade sevntu to 1.24.1
* Enable rule: EmptyPublicCtorInClass
* Enable rule: WhiteSpaceBeforeArrayInitializer
* Enable rule: FinalizeImplementation
* Enable rule: AvoidDefaultSerializableInInnerClass
3.2.0 3.2.0
----- -----

110
README.md
View file

@ -83,7 +83,7 @@ Rule|Level|Source|Enabled|Suppressible
[AtclauseOrder](#atclauseorder)|javadoc|checkstyle|Yes| [AtclauseOrder](#atclauseorder)|javadoc|checkstyle|Yes|
[AvoidConditionInversion](#avoidconditioninversion)|complexity|sevntu|| [AvoidConditionInversion](#avoidconditioninversion)|complexity|sevntu||
[AvoidConstantAsFirstOperandInCondition](#avoidconstantasfirstoperandincondition)|tweaks|sevntu|Yes| [AvoidConstantAsFirstOperandInCondition](#avoidconstantasfirstoperandincondition)|tweaks|sevntu|Yes|
[AvoidDefaultSerializableInInnerClasses](#avoiddefaultserializableininnerclasses)|complexity|sevntu|| [AvoidDefaultSerializableInInnerClasses](#avoiddefaultserializableininnerclasses)|tweaks|sevntu|Yes|
[AvoidEscapedUnicodeCharacters](#avoidescapedunicodecharacters)|tweaks|checkstyle|Yes| [AvoidEscapedUnicodeCharacters](#avoidescapedunicodecharacters)|tweaks|checkstyle|Yes|
[AvoidHidingCauseException](#avoidhidingcauseexception)|tweaks|sevntu|Yes| [AvoidHidingCauseException](#avoidhidingcauseexception)|tweaks|sevntu|Yes|
[AvoidInlineConditionals](#avoidinlineconditionals)|complexity|checkstyle|Yes| [AvoidInlineConditionals](#avoidinlineconditionals)|complexity|checkstyle|Yes|
@ -116,7 +116,7 @@ Rule|Level|Source|Enabled|Suppressible
[EmptyForInitializerPad](#emptyforinitializerpad)|layout|checkstyle|Yes| [EmptyForInitializerPad](#emptyforinitializerpad)|layout|checkstyle|Yes|
[EmptyForIteratorPad](#emptyforiteratorpad)|layout|checkstyle|Yes| [EmptyForIteratorPad](#emptyforiteratorpad)|layout|checkstyle|Yes|
[EmptyLineSeparator](#emptylineseparator)|layout|checkstyle|Yes| [EmptyLineSeparator](#emptylineseparator)|layout|checkstyle|Yes|
[EmptyPublicCtorInClass](#emptypublicctorinclass)|tweaks|sevntu|| [EmptyPublicCtorInClass](#emptypublicctorinclass)|tweaks|sevntu|Yes|
[EmptyStatement](#emptystatement)|layout|checkstyle|Yes| [EmptyStatement](#emptystatement)|layout|checkstyle|Yes|
[EnumValueName](#enumvaluename)|naming|sevntu|Yes| [EnumValueName](#enumvaluename)|naming|sevntu|Yes|
[EqualsAvoidNull](#equalsavoidnull)|tweaks|checkstyle|Yes| [EqualsAvoidNull](#equalsavoidnull)|tweaks|checkstyle|Yes|
@ -127,7 +127,7 @@ Rule|Level|Source|Enabled|Suppressible
[FileLength](#filelength)|complexity|checkstyle|Yes| [FileLength](#filelength)|complexity|checkstyle|Yes|
[FileTabCharacter](#filetabcharacter)|layout|checkstyle|Yes| [FileTabCharacter](#filetabcharacter)|layout|checkstyle|Yes|
[FinalClass](#finalclass)|complexity|checkstyle|Yes| [FinalClass](#finalclass)|complexity|checkstyle|Yes|
[FinalizeImplementation](#finalizeimplementation)|unspecified|sevntu|| [FinalizeImplementation](#finalizeimplementation)|tweaks|sevntu|Yes|
[FinalLocalVariable](#finallocalvariable)|tweaks|checkstyle|| [FinalLocalVariable](#finallocalvariable)|tweaks|checkstyle||
[FinalParameters](#finalparameters)|tweaks|checkstyle|Yes| [FinalParameters](#finalparameters)|tweaks|checkstyle|Yes|
[ForbidAnnotation](#forbidannotation)|unspecified|sevntu|| [ForbidAnnotation](#forbidannotation)|unspecified|sevntu||
@ -268,7 +268,7 @@ Rule|Level|Source|Enabled|Suppressible
[VisibilityModifier](#visibilitymodifier)|tweaks|checkstyle|Yes|No [VisibilityModifier](#visibilitymodifier)|tweaks|checkstyle|Yes|No
[WhitespaceAfter](#whitespaceafter)|layout|checkstyle|Yes| [WhitespaceAfter](#whitespaceafter)|layout|checkstyle|Yes|
[WhitespaceAround](#whitespacearound)|layout|checkstyle|Yes| [WhitespaceAround](#whitespacearound)|layout|checkstyle|Yes|
[WhitespaceBeforeArrayInitializer](#whitespacebeforearrayinitializer)|layout|sevntu|| [WhitespaceBeforeArrayInitializer](#whitespacebeforearrayinitializer)|layout|sevntu|Yes|
[WriteTag](#writetag)|unspecified|checkstyle|| [WriteTag](#writetag)|unspecified|checkstyle||
## Enabled Checks ## Enabled Checks
@ -2182,6 +2182,9 @@ Invalid:
```` ````
if (12 == a) {} if (12 == a) {}
```` ````
#### [AvoidDefaultSerializableInInnerClasses](http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/coding/AvoidDefaultSerializableInInnerClassesCheck.html)
Prevent the use of default serialization methods on inner classes. If an inner class needs to implement the Serializable interface, then it *must* implement both `writeObject()` and `readObject()` methods.
#### [AvoidHidingCauseException](http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/coding/AvoidHidingCauseExceptionCheck.html) #### [AvoidHidingCauseException](http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/coding/AvoidHidingCauseExceptionCheck.html)
Ensures that an exception is re-thrown properly and is not swallowed by a `catch` block. Ensures that an exception is re-thrown properly and is not swallowed by a `catch` block.
@ -2258,6 +2261,32 @@ Map<Long, String> idTable = new HashMap<Long, String>();
Checks that when an exception is caught, that if it is logged then it is not also re-thrown. Log or throw; one or the other or neither, but not both. Checks that when an exception is caught, that if it is logged then it is not also re-thrown. Log or throw; one or the other or neither, but not both.
Accepts `java.util.logging.Logger` and `org.slf4j.Logger`. Accepts `java.util.logging.Logger` and `org.slf4j.Logger`.
#### [EmptyPublicCtorInClass](http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/coding/EmptyPublicCtorInClassCheck.html)
This Check looks for useless empty public constructors. Class constructor is considered useless by this Check if and only if class has exactly one ctor, which is public, empty(one that has no statements) and default.
Valid:
````java
class ValidPrivateCtor {
private ValidPrivateCtor() {
}
}
class ValidOverloadedCtor {
public ValidOverloadedCtor() {
}
public ValidOverloadedCtor(int i) {
}
}
````
Invalid:
````java
class Invalid {
public Invalid() {
}
}
````
#### [EnumValueName](http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/naming/EnumValueNameCheck.html) #### [EnumValueName](http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/naming/EnumValueNameCheck.html)
Checks that Enum Values match the pattern: `^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$` Checks that Enum Values match the pattern: `^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$`
@ -2277,6 +2306,49 @@ enum InvalidConstants {
alpha, Beta; alpha, Beta;
} }
```` ````
#### [FinalizeImplementation](http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/coding/FinalizeImplementationCheck.html)
Checks that the `finalize()` implementation doesn't ignore the base class implementation, and doesn't *only* call the base class implementation.
Valid:
```java
class Valid {
protected void finalize() {
try {
doSomething();
} finally {
super.finalize();
}
}
}
```
Invalid:
```java
class InvalidNoEffect1 {
protected void finalize() {
}
}
class InvalidNoEffect2 {
protected void finalize() {
doSomething();
}
}
class InvalidUseless {
protected void finalize() {
super.finalize();
}
}
class InvalidPublic {
public void finalize() {
try {
doSomething();
} finally {
super.finalize();
}
}
}
```
#### [ForbidCCommentsInMethods](http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/coding/ForbidCCommentsInMethodsCheck.html) #### [ForbidCCommentsInMethods](http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/coding/ForbidCCommentsInMethodsCheck.html)
Prevents the use of `/* C-style */` comments inside methods. Prevents the use of `/* C-style */` comments inside methods.
@ -2581,6 +2653,24 @@ class Derived extends Base {
} }
} }
```` ````
#### [WhitespaceBeforeArrayInitializer](http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/coding/WhitespaceBeforeArrayInitializerCheck.html)
This checks enforces whitespace before array initializer.
Valid:
````java
int[] ints = new int[] {
0, 1, 2, 3
};
int[] tab = new int[]
{0, 1, 2, 3};
````
Invalid:
````java
int[] ints = new int[]{0, 1, 2, 3};
````
## Disabled Checks ## Disabled Checks
@ -2671,9 +2761,6 @@ As the sevntu check are considered experimental not all those that are not enabl
#### [AvoidConditionInversion](http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/design/AvoidConditionInversionCheck.html) #### [AvoidConditionInversion](http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/design/AvoidConditionInversionCheck.html)
Should already be covered by [SimplifyBooleanExpression](simplifybooleanexpression). Should already be covered by [SimplifyBooleanExpression](simplifybooleanexpression).
#### [AvoidDefaultSerializableInInnerClasses](http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/coding/AvoidDefaultSerializableInInnerClassesCheck.html)
TODO: enable
#### [AvoidModifiersForTypes](http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/coding/AvoidModifiersForTypesCheck.html) #### [AvoidModifiersForTypes](http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/coding/AvoidModifiersForTypesCheck.html)
Generic rule; doesn't embody a 'quality' check. Generic rule; doesn't embody a 'quality' check.
@ -2686,12 +2773,6 @@ Appears to be broken as of `1.21.0`.
#### [CustomDeclarationOrder](http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheck.html) #### [CustomDeclarationOrder](http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheck.html)
The [DeclarationOrder](#declarationorder) check already imposes an order for class elements. The [DeclarationOrder](#declarationorder) check already imposes an order for class elements.
#### [EmptyPublicCtorInClass](http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/coding/EmptyPublicCtorInClassCheck.html)
TODO: enable
#### [FinalizeImplementation](http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/coding/FinalizeImplementationCheck.html)
TODO: enable
#### [ForbidAnnotation](http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationCheck.html) #### [ForbidAnnotation](http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationCheck.html)
Generic rule; doesn't embody a 'quality' check. Generic rule; doesn't embody a 'quality' check.
@ -2710,8 +2791,5 @@ Generic rule; doesn't embody a 'quality' check.
#### [StaticMethodCandidate](http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/design/StaticMethodCandidateCheck.html) #### [StaticMethodCandidate](http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/design/StaticMethodCandidateCheck.html)
Can't handle private methods called by reflection, which may cause issues with Spring and other DI frameworks. Can't handle private methods called by reflection, which may cause issues with Spring and other DI frameworks.
#### [WhitespaceBeforeArrayInitializer](http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/coding/WhitespaceBeforeArrayInitializerCheck.html)
TODO: enable
[Effective Java]: http://amzn.to/2aSz6GE [Effective Java]: http://amzn.to/2aSz6GE

View file

@ -7,11 +7,10 @@
<parent> <parent>
<groupId>net.kemitix</groupId> <groupId>net.kemitix</groupId>
<artifactId>kemitix-checkstyle-ruleset-parent</artifactId> <artifactId>kemitix-checkstyle-ruleset-parent</artifactId>
<version>3.2.0</version> <version>3.3.0</version>
</parent> </parent>
<artifactId>kemitix-checkstyle-ruleset-builder</artifactId> <artifactId>kemitix-checkstyle-ruleset-builder</artifactId>
<version>3.2.0</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>Kemitix Checkstyle :: Ruleset :: Builder</name> <name>Kemitix Checkstyle :: Ruleset :: Builder</name>
@ -32,26 +31,6 @@
<inceptionYear>2016</inceptionYear> <inceptionYear>2016</inceptionYear>
<properties>
<spring-platform.version>Brussels-SR2</spring-platform.version>
<spring-boot.version>1.5.3.RELEASE</spring-boot.version>
<mapstream.version>2.3.5</mapstream.version>
<map-builder.version>1.0.0</map-builder.version>
<coveralls-maven-plugin.version>4.3.0</coveralls-maven-plugin.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.spring.platform</groupId>
<artifactId>platform-bom</artifactId>
<version>${spring-platform.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
@ -75,39 +54,28 @@
<dependency> <dependency>
<groupId>com.speedment.common</groupId> <groupId>com.speedment.common</groupId>
<artifactId>mapstream</artifactId> <artifactId>mapstream</artifactId>
<version>${mapstream.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>me.andrz</groupId> <groupId>me.andrz</groupId>
<artifactId>map-builder</artifactId> <artifactId>map-builder</artifactId>
<version>${map-builder.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.puppycrawl.tools</groupId> <groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId> <artifactId>checkstyle</artifactId>
<version>${checkstyle.version}</version>
<scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.github.sevntu-checkstyle</groupId> <groupId>com.github.sevntu-checkstyle</groupId>
<artifactId>sevntu-checks</artifactId> <artifactId>sevntu-checks</artifactId>
<version>${sevntu.version}</version>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>

View file

@ -1392,11 +1392,10 @@ rules:
- -
name: AvoidDefaultSerializableInInnerClasses name: AvoidDefaultSerializableInInnerClasses
parent: TREEWALKER parent: TREEWALKER
level: COMPLEXITY level: TWEAKS
enabled: false enabled: true
source: SEVNTU source: SEVNTU
uri: http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/coding/AvoidDefaultSerializableInInnerClassesCheck.html uri: http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/coding/AvoidDefaultSerializableInInnerClassesCheck.html
reason: "TODO: enable"
- -
name: AvoidModifiersForTypes name: AvoidModifiersForTypes
parent: TREEWALKER parent: TREEWALKER
@ -1433,18 +1432,16 @@ rules:
name: EmptyPublicCtorInClass name: EmptyPublicCtorInClass
parent: TREEWALKER parent: TREEWALKER
level: TWEAKS level: TWEAKS
enabled: false enabled: true
source: SEVNTU source: SEVNTU
uri: http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/coding/EmptyPublicCtorInClassCheck.html uri: http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/coding/EmptyPublicCtorInClassCheck.html
reason: "TODO: enable"
- -
name: FinalizeImplementation name: FinalizeImplementation
parent: TREEWALKER parent: TREEWALKER
level: level: TWEAKS
enabled: false enabled: true
source: SEVNTU source: SEVNTU
uri: http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/coding/FinalizeImplementationCheck.html uri: http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/coding/FinalizeImplementationCheck.html
reason: "TODO: enable"
- -
name: ForbidAnnotation name: ForbidAnnotation
parent: TREEWALKER parent: TREEWALKER
@ -1497,10 +1494,9 @@ rules:
name: WhitespaceBeforeArrayInitializer name: WhitespaceBeforeArrayInitializer
parent: TREEWALKER parent: TREEWALKER
level: LAYOUT level: LAYOUT
enabled: false enabled: true
source: SEVNTU source: SEVNTU
uri: http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/coding/WhitespaceBeforeArrayInitializerCheck.html uri: http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/coding/WhitespaceBeforeArrayInitializerCheck.html
reason: "TODO: enable"
- -
name: MoveVariableInsideIfCheck name: MoveVariableInsideIfCheck
parent: TREEWALKER parent: TREEWALKER

View file

@ -0,0 +1,2 @@
Prevent the use of default serialization methods on inner classes. If an inner class needs to implement the Serializable interface, then it *must* implement both `writeObject()` and `readObject()` methods.

View file

@ -0,0 +1,25 @@
This Check looks for useless empty public constructors. Class constructor is considered useless by this Check if and only if class has exactly one ctor, which is public, empty(one that has no statements) and default.
Valid:
````java
class ValidPrivateCtor {
private ValidPrivateCtor() {
}
}
class ValidOverloadedCtor {
public ValidOverloadedCtor() {
}
public ValidOverloadedCtor(int i) {
}
}
````
Invalid:
````java
class Invalid {
public Invalid() {
}
}
````

View file

@ -0,0 +1,42 @@
Checks that the `finalize()` implementation doesn't ignore the base class implementation, and doesn't *only* call the base class implementation.
Valid:
```java
class Valid {
protected void finalize() {
try {
doSomething();
} finally {
super.finalize();
}
}
}
```
Invalid:
```java
class InvalidNoEffect1 {
protected void finalize() {
}
}
class InvalidNoEffect2 {
protected void finalize() {
doSomething();
}
}
class InvalidUseless {
protected void finalize() {
super.finalize();
}
}
class InvalidPublic {
public void finalize() {
try {
doSomething();
} finally {
super.finalize();
}
}
}
```

View file

@ -0,0 +1,17 @@
This checks enforces whitespace before array initializer.
Valid:
````java
int[] ints = new int[] {
0, 1, 2, 3
};
int[] tab = new int[]
{0, 1, 2, 3};
````
Invalid:
````java
int[] ints = new int[]{0, 1, 2, 3};
````

View file

@ -22,8 +22,8 @@ import java.util.Map;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given; import static org.mockito.BDDMockito.given;
import static org.mockito.Matchers.any;
/** /**
* Tests for {@link CheckstyleWriter}. * Tests for {@link CheckstyleWriter}.

View file

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>net.kemitix</groupId> <groupId>net.kemitix</groupId>
<artifactId>kemitix-checkstyle-ruleset-parent</artifactId> <artifactId>kemitix-checkstyle-ruleset-parent</artifactId>
<version>3.2.0</version> <version>3.3.0</version>
</parent> </parent>
<artifactId>kemitix-checkstyle-ruleset-maven-plugin</artifactId> <artifactId>kemitix-checkstyle-ruleset-maven-plugin</artifactId>

View file

@ -16,9 +16,9 @@ import org.mockito.Mock;
import org.mockito.MockitoAnnotations; import org.mockito.MockitoAnnotations;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given; import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.then; import static org.mockito.BDDMockito.then;
import static org.mockito.Matchers.any;
/** /**
* Tests for {@link CheckMojo}. * Tests for {@link CheckMojo}.

View file

@ -29,10 +29,10 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Properties; import java.util.Properties;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.BDDMockito.given; import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.then; import static org.mockito.BDDMockito.then;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
/** /**
* Tests for {@link DefaultCheckstyleExecutor}. * Tests for {@link DefaultCheckstyleExecutor}.

View file

@ -26,10 +26,10 @@ import org.twdata.maven.mojoexecutor.MojoExecutor;
import java.util.List; import java.util.List;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.BDDMockito.given; import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.then; import static org.mockito.BDDMockito.then;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
/** /**
* Tests for {@link DefaultPluginExecutor}. * Tests for {@link DefaultPluginExecutor}.

47
pom.xml
View file

@ -11,7 +11,7 @@
</parent> </parent>
<artifactId>kemitix-checkstyle-ruleset-parent</artifactId> <artifactId>kemitix-checkstyle-ruleset-parent</artifactId>
<version>3.2.0</version> <version>3.3.0</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>Kemitix Checkstyle :: Ruleset :: Parent</name> <name>Kemitix Checkstyle :: Ruleset :: Parent</name>
@ -19,10 +19,17 @@
<properties> <properties>
<maven-checkstyle-plugin.version>2.17</maven-checkstyle-plugin.version> <maven-checkstyle-plugin.version>2.17</maven-checkstyle-plugin.version>
<checkstyle.version>7.8</checkstyle.version> <checkstyle.version>8.0</checkstyle.version>
<sevntu.version>1.24.0</sevntu.version> <sevntu.version>1.24.1</sevntu.version>
<mockito.version>1.10.19</mockito.version> <spring-platform.version>Brussels-SR3</spring-platform.version>
<spring-boot.version>1.5.4.RELEASE</spring-boot.version>
<mapstream.version>2.3.5</mapstream.version>
<map-builder.version>1.0.0</map-builder.version>
<coveralls-maven-plugin.version>4.3.0</coveralls-maven-plugin.version>
<immutables-value.version>2.5.6</immutables-value.version>
<mockito.version>2.8.47</mockito.version>
<assertj.version>3.8.0</assertj.version> <assertj.version>3.8.0</assertj.version>
</properties> </properties>
@ -50,6 +57,28 @@
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>${checkstyle.version}</version>
</dependency>
<dependency>
<groupId>com.github.sevntu-checkstyle</groupId>
<artifactId>sevntu-checks</artifactId>
<version>${sevntu.version}</version>
</dependency>
<dependency>
<groupId>io.spring.platform</groupId>
<artifactId>platform-bom</artifactId>
<version>${spring-platform.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.speedment.common</groupId>
<artifactId>mapstream</artifactId>
<version>${mapstream.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.mockito</groupId> <groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId> <artifactId>mockito-core</artifactId>
@ -60,6 +89,16 @@
<artifactId>assertj-core</artifactId> <artifactId>assertj-core</artifactId>
<version>${assertj.version}</version> <version>${assertj.version}</version>
</dependency> </dependency>
<dependency>
<groupId>me.andrz</groupId>
<artifactId>map-builder</artifactId>
<version>${map-builder.version}</version>
</dependency>
<dependency>
<groupId>org.immutables</groupId>
<artifactId>value</artifactId>
<version>${immutables-value.version}</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>

View file

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>net.kemitix</groupId> <groupId>net.kemitix</groupId>
<artifactId>kemitix-checkstyle-ruleset-parent</artifactId> <artifactId>kemitix-checkstyle-ruleset-parent</artifactId>
<version>3.2.0</version> <version>3.3.0</version>
</parent> </parent>
<artifactId>kemitix-checkstyle-ruleset-regressions</artifactId> <artifactId>kemitix-checkstyle-ruleset-regressions</artifactId>
@ -16,14 +16,12 @@
<kemitix-checkstyle-ruleset.version>${project.version}</kemitix-checkstyle-ruleset.version> <kemitix-checkstyle-ruleset.version>${project.version}</kemitix-checkstyle-ruleset.version>
<kemitix-checkstyle-ruleset.level>5-complexity</kemitix-checkstyle-ruleset.level> <kemitix-checkstyle-ruleset.level>5-complexity</kemitix-checkstyle-ruleset.level>
<pitest.skip>true</pitest.skip> <pitest.skip>true</pitest.skip>
<immutables.version>2.4.4</immutables.version>
</properties> </properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.immutables</groupId> <groupId>org.immutables</groupId>
<artifactId>value</artifactId> <artifactId>value</artifactId>
<version>${immutables.version}</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View file

@ -0,0 +1,41 @@
/**
* The MIT License (MIT)
*
* Copyright (c) 2017 Paul Campbell
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
* and associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies
* or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package net.kemitix.checkstyle.regressions;
import java.io.Serializable;
/**
* Regression test for {@code AvoidDefaultSerializableInInnerClasses}.
*
* @author Paul Campbell (pcampbell@kemitix.net)
*/
public class AvoidDefaultSerializableInInnerClasses {
/**
* Inner class should not use default implementations of {@code readObject()} and {@code writeObject()}.
*/
@SuppressWarnings("avoiddefaultserializableininnerclasses")
public class InnerClass implements Serializable {
}
}

View file

@ -0,0 +1,38 @@
/**
* The MIT License (MIT)
*
* Copyright (c) 2017 Paul Campbell
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
* and associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies
* or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package net.kemitix.checkstyle.regressions;
/**
* Regression demo for {@code EmptyPublicCtorInClassCheck}.
*
* @author Paul Campbell (pcampbell@kemitix.net)
*/
public class EmptyPublicCtorInClass {
/**
* Useless empty public constructors.
*/
@SuppressWarnings("emptypublicctorinclass")
EmptyPublicCtorInClass() {
}
}

View file

@ -26,7 +26,7 @@ package net.kemitix.checkstyle.regressions;
* *
* @author Paul Campbell (pcampbell@kemitix.net). * @author Paul Campbell (pcampbell@kemitix.net).
*/ */
@SuppressWarnings("hideutilityclassconstructor") @SuppressWarnings({"hideutilityclassconstructor", "PMD.UnusedPrivateField"})
class ExplicitInitialization { class ExplicitInitialization {
private boolean validBoolean = false; private boolean validBoolean = false;

View file

@ -0,0 +1,39 @@
/**
* The MIT License (MIT)
*
* Copyright (c) 2017 Paul Campbell
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
* and associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies
* or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package net.kemitix.checkstyle.regressions;
/**
* Regression test for {@code FinalizeImplementationCheck}.
*
* @author Paul Campbell pcampbell@kemitix.net
*/
class FinalizeImplementation {
/**
* Negates effect of superclass finalize.
*/
@SuppressWarnings({"PMD.EmptyFinalizer", "nofinalizer", "finalizeimplementation"})
protected void finalize() {
// doesn't call super.finalize()
}
}

View file

@ -7,11 +7,10 @@
<parent> <parent>
<groupId>net.kemitix</groupId> <groupId>net.kemitix</groupId>
<artifactId>kemitix-checkstyle-ruleset-parent</artifactId> <artifactId>kemitix-checkstyle-ruleset-parent</artifactId>
<version>3.2.0</version> <version>3.3.0</version>
</parent> </parent>
<artifactId>kemitix-checkstyle-ruleset</artifactId> <artifactId>kemitix-checkstyle-ruleset</artifactId>
<version>3.2.0</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>Kemitix Checkstyle :: Ruleset</name> <name>Kemitix Checkstyle :: Ruleset</name>

View file

@ -59,6 +59,7 @@
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck"/> <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.WhitespaceAroundCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.ForbidCCommentsInMethodsCheck"/> <module name="com.github.sevntu.checkstyle.checks.coding.ForbidCCommentsInMethodsCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.WhitespaceBeforeArrayInitializerCheck"/>
</module><!-- /TreeWalker --> </module><!-- /TreeWalker -->

View file

@ -91,6 +91,7 @@
<module name="com.github.sevntu.checkstyle.checks.coding.NumericLiteralNeedsUnderscoreCheck"/> <module name="com.github.sevntu.checkstyle.checks.coding.NumericLiteralNeedsUnderscoreCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.SimpleAccessorNameNotationCheck"/> <module name="com.github.sevntu.checkstyle.checks.coding.SimpleAccessorNameNotationCheck"/>
<module name="com.github.sevntu.checkstyle.checks.naming.UniformEnumConstantNameCheck"/> <module name="com.github.sevntu.checkstyle.checks.naming.UniformEnumConstantNameCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.WhitespaceBeforeArrayInitializerCheck"/>
</module><!-- /TreeWalker --> </module><!-- /TreeWalker -->

View file

@ -117,6 +117,7 @@
<module name="com.github.sevntu.checkstyle.checks.coding.NumericLiteralNeedsUnderscoreCheck"/> <module name="com.github.sevntu.checkstyle.checks.coding.NumericLiteralNeedsUnderscoreCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.SimpleAccessorNameNotationCheck"/> <module name="com.github.sevntu.checkstyle.checks.coding.SimpleAccessorNameNotationCheck"/>
<module name="com.github.sevntu.checkstyle.checks.naming.UniformEnumConstantNameCheck"/> <module name="com.github.sevntu.checkstyle.checks.naming.UniformEnumConstantNameCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.WhitespaceBeforeArrayInitializerCheck"/>
</module><!-- /TreeWalker --> </module><!-- /TreeWalker -->

View file

@ -177,6 +177,10 @@
<module name="com.github.sevntu.checkstyle.checks.naming.UniformEnumConstantNameCheck"/> <module name="com.github.sevntu.checkstyle.checks.naming.UniformEnumConstantNameCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.UselessSingleCatchCheck"/> <module name="com.github.sevntu.checkstyle.checks.coding.UselessSingleCatchCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.UselessSuperCtorCallCheck"/> <module name="com.github.sevntu.checkstyle.checks.coding.UselessSuperCtorCallCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.AvoidDefaultSerializableInInnerClassesCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.EmptyPublicCtorInClassCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.FinalizeImplementationCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.WhitespaceBeforeArrayInitializerCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.MoveVariableInsideIfCheck"/> <module name="com.github.sevntu.checkstyle.checks.coding.MoveVariableInsideIfCheck"/>
</module><!-- /TreeWalker --> </module><!-- /TreeWalker -->

View file

@ -230,6 +230,10 @@
<module name="com.github.sevntu.checkstyle.checks.naming.UniformEnumConstantNameCheck"/> <module name="com.github.sevntu.checkstyle.checks.naming.UniformEnumConstantNameCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.UselessSingleCatchCheck"/> <module name="com.github.sevntu.checkstyle.checks.coding.UselessSingleCatchCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.UselessSuperCtorCallCheck"/> <module name="com.github.sevntu.checkstyle.checks.coding.UselessSuperCtorCallCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.AvoidDefaultSerializableInInnerClassesCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.EmptyPublicCtorInClassCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.FinalizeImplementationCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.WhitespaceBeforeArrayInitializerCheck"/>
<module name="com.github.sevntu.checkstyle.checks.coding.MoveVariableInsideIfCheck"/> <module name="com.github.sevntu.checkstyle.checks.coding.MoveVariableInsideIfCheck"/>
</module><!-- /TreeWalker --> </module><!-- /TreeWalker -->