Skip to content

Commit

Permalink
Upgrade checkstyle to allow using lambdas
Browse files Browse the repository at this point in the history
  • Loading branch information
timja committed May 27, 2019
1 parent 2303376 commit c6ed5f3
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 58 deletions.
9 changes: 8 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<java.level>8</java.level>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<powermock.version>1.6.6</powermock.version>
<checkstyle.version>2.13</checkstyle.version>
<checkstyle.version>3.1.0</checkstyle.version>
<configuration-as-code.version>1.15</configuration-as-code.version>
</properties>

Expand Down Expand Up @@ -298,6 +298,13 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${checkstyle.version}</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>8.21</version>
</dependency>
</dependencies>
<configuration>
<configLocation>swe_checkstyle.xml</configLocation>
<suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,6 @@ protected void convertFromAbstract(KnowledgeBase oldKnowledgeBase) throws Except
*/
public abstract void stop();

@Override
public int hashCode() {
//Making checkstyle happy.
return super.hashCode();
}

/**
* If Statistics logging is enabled on this knowledge base or not.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public enum GraphType {
* Standard constructor.
* @param value integer representation of enum
*/
private GraphType(int value) {
GraphType(int value) {
this.value = value;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public Run getBuild(Job<? extends Job<?, ?>,
*
* @param name the name of this StringBuildId.
*/
private StringBuildId(String name) {
StringBuildId(String name) {
this.name = name;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,9 @@
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Matchers.isA;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

/**
* TestCases for {@link PluginImpl}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class TestReader extends FailureReader {
* Standard constructor.
* @param indication the indication for the reader
*/
public TestReader(final Indication indication) {
TestReader(final Indication indication) {
super(indication);
}

Expand Down Expand Up @@ -246,7 +246,7 @@ static class QuadrupleDupleLineReader extends BufferedReader {
*
* @see BufferedReader#BufferedReader(java.io.Reader, int)
*/
public QuadrupleDupleLineReader(BufferedReader in, int sz) {
QuadrupleDupleLineReader(BufferedReader in, int sz) {
super(in, sz);
}

Expand All @@ -257,7 +257,7 @@ public QuadrupleDupleLineReader(BufferedReader in, int sz) {
*
* @see BufferedReader#BufferedReader(java.io.Reader)
*/
public QuadrupleDupleLineReader(BufferedReader in) {
QuadrupleDupleLineReader(BufferedReader in) {
super(in);
}

Expand Down
79 changes: 36 additions & 43 deletions swe_checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,26 @@
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<module name="Checker">
<property name="severity" value="error"/>
<module name="FileLength"/>
<module name="FileTabCharacter"/>
<module name="FileLength"/>
<module name="FileTabCharacter"/>
<module name="RegexpSingleline">
<property name="format" value="\s+$"/>
<property name="format" value="\s+$"/>
<property name="minimum" value="0"/>
<property name="maximum" value="0"/>
<property name="message" value="Line has trailing spaces."/>
<property name="maximum" value="0"/>
<property name="message" value="Line has trailing spaces."/>
<property name="severity" value="error"/>
</module>

<module name="TreeWalker">
<module name="FileContentsHolder"/>
<module name="ConstantName">
<property name="format" value="^logger|([A-Z][A-Z0-9]*(_[A-Z0-9]+)*)$"/>
</module>

<module name="TreeWalker">
<module name="ConstantName">
<property name="format" value="^logger|([A-Z][A-Z0-9]*(_[A-Z0-9]+)*)$"/>
</module>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<module name="MemberName"/>
<module name="MethodName"/>
<module name="PackageName"/>
<module name="PackageDeclaration"/>
<module name="PackageName"/>
<module name="PackageDeclaration"/>
<module name="ParameterName"/>
<module name="StaticVariableName"/>
<module name="TypeName"/>
Expand All @@ -44,10 +43,10 @@
<module name="EmptyForIteratorPad"/>
<module name="MethodParamPad"/>
<module name="NoWhitespaceAfter">
<property name="severity" value="warning"/>
<property name="tokens" value="BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS,TYPECAST"/>
<property name="severity" value="warning"/>
<property name="tokens" value="BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS,TYPECAST"/>
</module>
<module name="NoWhitespaceBefore">
<module name="NoWhitespaceBefore">
<property name="allowLineBreaks" value="true"/>
<property name="severity" value="warning"/>
<property name="tokens" value="SEMI,DOT,POST_DEC,POST_INC"/>
Expand All @@ -73,17 +72,13 @@
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<module name="HiddenField">
<property name="ignoreSetter" value="true"/>
<property name="ignoreSetter" value="true"/>
<property name="ignoreConstructorParameter" value="true"/>
</module>
</module>
<module name="IllegalInstantiation"/>
<module name="InnerAssignment"/>
<module name="MagicNumber"/>
<module name="MissingSwitchDefault"/>
<module name="RedundantThrows">
<property name="logLoadErrors" value="true"/>
<property name="suppressLoadErrors" value="true"/>
</module>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<module name="CovariantEquals"/>
Expand All @@ -98,8 +93,8 @@
<module name="VisibilityModifier">
<property name="packageAllowed" value="true"/>
<property name="protectedAllowed" value="true"/>
</module>
<module name="ArrayTypeStyle"/>
</module>
<module name="ArrayTypeStyle"/>
<module name="TodoComment">
<property name="severity" value="ignore"/>
</module>
Expand All @@ -114,24 +109,22 @@
<module name="JavadocType"/>
<module name="JavadocVariable">
<property name="scope" value="protected"/>
</module>
<module name="FileContentsHolder"/>
<module name="MultipleVariableDeclarations" >
<property name="severity" value="warning"/>
</module>
<module name="ArrayTrailingComma">
<property name="severity" value="warning"/>
</module>
</module>
<module name="MultipleVariableDeclarations" >
<property name="severity" value="warning"/>
</module>
<module name="ArrayTrailingComma">
<property name="severity" value="warning"/>
</module>

<!-- Ignore generated code -->
<module name="SuppressionCommentFilter"/>
<module name="SuppressWithNearbyCommentFilter">
<property name="commentFormat" value="CS IGNORE (\w+) FOR NEXT (\d+) LINES\. REASON\: \w+"/>
<property name="checkFormat" value="$1"/>
<property name="influenceFormat" value="$2"/>
</module>
</module>
<module name="NewlineAtEndOfFile"/>
<module name="Translation"/>
<!-- Ignore generated code -->
<module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="This file was auto-generated from WSDL"/>
</module>
<module name="SuppressWithNearbyCommentFilter">
<property name="commentFormat" value="CS IGNORE (\w+) FOR NEXT (\d+) LINES\. REASON\: \w+"/>
<property name="checkFormat" value="$1"/>
<property name="influenceFormat" value="$2"/>
</module>
</module>
<module name="Translation"/>
</module>

0 comments on commit c6ed5f3

Please sign in to comment.