From 1ca2b9f2d3c78e0d5f9504478afc5d50c130cb83 Mon Sep 17 00:00:00 2001
From: rnveach
Date: Sat, 3 Dec 2016 09:24:59 -0500
Subject: [PATCH 001/208] minor: removed unused properties
---
.../checks/annotation/messages.properties | 13 -----
.../checks/coding/messages.properties | 51 -------------------
.../checks/design/messages.properties | 6 ---
.../checks/naming/messages.properties | 3 --
.../checks/sizes/messages.properties | 6 ---
.../checks/whitespace/messages.properties | 1 -
6 files changed, 80 deletions(-)
delete mode 100644 sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/whitespace/messages.properties
diff --git a/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/annotation/messages.properties b/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/annotation/messages.properties
index 364c1c8aac..0e1fc4b4c7 100644
--- a/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/annotation/messages.properties
+++ b/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/annotation/messages.properties
@@ -1,16 +1,3 @@
-annotation.missing.deprecated=Must include both @java.lang.Deprecated annotation and @deprecated Javadoc tag with description.
-annotation.missing.override=Must include @java.lang.Override annotation when '{'@inheritDoc'}' Javadoc tag exists.
annotation.missing.required.parameter=The annotation {0} is missing required parameters {1}.
-annotation.not.valid.on=The annotation {0} is not valid at this location.
-annotation.incorrect.style=Annotation style must be ''{0}''.
annotation.incorrect.target=Incorrect target: ''{0}'' for annotation: ''{1}''.
-annotation.trailing.comma.missing=Annotation array values must contain trailing comma.
-annotation.trailing.comma.present=Annotation array values cannot contain trailing comma.
-annotation.parens.missing=Annotation must have closing parenthesis.
-annotation.parens.present=Annotation cannot have closing parenthesis.
-annotation.package.location=Package annotations must be in the package-info.java info.
annotation.forbid.element.value=Forbidden element ''{0}'' in annotation ''{1}''.
-suppressed.warning.not.allowed=The warning ''{0}'' cannot be suppressed at this location.
-javadoc.duplicateTag=Duplicate {0} tag.
-javadoc.missing=Missing a Javadoc comment.
-tag.not.valid.on=The Javadoc {0} tag is not valid at this location.
diff --git a/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/coding/messages.properties b/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/coding/messages.properties
index dde333fbcd..4fd9036d13 100644
--- a/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/coding/messages.properties
+++ b/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/coding/messages.properties
@@ -1,14 +1,8 @@
-array.trailing.comma=Array should contain trailing comma.
-assignment.inner.avoid=Inner assignments should be avoided.
-avoid.declare.constants=Constants declaration inside interfaces should be avoided.
avoid.default.serializable.in.inner.classes=Inner class should not implement default Serializable interface.
-avoid.finalizer.method=Usage of finalizer method should be avoided.
-avoid.clone.method=Usage of 'clone' method should be avoided.
avoid.hiding.cause.exception=Cause exception ''{0}'' was lost.
avoid.not.short.circuit.operators.for.boolean=Short-circuit operator should be used instead of ''{0}''.
avoid.modifiers.for.types=''{0}'' instance should not have ''{1}'' modifier.
avoid.constant.as.first.operand.in.condition=Constant have to be second operand of ''{0}''.
-covariant.equals=Covariant equals without overriding equals(java.lang.Object).
confusing.condition.check=Avoid negation within an "if" expression with an "else" clause.
custom.declaration.order.field=Field definition in wrong order. Expected ''{0}'' then ''{1}''.
custom.declaration.order.constructor=Constructor definition in wrong order. Expected ''{0}'' then ''{1}''.
@@ -19,21 +13,9 @@ custom.declaration.order.enum=Enum definition in wrong order. Expected ''{0}'' t
custom.declaration.order.invalid.setter=Setter ''{0}'' is in wrong order. Should be right after ''{1}''.
declaration.order.constructor=Constructor definition in wrong order.
declaration.order.method=Method definition in wrong order.
-declaration.order.static=Static variable definition in wrong order.
-declaration.order.instance=Instance variable definition in wrong order.
-declaration.order.access=Variable access definition in wrong order.
-default.comes.last=Default should be the last switch label.
diamond.operator.for.variable.definition = Diamond operator expected.
-doublechecked.locking.avoid=The double-checked locking idiom is broken and should be avoided.
-empty.statement=Empty statement.
empty.public.ctor=This empty public constructor is useless.
-equals.avoid.null=String literal expressions should be on the left side of an equals comparison.
-equals.noHashCode=Definition of ''equals()'' without corresponding definition of ''hashCode()''.
either.log.or.throw=Either log or throw exception.
-explicit.init=Variable ''{0}'' explicitly initialized to ''{1}'' (default value for its type).
-fall.through=Fall through from previous branch of the switch statement.
-fall.through.last=Fall through from the last branch of the switch statement.
-final.variable=Variable ''{0}'' should be declared final.
finalize.implementation.missed.try.finally = finalize() method should contain try-finally block with super.finalize() call inside finally block.
finalize.implementation.public = finalize() method should have a "protected" visibility.
finalize.implementation.useless = finalize() method is useless: it does nothing except for calling super.finalize().
@@ -42,60 +24,27 @@ forbid.certain.imports=Import ''{1}'' should not match ''{0}'' pattern, it is fo
forbid.c.comments.in.the.method.body=C-style comments (/*...*/) inside method body are not allowed.
forbid.return.in.finally.block=Finally block should not contain return statements.
forbid.throw.anonymous.exception=Avoid throwing anonymous exception.
-hidden.field=''{0}'' hides a field.
illegal.catch=Catching ''{0}'' is not allowed.
-illegal.throw=Throwing ''{0}'' is not allowed.
forbid.instantiation=Instantiation of ''{0}'' is not allowed.
-illegal.token=Usage of ''{0}'' is not allowed.
-illegal.token.text=Token text matches an illegal pattern ''{0}''.
-illegal.type=Declaring variables, return values or parameters of type ''{0}'' is not allowed.
incorrect.getter.name=Unexpected getter name.
incorrect.setter.name=Unexpected setter name.
-inline.conditional.avoid=Inline conditionals should be avoided.
-instantiation.avoid=Instantiation of {0} should be avoided.
-junit.method.name=The method ''{0}'' should be named ''{1}''.
-junit.method.return.type=The method ''{0}'' must be declared with a {1} return type.
-junit.method.parameters=The method ''{0}'' must be declared with no parameters.
-junit.method.public.and.static=The method ''{0}'' must be declared static.
-junit.method.protected.or.public=The method ''{0}'' must be public or protected.
-junit.method.static=The method ''{0}'' shouldn''t be static.
logic.condition.need.optimization=Condition with {0} at line {1} position {2} need optimization. All method calls are advised to move to end of logic expression.
-magic.number=''{0}'' is a magic number.
map.iteration.entrySet=You are using both keys and values for this map. It is better to use entrySet() instead of keySet() + get().
map.iteration.keySet=It is better to use keySet() method to iterate over this map because you aren`t using values.
map.iteration.values=You are using only values of this map. It is better to use values() to iterate this map.
redundant.return=Redundant return.
-missing.ctor=Class should define a constructor.
-missing.package.declaration=Missing package declaration.
-missing.super.call=Method ''{0}'' should call ''super.{0}''.
-missing.switch.default=switch without \"default\" clause.
-modified.control.variable=Control variable ''{0}'' is modified.
multiple.string.literal=The String {0} appears {1} times in the file.
multiple.variable.declarations=Only one variable definition per line allowed.
multiple.variable.declarations.comma=Each variable declaration must be in its own statement.
name.convention.for.test.classes=JUnit test class name should match ''{0}'' pattern.
-nested.if.depth=Nested if-else depth is {0,number,integer} (max allowed is {1,number,integer}).
-nested.try.depth=Nested try depth is {0,number,integer} (max allowed is {1,number,integer}).
no.null.for.collections=Method should return empty collection instead of null.
numeric.literal.need.underscore=Numeric literal should have underscores.
overridable.method=Overridable method ''{0}'' is called in {1} body.
overridable.method.leads=Calling the method ''{0}'' in {1} body leads to the call of the overridable method ''{2}''.
-parameter.assignment=Assignment of parameter ''{0}'' is not allowed.
redundant.return.check=Redundant return.
-redundant.throws.classInfo=Unable to get class information for {0}.
-redundant.throws.duplicate=Redundant throws: ''{0}'' listed more then one time.
-redundant.throws.subclass=Redundant throws: ''{0}'' is subclass of ''{1}''.
-redundant.throws.unchecked=Redundant throws: ''{0}'' is unchecked exception.
-require.this.variable=Reference to instance variable ''{0}'' needs \"this.\".
-require.this.unfound.variable=Unable find where ''{0}'' is declared.
-require.this.method=Method call to ''{0}'' needs \"this.\".
return.count.extended.method=Return count for ''{0}'' method is {1} (max allowed is {2}).
return.count.extended.ctor=Return count for ''{0}'' constructor is {1} (max allowed is {2}).
-return.depth=Return depth is {0,number,integer} (max allowed is {1,number,integer}).
-simplify.boolreturn=Conditional logic can be removed.
-simplify.expression=Expression can be simplified.
single.break.or.continue.in.loops=Loops should not contain more than a single "break" or "continue" statement
-string.literal.equality=Literal Strings should be compared using equals(), not ''{0}''.
ternary.per.expression.count=More than {0} ternary operators in expression.
unnecessary.paren.assign=Unnecessary parentheses around assignment right-hand side.
unnecessary.paren.expr=Unnecessary parentheses around expression.
diff --git a/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/design/messages.properties b/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/design/messages.properties
index a80d88568c..c480b2c883 100644
--- a/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/design/messages.properties
+++ b/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/design/messages.properties
@@ -4,12 +4,6 @@ avoid.nested.switch=Nested switch should be avoided, extract nested switch block
avoid.main.method.in.abstract.class=Main method inside abstract class should be avoided.
cause.parameter.in.exception=''{0}'' class should have a constructor with exception cause as parameter.
child.block.length=Block length is {0} lines, but should be lesser or equal to {1} lines.
-design.forExtension=Method ''{0}'' is not designed for extension - needs to be abstract, final or empty.
-final.class=Class {0} should be declared as final.
-interface.type=interfaces should describe a type and hence have methods.
-variable.notPrivate=Variable ''{0}'' must be private and have accessor methods.
-mutable.exception=The field ''{0}'' must be declared final.
-throws.count=Throws count is {0,number,integer} (max allowed is {1,number,integer}).
hide.utility.class=Utility classes should not have a public or default constructor.
forbid.wildcard.as.return.type=Wildcard as return type should be avoided.
public.reference.to.private.type=Reference to the the instance of private type: {0}.
diff --git a/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/naming/messages.properties b/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/naming/messages.properties
index d4b7f4b6ed..d2322e5b21 100644
--- a/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/naming/messages.properties
+++ b/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/naming/messages.properties
@@ -1,7 +1,4 @@
name.invalidPattern=Name ''{0}'' must match pattern ''{1}''.
-illegal.abstract.class.name=Name ''{0}'' must match pattern ''{1}''.
-no.abstract.class.modifier=Class ''{0}'' must has abstract modifier.
-method.name.equals.class.name=Method Name ''{0}'' must not equal the enclosing class name.
enum.name.const.invalidPattern=Name of Values Enumeration ''{0}'' must match pattern ''{1}''.
enum.name.obj.invalidPattern=Name of Class Enumeration ''{0}'' must match pattern ''{1}''.
enum.name.formats.violated=Name of enumeration value ''{0}'' must match one of patterns: {1}.
diff --git a/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/sizes/messages.properties b/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/sizes/messages.properties
index f62baa656c..8adbb4e74b 100644
--- a/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/sizes/messages.properties
+++ b/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/sizes/messages.properties
@@ -1,7 +1 @@
-executableStatementCount=Executable statement count is {0,number,integer} (max allowed is {1,number,integer}).
-maxLen.file=File length is {0,number,integer} lines (max allowed is {1,number,integer}).
-maxLen.method=Method length is {0,number,integer} lines (max allowed is {1,number,integer}).
-maxLen.anonInner=Anonymous inner class length is {0,number,integer} lines (max allowed is {1,number,integer}).
maxLineLen=Line is longer than {0,number,integer} characters. Current line length is {1,number,integer}.
-maxOuterTypes=Outer types defined is {0,number,integer} (max allowed is {1,number,integer}).
-maxParam=More than {0,number,integer} parameters.
diff --git a/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/whitespace/messages.properties b/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/whitespace/messages.properties
deleted file mode 100644
index 3ebf816e2f..0000000000
--- a/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/whitespace/messages.properties
+++ /dev/null
@@ -1 +0,0 @@
-single.space.separator=Use a single space to separate tokens.
From b3f59ada0f26b59d3c33cdd61db5a9bc163ab178 Mon Sep 17 00:00:00 2001
From: rnveach
Date: Sat, 3 Dec 2016 20:28:40 -0500
Subject: [PATCH 002/208] Issue #451: reworked travis and added PR desc testing
---
.travis.yml | 103 +++++++++++++++++++++++++++++++++++++++++++---------
1 file changed, 85 insertions(+), 18 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index fb8534f514..2f4757a258 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,24 +1,6 @@
language: java
sudo: false
-jdk:
- - oraclejdk8
-
-before_install: git clone git://git.code.sf.net/p/eclipse-cs/git eclipse-cs-git
- && cd eclipse-cs-git/ && git checkout 7.2.0
- && cd net.sf.eclipsecs.parent/ && mvn install
- && cd ../../
-
-install: cd sevntu-checks && mvn clean install && mvn javadoc:javadoc
- && cd ../eclipsecs-sevntu-plugin && mvn verify && mvn javadoc:javadoc
- && cd ../sevntu-checkstyle-maven-plugin && mvn verify && mvn javadoc:javadoc
- && cd ../sevntu-checkstyle-idea-extension && mvn verify && mvn javadoc:javadoc
- && cd ../sevntu-checkstyle-sonar-plugin && mvn verify && mvn javadoc:javadoc
- && cd ../sevntu-checks && mvn jacoco:report coveralls:jacoco
- && cd ../sevntu-checks && mvn verify -Pselftesting
-
-after_success:
-
cache:
directories:
- ~/.m2
@@ -27,5 +9,90 @@ branches:
only:
- master
+install:
+ -
+
matrix:
fast_finish: true
+ include:
+ # eclipse-cs
+ - jdk: oraclejdk8
+ env:
+ - DESC="eclipse-cs"
+ - CMD0="git clone git://git.code.sf.net/p/eclipse-cs/git eclipse-cs-git"
+ - CMD1="&& cd eclipse-cs-git/ && git checkout 7.2.0"
+ - CMD2="&& cd net.sf.eclipsecs.parent/ && mvn install"
+ - CMD3="&& cd ../../"
+ - CMD4="&& cd eclipsecs-sevntu-plugin && mvn verify && mvn javadoc:javadoc"
+ - CMD=$CMD0$CMD1$CMD2$CMD3$CMD4
+ - PREINSTALL="true"
+
+ # maven-plugin
+ - jdk: oraclejdk8
+ env:
+ - DESC="maven-plugin"
+ - CMD="cd sevntu-checkstyle-maven-plugin && mvn verify && mvn javadoc:javadoc"
+ - PREINSTALL="true"
+
+ # idea-extension
+ - jdk: oraclejdk8
+ env:
+ - DESC="idea-extension"
+ - CMD="cd sevntu-checkstyle-idea-extension && mvn verify && mvn javadoc:javadoc"
+ - PREINSTALL="true"
+
+ # sonar-plugin
+ - jdk: oraclejdk8
+ env:
+ - DESC="sonar-plugin"
+ - CMD="cd sevntu-checkstyle-sonar-plugin && mvn verify && mvn javadoc:javadoc"
+ - PREINSTALL="true"
+
+ # checks
+ - jdk: oraclejdk8
+ env:
+ - DESC="checks"
+ - CMD0="cd sevntu-checks && mvn install"
+ - CMD1="&& mvn verify -Pselftesting"
+ - CMD2="&& mvn javadoc:javadoc"
+ - CMD3="&& mvn jacoco:report coveralls:jacoco"
+ - CMD=$CMD0$CMD1$CMD2$CMD3
+
+ # testing of PR format
+ - env:
+ - DESC="test Issue ref in PR description"
+ - CMD_="set -e"
+ - CMD0=" && if [[ ! $TRAVIS_PULL_REQUEST =~ ^([0-9]*)$ ]]; then exit 0; fi "
+ - CMD1=" && LINK_COMMITS=https://api.github.com/repos/checkstyle/checkstyle/pulls/$TRAVIS_PULL_REQUEST/commits "
+ - CMD2=" && COMMITS=\$(curl -s -H 'Authorization: token $GITHUB_AUTH_TOKEN' \$LINK_COMMITS | jq '.[0] | .commit.message') "
+ - CMD3=" && echo 'Messages from github:'\${COMMITS:0:60}... "
+ - CMD4=" && ISSUE_NUMBER=\$( echo \$COMMITS | sed -e 's/^.*Issue //' | sed -e 's/:.*//') "
+ - CMD5=" && echo 'Issue number:'\$ISSUE_NUMBER && RESULT=0"
+ - CMD6=" && if [[ \$ISSUE_NUMBER =~ ^#[0-9]+$ ]]; then "
+ - CMD7=" LINK_PR=https://api.github.com/repos/checkstyle/checkstyle/pulls/$TRAVIS_PULL_REQUEST "
+ - CMD8=" && LINK_ISSUE=https://api.github.com/repos/checkstyle/checkstyle/issues/\${ISSUE_NUMBER:1} "
+ - CMD9=" && REGEXP=(\$ISSUE_NUMBER\|https://github.com/checkstyle/checkstyle/issues/\${ISSUE_NUMBER:1})"
+ - CMD10=" && PR_DESC=\$(curl -s -H 'Authorization: token $GITHUB_AUTH_TOKEN' \$LINK_PR | jq '.body' | grep -E \$REGEXP | cat ) "
+ - CMD11=" && echo 'PR Description grepped:'\${PR_DESC:0:80} "
+ - CMD12=" && if [[ -z \$PR_DESC ]]; then "
+ - CMD13=" echo 'Please put a reference of Issue to PR description, this will bind Issue and PR in Github' && RESULT=1; "
+ - CMD14=" fi "
+ - CMD15=" && LABEL_APRV=\$(curl -s -H 'Authorization: token $GITHUB_AUTH_TOKEN' \$LINK_ISSUE | jq '.labels [] | .name' | grep approved | cat | wc -l ) "
+ - CMD16=" && if [[ \$LABEL_APRV == 0 ]]; then "
+ - CMD17=" echo 'You provide PR to Issue that is not approved yes, please ask admins to approve your issue first' && RESULT=1; "
+ - CMD18=" fi "
+ - CMD19=" fi "
+ - CMD20=" && if [[ \$RESULT == 0 ]]; then "
+ - CMD21=" echo 'PR validation succeed.'; "
+ - CMD22=" else "
+ - CMD23=" echo 'PR validation failed.' && false; "
+ - CMD24=" fi "
+ - CMD=$CMD_$CMD0$CMD1$CMD2$CMD3$CMD4$CMD5$CMD6$CMD7$CMD8$CMD9$CMD10$CMD11$CMD12$CMD13$CMD14$CMD15
+ - CMD=$CMD$CMD16$CMD17$CMD18$CMD19$CMD20$CMD21$CMD22$CMD23$CMD24
+
+
+script:
+ - if [[ $PREINSTALL == 'true' ]]; then cd sevntu-checks && mvn clean install -Dmaven.test.skip=true -Dcheckstyle.skip=true -Dcobertura.skip=true && cd .. ; fi
+ - eval $CMD
+
+after_success:
From 4e33ce17f6f53b1fda0b212d0cd65b861baad9eb Mon Sep 17 00:00:00 2001
From: rnveach
Date: Sat, 3 Dec 2016 10:35:19 -0500
Subject: [PATCH 003/208] Issue #463: extended ReturnCountExtendedCheck to
accept lambdas
---
.../checks/coding/checkstyle-metadata.xml | 1 +
sevntu-checks/pom.xml | 1 -
.../coding/ReturnCountExtendedCheck.java | 165 ++++++++++--------
.../checks/coding/messages.properties | 1 +
.../coding/ReturnCountExtendedCheckTest.java | 50 ++++++
...urnCountExtendedCheckAnonymousClasses.java | 29 +++
.../InputReturnCountExtendedCheckLambdas.java | 60 +++++++
7 files changed, 231 insertions(+), 76 deletions(-)
create mode 100644 sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputReturnCountExtendedCheckAnonymousClasses.java
create mode 100644 sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputReturnCountExtendedCheckLambdas.java
diff --git a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/coding/checkstyle-metadata.xml b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/coding/checkstyle-metadata.xml
index 9e53dda6bc..1858e724bf 100644
--- a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/coding/checkstyle-metadata.xml
+++ b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/coding/checkstyle-metadata.xml
@@ -431,6 +431,7 @@
+
diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml
index ff86817128..a08f27cc5f 100644
--- a/sevntu-checks/pom.xml
+++ b/sevntu-checks/pom.xml
@@ -175,7 +175,6 @@
.*.checks.coding.OverridableMethodInConstructorCheck8899.*.checks.coding.RedundantReturnCheck9897.*.checks.coding.ReturnBooleanFromTernaryCheck75100
- .*.checks.coding.ReturnCountExtendedCheck91100.*.checks.coding.ReturnNullInsteadOfBooleanCheck8088.*.checks.coding.SimpleAccessorNameNotationCheck72100.*.checks.coding.UnnecessaryParenthesesExtendedCheck90100
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ReturnCountExtendedCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ReturnCountExtendedCheck.java
index 20cecc460b..7e71874b98 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ReturnCountExtendedCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ReturnCountExtendedCheck.java
@@ -21,8 +21,6 @@
import java.util.Collection;
import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
import java.util.Set;
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
@@ -49,7 +47,12 @@
*
Methods by name ("ignoreMethodsNames" property). Note, that the "ignoreMethodsNames"
* property type is a RegExp:
* using this property you can list the names of ignored methods separated by comma (but you
- * can also use '|' to separate different method names in usual for RegExp style).
+ * can also use '|' to separate different method names in usual for RegExp style).
+ * If the violation is on a lambda, since it has no method name, you can specify the string
+ * {@code null} to ignore all lambda violations for now. It should be noted, that ignoring lambdas
+ * this way may not always be supported as it is a hack and giving all lambdas the same name. It
+ * could be changed if a better way to single out individual lambdas if found.
+ *
*
Methods which linelength less than given value ("linesLimit" property).
*
"return" statements which depth is greater or equal to the given value ("returnDepthLimit"
* property). There are few supported
@@ -81,12 +84,19 @@ public class ReturnCountExtendedCheck extends AbstractCheck {
"return.count.extended.ctor";
/**
- * Default maximum allowed "return" literals count per method/ctor.
+ * A key is pointing to the warning message text in "messages.properties"
+ * file.
+ */
+ public static final String MSG_KEY_LAMBDA =
+ "return.count.extended.lambda";
+
+ /**
+ * Default maximum allowed "return" literals count per method/ctor/lambda.
*/
private static final int DEFAULT_MAX_RETURN_COUNT = 1;
/**
- * Default number of lines of which method/ctor body may consist to be
+ * Default number of lines of which method/ctor/lambda body may consist to be
* skipped by check.
*/
private static final int DEFAULT_IGNORE_METHOD_LINES_COUNT = 20;
@@ -99,7 +109,7 @@ public class ReturnCountExtendedCheck extends AbstractCheck {
/**
* Number which defines, how many lines of code on the top of current
- * processed method/ctor will be ignored by check.
+ * processed method/ctor/lambda will be ignored by check.
*/
private static final int DEFAULT_TOP_LINES_TO_IGNORE_COUNT = 5;
@@ -109,12 +119,12 @@ public class ReturnCountExtendedCheck extends AbstractCheck {
private Set ignoreMethodsNames = new HashSet<>();
/**
- * Maximum allowed "return" literals count per method/ctor (1 by default).
+ * Maximum allowed "return" literals count per method/ctor/lambda (1 by default).
*/
private int maxReturnCount = DEFAULT_MAX_RETURN_COUNT;
/**
- * Maximum number of lines of which method/ctor body may consist to be
+ * Maximum number of lines of which method/ctor/lambda body may consist to be
* skipped by check. 20 by default.
*/
private int ignoreMethodLinesCount = DEFAULT_IGNORE_METHOD_LINES_COUNT;
@@ -125,14 +135,14 @@ public class ReturnCountExtendedCheck extends AbstractCheck {
private int minIgnoreReturnDepth = DEFAULT_MIN_IGNORE_RETURN_DEPTH;
/**
- * Option to ignore "empty" return statements in void methods and ctors.
+ * Option to ignore "empty" return statements in void methods and ctors and lambdas.
* "true" by default.
*/
private boolean ignoreEmptyReturns = true;
/**
* Number which defines, how many lines of code on the top of each
- * processed method/ctor will be ignored by check. 5 by default.
+ * processed method/ctor/lambda will be ignored by check. 5 by default.
*/
private int topLinesToIgnoreCount = DEFAULT_TOP_LINES_TO_IGNORE_COUNT;
@@ -159,7 +169,7 @@ public void setIgnoreMethodsNames(String[] ignoreMethodNames) {
}
/**
- * Sets maximum allowed "return" literals count per method/ctor.
+ * Sets maximum allowed "return" literals count per method/ctor/lambda.
* @param maxReturnCount - the new "maxReturnCount" property value.
* @see ReturnCountExtendedCheck#maxReturnCount
*/
@@ -168,7 +178,7 @@ public void setMaxReturnCount(int maxReturnCount) {
}
/**
- * Sets the maximum number of lines of which method/ctor body may consist to
+ * Sets the maximum number of lines of which method/ctor/lambda body may consist to
* be skipped by check.
* @param ignoreMethodLinesCount
* - the new value of "ignoreMethodLinesCount" property.
@@ -189,7 +199,7 @@ public void setMinIgnoreReturnDepth(int minIgnoreReturnDepth) {
}
/**
- * Sets the "ignoring empty return statements in void methods and ctors"
+ * Sets the "ignoring empty return statements in void methods and ctors and lambdas"
* option state.
* @param ignoreEmptyReturns
* the new "allowEmptyReturns" property value.
@@ -212,16 +222,20 @@ public void setTopLinesToIgnoreCount(int topLinesToIgnoreCount) {
@Override
public int[] getDefaultTokens() {
- return new int[] {TokenTypes.METHOD_DEF, TokenTypes.CTOR_DEF, };
+ return new int[] {
+ TokenTypes.METHOD_DEF,
+ TokenTypes.CTOR_DEF,
+ TokenTypes.LAMBDA,
+ };
}
@Override
- public void visitToken(final DetailAST methodDefNode) {
- final DetailAST openingBrace = methodDefNode
+ public void visitToken(final DetailAST node) {
+ final DetailAST openingBrace = node
.findFirstToken(TokenTypes.SLIST);
- final String methodName = getMethodName(methodDefNode);
+ final String nodeName = getMethodName(node);
if (openingBrace != null
- && !matches(methodName, ignoreMethodsNames)) {
+ && !matches(nodeName, ignoreMethodsNames)) {
final DetailAST closingBrace = openingBrace.getLastChild();
int curMethodLinesCount = getLinesCount(openingBrace,
@@ -233,33 +247,48 @@ public void visitToken(final DetailAST methodDefNode) {
if (curMethodLinesCount >= ignoreMethodLinesCount) {
- final int mCurReturnCount = getReturnCount(methodDefNode,
+ final int mCurReturnCount = getReturnCount(node,
openingBrace);
if (mCurReturnCount > maxReturnCount) {
- final String mKey;
-
- if (methodDefNode.getType() == TokenTypes.METHOD_DEF) {
- mKey = MSG_KEY_METHOD;
- }
- else {
- mKey = MSG_KEY_CTOR;
- }
+ logViolation(node, nodeName, mCurReturnCount);
+ }
+ }
+ }
+ }
- final DetailAST methodNameToken = methodDefNode
- .findFirstToken(TokenTypes.IDENT);
+ /**
+ * Reports violation to user based on the parameters given.
+ * @param node The node that the violation is on.
+ * @param nodeName The name given to the node.
+ * @param mCurReturnCount The return count violation amount.
+ */
+ private void logViolation(DetailAST node, String nodeName, int mCurReturnCount) {
+ if (node.getType() == TokenTypes.LAMBDA) {
+ // lambdas have no name
+ log(node, MSG_KEY_LAMBDA, mCurReturnCount, maxReturnCount);
+ }
+ else {
+ final DetailAST nodeNameToken = node
+ .findFirstToken(TokenTypes.IDENT);
+ final String mKey;
- log(methodNameToken, mKey,
- methodName, mCurReturnCount,
- maxReturnCount);
- }
+ if (node.getType() == TokenTypes.METHOD_DEF) {
+ mKey = MSG_KEY_METHOD;
+ }
+ else {
+ mKey = MSG_KEY_CTOR;
}
+
+ log(nodeNameToken, mKey,
+ nodeName, mCurReturnCount,
+ maxReturnCount);
}
}
/**
- * Gets the "return" statements count for given method/ctor and saves the
- * last "return" statement DetailAST node for given method/ctor body. Uses
+ * Gets the "return" statements count for given method/ctor/lambda and saves the
+ * last "return" statement DetailAST node for given method/ctor/lambda body. Uses
* an iterative algorithm.
* @param methodOpeningBrace
* a DetailAST node that points to the current method`s opening
@@ -275,22 +304,16 @@ private int getReturnCount(final DetailAST methodDefNode,
DetailAST curNode = methodOpeningBrace;
- while (curNode != null) {
+ // stop at closing brace
+ while (curNode.getType() != TokenTypes.RCURLY
+ || curNode.getParent() != methodOpeningBrace) {
- // before node visiting
- if (curNode.getType() == TokenTypes.RCURLY
- && curNode.getParent() == methodOpeningBrace) {
- // stop at closing brace
- break;
- }
- else {
- if (curNode.getType() == TokenTypes.LITERAL_RETURN
- && getDepth(methodDefNode, curNode) < minIgnoreReturnDepth
- && shouldEmptyReturnStatementBeCounted(curNode)
- && getLinesCount(methodOpeningBrace,
- curNode) > topLinesToIgnoreCount) {
- result++;
- }
+ if (curNode.getType() == TokenTypes.LITERAL_RETURN
+ && getDepth(methodDefNode, curNode) < minIgnoreReturnDepth
+ && shouldEmptyReturnStatementBeCounted(curNode)
+ && getLinesCount(methodOpeningBrace,
+ curNode) > topLinesToIgnoreCount) {
+ result++;
}
// before node leaving
@@ -300,11 +323,13 @@ && getLinesCount(methodOpeningBrace,
// skip nested methods (UI listeners, Runnable.run(), etc.)
if (type == TokenTypes.METHOD_DEF
// skip anonymous classes
- || type == TokenTypes.CLASS_DEF) {
+ || type == TokenTypes.CLASS_DEF
+ // skip lambdas which is like an anonymous class/method
+ || type == TokenTypes.LAMBDA) {
nextNode = curNode.getNextSibling();
}
- while ((curNode != null) && (nextNode == null)) {
+ while (nextNode == null) {
// leave the visited Node
nextNode = curNode.getNextSibling();
if (nextNode == null) {
@@ -371,12 +396,13 @@ private static int getDepth(DetailAST methodDefNode,
*/
private static String getMethodName(DetailAST methodDefNode) {
String result = null;
- for (DetailAST curNode : getChildren(methodDefNode)) {
- if (curNode.getType() == TokenTypes.IDENT) {
- result = curNode.getText();
- break;
- }
+ final DetailAST ident = methodDefNode.findFirstToken(TokenTypes.IDENT);
+
+ // lambdas don't have a name
+ if (ident != null && methodDefNode.getType() != TokenTypes.LAMBDA) {
+ result = ident.getText();
}
+
return result;
}
@@ -393,23 +419,6 @@ private static int getLinesCount(DetailAST beginAst, DetailAST endAST) {
return endAST.getLineNo() - beginAst.getLineNo();
}
- /**
- * Gets all the children which are one level below on the current DetailAST
- * parent node.
- * @param node
- * Current parent node.
- * @return The list of children one level below on the current parent node.
- */
- private static List getChildren(final DetailAST node) {
- final List result = new LinkedList<>();
- DetailAST curNode = node.getFirstChild();
- while (curNode != null) {
- result.add(curNode);
- curNode = curNode.getNextSibling();
- }
- return result;
- }
-
/**
* Matches string to given list of RegExp patterns.
*
@@ -420,10 +429,16 @@ private static List getChildren(final DetailAST node) {
* @return true if given string could be fully matched by one of given patterns, false otherwise
*/
private static boolean matches(String string, Collection patterns) {
+ String match = string;
+
+ if (match == null) {
+ match = "null";
+ }
+
boolean result = false;
if (!patterns.isEmpty()) {
for (String pattern : patterns) {
- if (string.matches(pattern)) {
+ if (match.matches(pattern)) {
result = true;
break;
}
diff --git a/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/coding/messages.properties b/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/coding/messages.properties
index 4fd9036d13..461aa8a18b 100644
--- a/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/coding/messages.properties
+++ b/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/coding/messages.properties
@@ -44,6 +44,7 @@ overridable.method.leads=Calling the method ''{0}'' in {1} body leads to the cal
redundant.return.check=Redundant return.
return.count.extended.method=Return count for ''{0}'' method is {1} (max allowed is {2}).
return.count.extended.ctor=Return count for ''{0}'' constructor is {1} (max allowed is {2}).
+return.count.extended.lambda=Return count for the lambda is {0} (max allowed is {1}).
single.break.or.continue.in.loops=Loops should not contain more than a single "break" or "continue" statement
ternary.per.expression.count=More than {0} ternary operators in expression.
unnecessary.paren.assign=Unnecessary parentheses around assignment right-hand side.
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnCountExtendedCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnCountExtendedCheckTest.java
index 89ac76c840..0ab78e1c74 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnCountExtendedCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnCountExtendedCheckTest.java
@@ -20,6 +20,7 @@
package com.github.sevntu.checkstyle.checks.coding;
import static com.github.sevntu.checkstyle.checks.coding.ReturnCountExtendedCheck.MSG_KEY_CTOR;
+import static com.github.sevntu.checkstyle.checks.coding.ReturnCountExtendedCheck.MSG_KEY_LAMBDA;
import static com.github.sevntu.checkstyle.checks.coding.ReturnCountExtendedCheck.MSG_KEY_METHOD;
import org.junit.Test;
@@ -31,6 +32,20 @@ public class ReturnCountExtendedCheckTest extends BaseCheckTestSupport {
private final DefaultConfiguration checkConfig = createCheckConfig(ReturnCountExtendedCheck.class);
+ @Test
+ public void testNullOnIgnoreMethodsNames() throws Exception {
+ checkConfig.addAttribute("maxReturnCount", "99");
+ checkConfig.addAttribute("ignoreMethodLinesCount", "99");
+ checkConfig.addAttribute("minIgnoreReturnDepth", "99");
+ checkConfig.addAttribute("ignoreEmptyReturns", "true");
+ checkConfig.addAttribute("topLinesToIgnoreCount", "99");
+ checkConfig.addAttribute("ignoreMethodsNames", null);
+
+ final String[] expected = {};
+
+ verify(checkConfig, getPath("InputReturnCountExtendedCheckMethods.java"), expected);
+ }
+
@Test
public void testMethodsMaxReturnLiteralsIsOne() throws Exception {
@@ -223,4 +238,39 @@ public void testRegexIgnoreMethodsNamesProperty() throws Exception {
verify(checkConfig, getPath("InputReturnCountExtendedCheckMethods.java"), expected);
}
+
+ @Test
+ public void testAnonymousClass() throws Exception {
+ checkConfig.addAttribute("maxReturnCount", "1");
+ checkConfig.addAttribute("ignoreMethodLinesCount", "0");
+ checkConfig.addAttribute("minIgnoreReturnDepth", "99");
+ checkConfig.addAttribute("ignoreEmptyReturns", "false");
+ checkConfig.addAttribute("topLinesToIgnoreCount", "0");
+
+ final String[] expected = {
+ "14:16: " + getCheckMessage(MSG_KEY_METHOD, "method2", 2, 1),
+ "16:24: " + getCheckMessage(MSG_KEY_METHOD, "method2", 2, 1),
+ };
+
+ verify(checkConfig, getPath("InputReturnCountExtendedCheckAnonymousClasses.java"), expected);
+ }
+
+ @Test
+ public void testLambda() throws Exception {
+ checkConfig.addAttribute("maxReturnCount", "1");
+ checkConfig.addAttribute("ignoreMethodLinesCount", "0");
+ checkConfig.addAttribute("minIgnoreReturnDepth", "99");
+ checkConfig.addAttribute("ignoreEmptyReturns", "false");
+ checkConfig.addAttribute("topLinesToIgnoreCount", "0");
+
+ final String[] expected = {
+ "12:55: " + getCheckMessage(MSG_KEY_LAMBDA, 2, 1),
+ "24:49: " + getCheckMessage(MSG_KEY_LAMBDA, 2, 1),
+ "31:42: " + getCheckMessage(MSG_KEY_LAMBDA, 3, 1),
+ "38:9: " + getCheckMessage(MSG_KEY_METHOD, "methodWithTwoReturnWithLambdas", 2, 1),
+ "46:57: " + getCheckMessage(MSG_KEY_LAMBDA, 2, 1),
+ };
+
+ verify(checkConfig, getPath("InputReturnCountExtendedCheckLambdas.java"), expected);
+ }
}
diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputReturnCountExtendedCheckAnonymousClasses.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputReturnCountExtendedCheckAnonymousClasses.java
new file mode 100644
index 0000000000..e60b766dec
--- /dev/null
+++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputReturnCountExtendedCheckAnonymousClasses.java
@@ -0,0 +1,29 @@
+package com.github.sevntu.checkstyle.checks.coding;
+
+public class InputReturnCountExtendedCheckAnonymousClasses {
+ public int method() {
+ class InnerClass {
+ public int method() {
+ return 1;
+ }
+ }
+
+ return 1;
+ }
+
+ public int method2() {
+ class InnerClass {
+ public int method2() {
+ if (false)
+ return 0;
+
+ return 1;
+ }
+ }
+
+ if (false)
+ return 0;
+
+ return 1;
+ }
+}
\ No newline at end of file
diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputReturnCountExtendedCheckLambdas.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputReturnCountExtendedCheckLambdas.java
new file mode 100644
index 0000000000..cdcc47e103
--- /dev/null
+++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputReturnCountExtendedCheckLambdas.java
@@ -0,0 +1,60 @@
+package com.github.sevntu.checkstyle.checks.coding;
+
+import java.util.Optional;
+import java.util.concurrent.Callable;
+import java.util.function.Supplier;
+
+public class InputReturnCountExtendedCheckLambdas {
+ Runnable fieldWithOneReturnInLambda = () -> {
+ return;
+ };
+
+ Callable fieldWithTwoReturnInLambda = () -> {
+ if (hashCode() == 0) return 0;
+ else return 1;
+ };
+
+ Optional methodWithOneReturnInLambda() {
+ return Optional.of(hashCode()).filter(i -> {
+ return i > 0;
+ });
+ }
+
+ Optional methodWithTwoReturnInLambda() {
+ return Optional.of(hashCode()).filter(i -> {
+ if (i > 0) return true;
+ else return false;
+ });
+ }
+
+ Optional
+
+
+ %MoveVariableInsideIfCheck.desc
+
+
+
+
diff --git a/sevntu-checks/sevntu-checks.xml b/sevntu-checks/sevntu-checks.xml
index ffaecf565c..031ceed9e7 100644
--- a/sevntu-checks/sevntu-checks.xml
+++ b/sevntu-checks/sevntu-checks.xml
@@ -154,6 +154,7 @@
+
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MoveVariableInsideIfCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MoveVariableInsideIfCheck.java
new file mode 100644
index 0000000000..127b6239cf
--- /dev/null
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MoveVariableInsideIfCheck.java
@@ -0,0 +1,356 @@
+////////////////////////////////////////////////////////////////////////////////
+// checkstyle: Checks Java source code for adherence to a set of rules.
+// Copyright (C) 2001-2017 the original author or authors.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+////////////////////////////////////////////////////////////////////////////////
+
+package com.github.sevntu.checkstyle.checks.coding;
+
+import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
+import com.puppycrawl.tools.checkstyle.api.DetailAST;
+import com.puppycrawl.tools.checkstyle.api.TokenTypes;
+import com.puppycrawl.tools.checkstyle.utils.ScopeUtils;
+
+/**
+ *
+ * Checks if a variable is only used inside if statements and asks for it's
+ * declaration to be moved there too.
+ *
+ *
+ * Rationale: Code inside if/else statements are only executed when those specific block
+ * conditions evaluate to true. Moving variables inside these blocks prevents the code from being
+ * executed when the value of the variable is not even being used. It also helps limit the scope
+ * of the variables from being too broad to confuse new readers. Suppressing variables with false
+ * violations because of the check's limitations (stated below) also help clearly state the
+ * purpose of the variable as a temporary storage for a current/future changing value.
+ *
+ *
+ * An example of how to configure the check is:
+ *
+ * Limitations: The check can not determine if the value of variable being stored is changed after
+ * the declaration. Variables like this can't be moved, or may be too complex to move, and thus
+ * should be suppressed.
+ *
+ *
+ * Case #1:
+ *
+ *
+ * final String variable = list.remove(0); // false positive - list is modified with storing value
+ * final String next = list.get(0); // expecting above list modification
+ *
+ * if (next.equals(input)) {
+ * list.add(variable);
+ * }
+ *
+ *
+ * Case #2:
+ *
+ *
+ * final String variable = field.get(0); // false positive - field is modified later, before block
+ *
+ * modifyField(); // field is modified inside this method
+ *
+ * if (condition) {
+ * field.add(variable);
+ * }
+ *
+ *
+ * @author Richard Veach
+ */
+public class MoveVariableInsideIfCheck extends AbstractCheck {
+ /**
+ * A key is pointing to the warning message text in "messages.properties"
+ * file.
+ */
+ public static final String MSG_KEY = "move.variable.inside";
+
+ @Override
+ public int[] getDefaultTokens() {
+ return new int[] {TokenTypes.VARIABLE_DEF};
+ }
+
+ @Override
+ public int[] getRequiredTokens() {
+ return getDefaultTokens();
+ }
+
+ @Override
+ public void visitToken(DetailAST ast) {
+ if (ScopeUtils.isLocalVariableDef(ast)) {
+ validateLocalVariable(ast);
+ }
+ }
+
+ /**
+ * Examines the local variable for violations to be moved inside an nest if
+ * statement.
+ *
+ * @param ast The local variable to examine.
+ */
+ private void validateLocalVariable(DetailAST ast) {
+ final Holder holder = new Holder(ast);
+
+ for (DetailAST child = ast.getNextSibling(); (!holder.exit) && (child != null);
+ child = child.getNextSibling()) {
+ switch (child.getType()) {
+ case TokenTypes.LITERAL_IF:
+ validateIf(holder, child);
+ break;
+ default:
+ validateOther(holder, child);
+ break;
+ }
+ }
+
+ if (holder.blockNode != null) {
+ log(ast, MSG_KEY, holder.variableName, holder.blockNode.getLineNo());
+ }
+ }
+
+ /**
+ * Examines an if statement to see how many times the specified variable
+ * identifier was used inside it.
+ *
+ * @param holder The object holder with the specified variable to check and
+ * it's current state.
+ * @param ifNodeGiven The current if node to examine.
+ */
+ private static void validateIf(Holder holder, DetailAST ifNodeGiven) {
+ DetailAST ifNode = ifNodeGiven;
+
+ // -@cs[SingleBreakOrContinue] Too complex to break apart
+ while (true) {
+ // check condition
+ final DetailAST rparen = ifNode.findFirstToken(TokenTypes.RPAREN);
+ final boolean usedInCondition = holder.hasIdent(
+ ifNode.findFirstToken(TokenTypes.LPAREN), rparen);
+
+ if (usedInCondition) {
+ holder.setExit();
+ break;
+ }
+
+ final DetailAST elseNode = ifNode.getLastChild();
+
+ // check body of if
+ final DetailAST body = rparen.getNextSibling();
+ final DetailAST bodyEnd;
+
+ if (body.getType() == TokenTypes.SLIST) {
+ bodyEnd = body.getLastChild();
+ }
+ else {
+ bodyEnd = elseNode;
+ }
+
+ final boolean used = holder.hasIdent(body, bodyEnd);
+
+ if (used) {
+ holder.setBlockNode(ifNode);
+
+ if (holder.exit) {
+ break;
+ }
+ }
+
+ if (elseNode.getType() != TokenTypes.LITERAL_ELSE) {
+ break;
+ }
+
+ ifNode = elseNode.getFirstChild();
+
+ if (ifNode.getType() != TokenTypes.LITERAL_IF) {
+ // check body of else
+
+ validateElseOfIf(holder, ifNode, elseNode);
+ break;
+ }
+ }
+ }
+
+ /**
+ * Examines the else of an if statement to see how many times the specified
+ * variable identifier was used inside it.
+ *
+ * @param holder The object holder with the specified variable to check and
+ * it's current state.
+ * @param ifNode The if node of the specified else.
+ * @param elseNode The current else node to examine.
+ */
+ private static void validateElseOfIf(Holder holder, DetailAST ifNode, DetailAST elseNode) {
+ final boolean used;
+
+ if (ifNode.getType() == TokenTypes.SLIST) {
+ used = holder.hasIdent(ifNode.getFirstChild(), ifNode.getLastChild());
+ }
+ else {
+ used = holder.hasIdent(ifNode, elseNode.getLastChild());
+ }
+
+ if (used) {
+ holder.setBlockNode(elseNode);
+ }
+ }
+
+ /**
+ * Examines other nodes to see how many times a variable was used inside it.
+ * If the variable is used, no violations are reported for it.
+ *
+ * @param holder The object holder with the specified variable to check and
+ * it's current state.
+ * @param child The current node to examine.
+ */
+ private static void validateOther(Holder holder, DetailAST child) {
+ final boolean used = holder.hasIdent(child, child.getNextSibling());
+
+ if (used) {
+ holder.setExit();
+ }
+ }
+
+ /**
+ * The holder of information for the specified variable.
+ *
+ * @author Richard Veach
+ */
+ private static class Holder {
+ /** The name of the variable being examined. */
+ private String variableName;
+ /** Switch to trigger ending examining more nodes. */
+ private boolean exit;
+ /** The node to report violations on. */
+ private DetailAST blockNode;
+
+ /**
+ * Default constructor for the class.
+ *
+ * @param ast The variable the holder is for.
+ */
+ Holder(DetailAST ast) {
+ variableName = ast.findFirstToken(TokenTypes.IDENT).getText();
+ }
+
+ /**
+ * Sets the specified node that is to be reported for the violation for
+ * the block. If there is already a node being reported, then no nodes
+ * are reported.
+ *
+ * @param blockNode The given block node to report for.
+ */
+ public void setBlockNode(DetailAST blockNode) {
+ if (this.blockNode != null) {
+ setExit();
+ }
+ else {
+ this.blockNode = blockNode;
+ }
+ }
+
+ /** Sets the state to exit examining further nodes. */
+ public void setExit() {
+ blockNode = null;
+ exit = true;
+ }
+
+ /**
+ * Checks if any of the nodes between the given start and end are an
+ * identifier with the name of the variable.
+ *
+ * @param start The node to start examining from.
+ * @param end The last node to stop examining once reached. If null,
+ * then the last node is when we leave the start node.
+ * @return true if the identifier has been found, otherwise false.
+ */
+ public boolean hasIdent(DetailAST start, DetailAST end) {
+ boolean found = false;
+ DetailAST curNode = start;
+
+ // -@cs[SingleBreakOrContinue] Too complex to break apart
+ while (curNode != null) {
+ if ((curNode.getType() == TokenTypes.IDENT)
+ && (variableName.equals(curNode.getText()))) {
+ found = true;
+ break;
+ }
+
+ if (curNode == end) {
+ break;
+ }
+
+ DetailAST toVisit = curNode.getFirstChild();
+
+ while (toVisit == null) {
+ toVisit = curNode.getNextSibling();
+
+ if (toVisit == null) {
+ if (end == null) {
+ break;
+ }
+
+ curNode = curNode.getParent();
+ }
+ }
+
+ curNode = toVisit;
+ }
+
+ return found;
+ }
+ }
+}
diff --git a/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/coding/messages.properties b/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/coding/messages.properties
index d10e19f6b5..afb68173ff 100644
--- a/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/coding/messages.properties
+++ b/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/coding/messages.properties
@@ -30,6 +30,7 @@ logic.condition.need.optimization=Condition with {0} at line {1} position {2} ne
map.iteration.entrySet=You are using both keys and values for this map. It is better to use entrySet() instead of keySet() + get().
map.iteration.keySet=It is better to use keySet() method to iterate over this map because you aren`t using values.
map.iteration.values=You are using only values of this map. It is better to use values() to iterate this map.
+move.variable.inside=Variable ''{0}'' can be moved inside the block at line ''{1}'' to restrict runtime creation.
multiple.string.literal=The String {0} appears {1} times in the file.
multiple.variable.declarations=Only one variable definition per line allowed.
multiple.variable.declarations.comma=Each variable declaration must be in its own statement.
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MoveVariableInsideIfCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MoveVariableInsideIfCheckTest.java
new file mode 100644
index 0000000000..2b04c09fb8
--- /dev/null
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MoveVariableInsideIfCheckTest.java
@@ -0,0 +1,62 @@
+////////////////////////////////////////////////////////////////////////////////
+// checkstyle: Checks Java source code for adherence to a set of rules.
+// Copyright (C) 2001-2017 the original author or authors.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+////////////////////////////////////////////////////////////////////////////////
+
+package com.github.sevntu.checkstyle.checks.coding;
+
+import static com.github.sevntu.checkstyle.checks.coding.MoveVariableInsideIfCheck.MSG_KEY;
+
+import org.junit.Test;
+
+import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
+import com.puppycrawl.tools.checkstyle.utils.CommonUtils;
+
+public class MoveVariableInsideIfCheckTest extends BaseCheckTestSupport {
+ @Test
+ public final void testNoViolations() throws Exception {
+ final DefaultConfiguration checkConfig = createCheckConfig(MoveVariableInsideIfCheck.class);
+ verify(checkConfig, getPath("InputMoveVariableInsideIfCheckNoViolations.java"),
+ CommonUtils.EMPTY_STRING_ARRAY);
+ }
+
+ @Test
+ public final void testViolations() throws Exception {
+ final DefaultConfiguration checkConfig = createCheckConfig(MoveVariableInsideIfCheck.class);
+ final String[] expected = {
+ "5:9: " + getCheckMessage(MSG_KEY, "variable", "7"),
+ "13:9: " + getCheckMessage(MSG_KEY, "variable", "15"),
+ "24:9: " + getCheckMessage(MSG_KEY, "variable", "26"),
+ "33:9: " + getCheckMessage(MSG_KEY, "variable", "38"),
+ "44:9: " + getCheckMessage(MSG_KEY, "variable", "48"),
+ };
+ verify(checkConfig, getPath("InputMoveVariableInsideIfCheckViolations.java"), expected);
+ }
+
+ @Test
+ public final void testFalsePositives() throws Exception {
+ final DefaultConfiguration checkConfig = createCheckConfig(MoveVariableInsideIfCheck.class);
+ final String[] expected = {
+ "9:9: " + getCheckMessage(MSG_KEY, "variable", "12"),
+ "18:9: " + getCheckMessage(MSG_KEY, "variable", "24"),
+ "30:9: " + getCheckMessage(MSG_KEY, "variable", "34"),
+ };
+ verify(checkConfig, getPath("InputMoveVariableInsideIfCheckFalsePositives.java"),
+ expected);
+ }
+}
diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMoveVariableInsideIfCheckFalsePositives.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMoveVariableInsideIfCheckFalsePositives.java
new file mode 100644
index 0000000000..6db2a845bb
--- /dev/null
+++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMoveVariableInsideIfCheckFalsePositives.java
@@ -0,0 +1,45 @@
+package com.github.sevntu.checkstyle.checks.coding;
+
+import java.util.List;
+
+public class InputMoveVariableInsideIfCheckFalsePositives {
+ private List field;
+
+ public void method1(List list) {
+ final String variable = list.remove(0);
+ final String next = list.get(0);
+
+ if (next.equals("test")) {
+ list.add(variable);
+ }
+ }
+
+ public void method2(List list) {
+ final String variable = list.remove(0);
+
+ if (true) {
+ test(list.get(0));
+ }
+
+ if (true) {
+ list.add(variable);
+ }
+ }
+
+ public void method3(List list) {
+ final String variable = field.get(0);
+
+ modifyField();
+
+ if (true) {
+ field.add(variable);
+ }
+ }
+
+ private void test(String string) {
+ }
+
+ private void modifyField() {
+ test(field.remove(0));
+ }
+}
diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMoveVariableInsideIfCheckNoViolations.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMoveVariableInsideIfCheckNoViolations.java
new file mode 100644
index 0000000000..592e8ecfc5
--- /dev/null
+++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMoveVariableInsideIfCheckNoViolations.java
@@ -0,0 +1,119 @@
+package com.github.sevntu.checkstyle.checks.coding;
+
+import java.io.BufferedReader;
+import java.io.FileReader;
+
+public class InputMoveVariableInsideIfCheckNoViolations {
+ String field = "";
+
+ public void method1() {
+ }
+
+ public void method2() {
+ String nothing = "";
+ }
+
+ public void method3() {
+ for (int i = 0; i < 5; i++) {
+ method1();
+
+ if (true) {
+ i++;
+ }
+ }
+
+ try (BufferedReader in = new BufferedReader(new FileReader("foo.in"))) {
+ method1();
+
+ if (true) {
+ in.readLine();
+ }
+ }
+ catch (Exception e) {
+ method1();
+
+ if (true) {
+ e.getCause();
+ }
+ }
+ }
+
+ public void method4() {
+ String variable = "";
+
+ variable = variable.substring(0);
+ }
+
+ public void method5() {
+ String variable = "";
+
+ variable = variable.substring(0);
+
+ if (true) {
+ variable = variable.substring(0);
+ }
+ }
+
+ public void method6() {
+ String variable = "";
+
+ if (variable.contains("a")) {
+ method1();
+ }
+ }
+
+ public void method7() {
+ String variable = "";
+
+ if (true) {
+ variable = variable.substring(0);
+ }
+ else {
+ variable = variable.substring(0);
+ }
+ }
+
+ public void method8() {
+ String variable = "";
+
+ if (true) {
+ method1();
+ }
+ else if (true) {
+ variable = variable.substring(0);
+ }
+ else {
+ variable = variable.substring(0);
+ }
+ }
+
+ public void method9() {
+ String variable = "";
+
+ if (true) {
+ variable = variable.substring(0);
+ }
+
+ if (true) {
+ variable = variable.substring(0);
+ }
+ }
+
+ public void method10() {
+ String variable = "";
+
+ for (int i = 0; i < 10; i++) {
+ variable = variable.substring(0);
+ }
+ }
+
+ public void method11() {
+ String variable = "";
+
+ for (int i = 0; i < 10; i++) {
+ if (true) {
+ variable = variable.substring(0);
+ }
+ }
+ }
+}
diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMoveVariableInsideIfCheckViolations.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMoveVariableInsideIfCheckViolations.java
new file mode 100644
index 0000000000..e909e5f0d5
--- /dev/null
+++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMoveVariableInsideIfCheckViolations.java
@@ -0,0 +1,51 @@
+package com.github.sevntu.checkstyle.checks.coding;
+
+public class InputMoveVariableInsideIfCheckViolations {
+ public void method1() {
+ String variable = "";
+
+ if (true) {
+ variable = variable.substring(0);
+ }
+ }
+
+ public void method2() {
+ String variable = "";
+
+ if (true) {
+ variable = variable.substring(0);
+ }
+ else {
+ method1();
+ }
+ }
+
+ public void method3() {
+ String variable = "";
+
+ if (true)
+ variable = variable.substring(0);
+ else
+ method1();
+ }
+
+ public void method4() {
+ String variable = "";
+
+ if (true) {
+ method1();
+ }
+ else {
+ variable = variable.substring(0);
+ }
+ }
+
+ public void method5() {
+ String variable = "";
+
+ if (true)
+ method1();
+ else
+ variable = variable.substring(0);
+ }
+}
diff --git a/sevntu-checkstyle-sonar-plugin/src/main/resources/com/github/sevntu/checkstyle/sonar/checkstyle-extensions.xml b/sevntu-checkstyle-sonar-plugin/src/main/resources/com/github/sevntu/checkstyle/sonar/checkstyle-extensions.xml
index 198c64c526..380ac27513 100644
--- a/sevntu-checkstyle-sonar-plugin/src/main/resources/com/github/sevntu/checkstyle/sonar/checkstyle-extensions.xml
+++ b/sevntu-checkstyle-sonar-plugin/src/main/resources/com/github/sevntu/checkstyle/sonar/checkstyle-extensions.xml
@@ -896,4 +896,12 @@
Check nested (internal) classes to be declared at the bottom of the class after all methods (fields) declaration.Checker/TreeWalker/com.github.sevntu.checkstyle.checks.design.InnerClassCheck
+
+
+ com.github.sevntu.checkstyle.checks.coding.MoveVariableInsideIfCheck
+ Move variable inside if check
+
+ Checks if a variable is only used inside if statements and asks for it's declaration to be moved there too.
+ Checker/TreeWalker/com.github.sevntu.checkstyle.checks.coding.MoveVariableInsideIfCheck
+
From 06a4dfcc53e13ea86f3365c4bdc15b96e555ac2a Mon Sep 17 00:00:00 2001
From: Roman Ivanov
Date: Wed, 24 May 2017 21:50:37 -0700
Subject: [PATCH 078/208] Issue #165: change groupId to
'com.github.sevntu-checkstyle'
---
eclipse-pom.xml | 2 +-
eclipsecs-sevntu-plugin-feature/pom.xml | 4 ++--
eclipsecs-sevntu-plugin/pom.xml | 8 ++++----
sevntu-checks/pom.xml | 6 +++---
sevntu-checkstyle-idea-extension/pom.xml | 8 ++++----
sevntu-checkstyle-maven-plugin/pom.xml | 6 +++---
sevntu-checkstyle-sonar-plugin/pom.xml | 4 ++--
update-site/pom.xml | 2 +-
8 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/eclipse-pom.xml b/eclipse-pom.xml
index aa10c7f818..747e5a0759 100644
--- a/eclipse-pom.xml
+++ b/eclipse-pom.xml
@@ -3,7 +3,7 @@
4.0.0
- com.github.sevntu.checkstyle
+ com.github.sevntu-checkstyleparent1.23.1pom
diff --git a/eclipsecs-sevntu-plugin-feature/pom.xml b/eclipsecs-sevntu-plugin-feature/pom.xml
index 45815f8fc7..6c9563ecf9 100644
--- a/eclipsecs-sevntu-plugin-feature/pom.xml
+++ b/eclipsecs-sevntu-plugin-feature/pom.xml
@@ -5,12 +5,12 @@
../eclipse-pom.xml
- com.github.sevntu.checkstyle
+ com.github.sevntu-checkstyleparent1.23.1
- com.github.sevntu.checkstyle
+ com.github.sevntu-checkstylecom.github.sevntu.checkstyle.checks.featureeclipse-featureExtension for eclipse-cs Plugin with additional Checks
diff --git a/eclipsecs-sevntu-plugin/pom.xml b/eclipsecs-sevntu-plugin/pom.xml
index 62ea11ec48..2f9b67ffd1 100644
--- a/eclipsecs-sevntu-plugin/pom.xml
+++ b/eclipsecs-sevntu-plugin/pom.xml
@@ -7,12 +7,12 @@
../eclipse-pom.xml
- com.github.sevntu.checkstyle
+ com.github.sevntu-checkstyleparent1.23.1
- com.github.sevntu.checkstyle
+ com.github.sevntu-checkstyleeclipsecs-sevntu-plugineclipse-plugin
@@ -31,7 +31,7 @@
- com.github.sevntu.checkstyle
+ com.github.sevntu-checkstylesevntu-checks${project.version}
@@ -85,7 +85,7 @@
- com.github.sevntu.checkstyle
+ com.github.sevntu-checkstylesevntu-checks${sevntu.checks.version}jar
diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml
index a23131c4e0..b1d8ebf661 100644
--- a/sevntu-checks/pom.xml
+++ b/sevntu-checks/pom.xml
@@ -2,7 +2,7 @@
4.0.0
- com.github.sevntu.checkstyle
+ com.github.sevntu-checkstylesevntu-checks1.23.1
@@ -70,7 +70,7 @@
- com.github.sevntu.checkstyle
+ com.github.sevntu-checkstylesevntu-checksfile://${basedir}/../gh-pages/maven2/
@@ -249,7 +249,7 @@
- com.github.sevntu.checkstyle
+ com.github.sevntu-checkstylesevntu-checks${project.version}
diff --git a/sevntu-checkstyle-idea-extension/pom.xml b/sevntu-checkstyle-idea-extension/pom.xml
index 0400d26599..21423a3694 100644
--- a/sevntu-checkstyle-idea-extension/pom.xml
+++ b/sevntu-checkstyle-idea-extension/pom.xml
@@ -3,7 +3,7 @@
4.0.0
- com.github.sevntu.checkstyle
+ com.github.sevntu-checkstylesevntu-checkstyle-idea-extension1.23.1jar
@@ -19,7 +19,7 @@
- com.github.sevntu.checkstyle
+ com.github.sevntu-checkstylesevntu-checks${project.version}
@@ -27,7 +27,7 @@
- com.github.sevntu.checkstyle
+ com.github.sevntu-checkstyleSevntu Checkstyle Idea extensionfile://${basedir}/../gh-pages/maven2/
@@ -54,7 +54,7 @@
- com.github.sevntu.checkstyle
+ com.github.sevntu-checkstylesevntu-checks${sevntu.checks.version}jar
diff --git a/sevntu-checkstyle-maven-plugin/pom.xml b/sevntu-checkstyle-maven-plugin/pom.xml
index fae4d0c7b1..d17a40c0d4 100644
--- a/sevntu-checkstyle-maven-plugin/pom.xml
+++ b/sevntu-checkstyle-maven-plugin/pom.xml
@@ -2,7 +2,7 @@
4.0.0
- com.github.sevntu.checkstyle
+ com.github.sevntu-checkstylesevntu-checkstyle-maven-pluginSevntu Checkstyle Maven Plugin1.23.1
@@ -16,7 +16,7 @@
- com.github.sevntu.checkstyle
+ com.github.sevntu-checkstylesevntu-checks1.23.1
@@ -29,7 +29,7 @@
- com.github.sevntu.checkstyle
+ com.github.sevntu-checkstyleSevntu Checkstyle Maven Pluginfile://${basedir}/../gh-pages/maven2/
diff --git a/sevntu-checkstyle-sonar-plugin/pom.xml b/sevntu-checkstyle-sonar-plugin/pom.xml
index 96e14fd32d..6f6cc7f21b 100644
--- a/sevntu-checkstyle-sonar-plugin/pom.xml
+++ b/sevntu-checkstyle-sonar-plugin/pom.xml
@@ -2,7 +2,7 @@
4.0.0
- com.github.sevntu.checkstyle
+ com.github.sevntu-checkstylesevntu-checkstyle-sonar-plugin1.23.1sonar-plugin
@@ -31,7 +31,7 @@
- com.github.sevntu.checkstyle
+ com.github.sevntu-checkstylesevntu-checks${project.version}
diff --git a/update-site/pom.xml b/update-site/pom.xml
index b1fccd34ba..8ceb8b9b08 100644
--- a/update-site/pom.xml
+++ b/update-site/pom.xml
@@ -5,7 +5,7 @@
../eclipse-pom.xml
- com.github.sevntu.checkstyle
+ com.github.sevntu-checkstyleparent1.23.1
From cf1ac7753a444edf6a667f82f17d1c20649269bb Mon Sep 17 00:00:00 2001
From: Roman Ivanov
Date: Thu, 25 May 2017 05:31:45 -0700
Subject: [PATCH 079/208] Issue #165: add sonatype parent
---
sevntu-checks/pom.xml | 7 +++++++
sevntu-checkstyle-idea-extension/pom.xml | 6 ++++++
sevntu-checkstyle-maven-plugin/pom.xml | 7 +++++++
sevntu-checkstyle-sonar-plugin/pom.xml | 7 +++++++
4 files changed, 27 insertions(+)
diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml
index b1d8ebf661..ef990625fd 100644
--- a/sevntu-checks/pom.xml
+++ b/sevntu-checks/pom.xml
@@ -2,6 +2,13 @@
4.0.0
+
+
+ org.sonatype.oss
+ oss-parent
+ 9
+
+
com.github.sevntu-checkstylesevntu-checks1.23.1
diff --git a/sevntu-checkstyle-idea-extension/pom.xml b/sevntu-checkstyle-idea-extension/pom.xml
index 21423a3694..3abe95397f 100644
--- a/sevntu-checkstyle-idea-extension/pom.xml
+++ b/sevntu-checkstyle-idea-extension/pom.xml
@@ -3,6 +3,12 @@
4.0.0
+
+ org.sonatype.oss
+ oss-parent
+ 9
+
+
com.github.sevntu-checkstylesevntu-checkstyle-idea-extension1.23.1
diff --git a/sevntu-checkstyle-maven-plugin/pom.xml b/sevntu-checkstyle-maven-plugin/pom.xml
index d17a40c0d4..f16abb62cb 100644
--- a/sevntu-checkstyle-maven-plugin/pom.xml
+++ b/sevntu-checkstyle-maven-plugin/pom.xml
@@ -2,6 +2,13 @@
4.0.0
+
+
+ org.sonatype.oss
+ oss-parent
+ 9
+
+
com.github.sevntu-checkstylesevntu-checkstyle-maven-pluginSevntu Checkstyle Maven Plugin
diff --git a/sevntu-checkstyle-sonar-plugin/pom.xml b/sevntu-checkstyle-sonar-plugin/pom.xml
index 6f6cc7f21b..b20a4831c2 100644
--- a/sevntu-checkstyle-sonar-plugin/pom.xml
+++ b/sevntu-checkstyle-sonar-plugin/pom.xml
@@ -2,6 +2,13 @@
4.0.0
+
+
+ org.sonatype.oss
+ oss-parent
+ 9
+
+
com.github.sevntu-checkstylesevntu-checkstyle-sonar-plugin1.23.1
From 06a81804651f4b85f228d5bfde0f0f18c1e72f40 Mon Sep 17 00:00:00 2001
From: Roman Ivanov
Date: Thu, 25 May 2017 06:09:09 -0700
Subject: [PATCH 080/208] Issue #165: generate javadoc and source jars for all
non-eclipse artifacts
---
sevntu-checks/pom.xml | 31 +++++++++++++++++++++
sevntu-checkstyle-idea-extension/pom.xml | 30 +++++++++++++++++++++
sevntu-checkstyle-maven-plugin/pom.xml | 34 ++++++++++++++++++++++++
sevntu-checkstyle-sonar-plugin/pom.xml | 30 +++++++++++++++++++++
4 files changed, 125 insertions(+)
diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml
index ef990625fd..c718204e41 100644
--- a/sevntu-checks/pom.xml
+++ b/sevntu-checks/pom.xml
@@ -94,6 +94,37 @@
1.8
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ 2.2.1
+
+
+ attach-sources
+ package
+
+ jar
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 2.10.4
+
+
+ attach-javadocs
+ package
+
+ jar
+
+
+
+
+
org.apache.maven.pluginsmaven-surefire-plugin
diff --git a/sevntu-checkstyle-idea-extension/pom.xml b/sevntu-checkstyle-idea-extension/pom.xml
index 3abe95397f..20545e25c3 100644
--- a/sevntu-checkstyle-idea-extension/pom.xml
+++ b/sevntu-checkstyle-idea-extension/pom.xml
@@ -46,6 +46,36 @@
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ 2.2.1
+
+
+ attach-sources
+ package
+
+ jar
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 2.10.4
+
+
+ attach-javadocs
+ package
+
+ jar
+
+
+
+
+
org.apache.maven.pluginsmaven-dependency-plugin
diff --git a/sevntu-checkstyle-maven-plugin/pom.xml b/sevntu-checkstyle-maven-plugin/pom.xml
index f16abb62cb..e70c0c4d19 100644
--- a/sevntu-checkstyle-maven-plugin/pom.xml
+++ b/sevntu-checkstyle-maven-plugin/pom.xml
@@ -42,4 +42,38 @@
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ 2.2.1
+
+
+ attach-sources
+ package
+
+ jar
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 2.10.4
+
+
+ attach-javadocs
+ package
+
+ jar
+
+
+
+
+
+
+
diff --git a/sevntu-checkstyle-sonar-plugin/pom.xml b/sevntu-checkstyle-sonar-plugin/pom.xml
index b20a4831c2..f03e12b218 100644
--- a/sevntu-checkstyle-sonar-plugin/pom.xml
+++ b/sevntu-checkstyle-sonar-plugin/pom.xml
@@ -52,6 +52,36 @@
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ 2.2.1
+
+
+ attach-sources
+ package
+
+ jar
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 2.10.4
+
+
+ attach-javadocs
+ package
+
+ jar
+
+
+
+
+
org.codehaus.mojoxml-maven-plugin
From be4604648c91b8e7b878c17c8611a6aec4db5e4f Mon Sep 17 00:00:00 2001
From: Roman Ivanov
Date: Thu, 25 May 2017 06:19:06 -0700
Subject: [PATCH 081/208] Issue #165: add nexus-staging-maven-plugin with
autoReleaseAfterClose=false
---
sevntu-checks/pom.xml | 17 ++++++++++-
sevntu-checkstyle-idea-extension/pom.xml | 25 ++++++++++++---
sevntu-checkstyle-maven-plugin/pom.xml | 22 +++++++++++--
sevntu-checkstyle-sonar-plugin/pom.xml | 39 ++++++++++++++++--------
4 files changed, 82 insertions(+), 21 deletions(-)
diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml
index c718204e41..c1e34ffc99 100644
--- a/sevntu-checks/pom.xml
+++ b/sevntu-checks/pom.xml
@@ -123,7 +123,22 @@
-
+
+
+
+ org.sonatype.plugins
+ nexus-staging-maven-plugin
+ 1.6.8
+ true
+
+
+ sonatype-nexus-staging
+ https://oss.sonatype.org/
+ false
+
+ org.apache.maven.plugins
diff --git a/sevntu-checkstyle-idea-extension/pom.xml b/sevntu-checkstyle-idea-extension/pom.xml
index 20545e25c3..e5ca551494 100644
--- a/sevntu-checkstyle-idea-extension/pom.xml
+++ b/sevntu-checkstyle-idea-extension/pom.xml
@@ -63,8 +63,8 @@
org.apache.maven.plugins
- maven-javadoc-plugin
- 2.10.4
+ maven-javadoc-plugin
+ 2.10.4attach-javadocs
@@ -72,9 +72,24 @@
jar
-
-
-
+
+
+
+
+
+ org.sonatype.plugins
+ nexus-staging-maven-plugin
+ 1.6.8
+ true
+
+
+ sonatype-nexus-staging
+ https://oss.sonatype.org/
+ false
+
+ org.apache.maven.plugins
diff --git a/sevntu-checkstyle-maven-plugin/pom.xml b/sevntu-checkstyle-maven-plugin/pom.xml
index e70c0c4d19..6c6e06825b 100644
--- a/sevntu-checkstyle-maven-plugin/pom.xml
+++ b/sevntu-checkstyle-maven-plugin/pom.xml
@@ -70,9 +70,25 @@
jar
-
-
-
+
+
+
+
+
+ org.sonatype.plugins
+ nexus-staging-maven-plugin
+ 1.6.8
+ true
+
+
+ sonatype-nexus-staging
+ https://oss.sonatype.org/
+ false
+
+
+
diff --git a/sevntu-checkstyle-sonar-plugin/pom.xml b/sevntu-checkstyle-sonar-plugin/pom.xml
index f03e12b218..75ac4c8351 100644
--- a/sevntu-checkstyle-sonar-plugin/pom.xml
+++ b/sevntu-checkstyle-sonar-plugin/pom.xml
@@ -69,18 +69,33 @@
org.apache.maven.plugins
- maven-javadoc-plugin
- 2.10.4
-
-
- attach-javadocs
- package
-
- jar
-
-
-
-
+ maven-javadoc-plugin
+ 2.10.4
+
+
+ attach-javadocs
+ package
+
+ jar
+
+
+
+
+
+
+ org.sonatype.plugins
+ nexus-staging-maven-plugin
+ 1.6.8
+ true
+
+
+ sonatype-nexus-staging
+ https://oss.sonatype.org/
+ false
+
+ org.codehaus.mojo
From 1c8def1ee80eb66720dd64e022fa7315b1e89b77 Mon Sep 17 00:00:00 2001
From: Roman Ivanov
Date: Thu, 25 May 2017 06:33:04 -0700
Subject: [PATCH 082/208] Issue #165: fix for build by skipStaging=true
---
sevntu-checks/pom.xml | 1 +
sevntu-checkstyle-idea-extension/pom.xml | 1 +
sevntu-checkstyle-maven-plugin/pom.xml | 1 +
sevntu-checkstyle-sonar-plugin/pom.xml | 1 +
4 files changed, 4 insertions(+)
diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml
index c1e34ffc99..09bc772384 100644
--- a/sevntu-checks/pom.xml
+++ b/sevntu-checks/pom.xml
@@ -137,6 +137,7 @@
sonatype-nexus-staginghttps://oss.sonatype.org/false
+ true
diff --git a/sevntu-checkstyle-idea-extension/pom.xml b/sevntu-checkstyle-idea-extension/pom.xml
index e5ca551494..e14e08b988 100644
--- a/sevntu-checkstyle-idea-extension/pom.xml
+++ b/sevntu-checkstyle-idea-extension/pom.xml
@@ -88,6 +88,7 @@
sonatype-nexus-staginghttps://oss.sonatype.org/false
+ true
diff --git a/sevntu-checkstyle-maven-plugin/pom.xml b/sevntu-checkstyle-maven-plugin/pom.xml
index 6c6e06825b..0f2859005d 100644
--- a/sevntu-checkstyle-maven-plugin/pom.xml
+++ b/sevntu-checkstyle-maven-plugin/pom.xml
@@ -86,6 +86,7 @@
sonatype-nexus-staginghttps://oss.sonatype.org/false
+ true
diff --git a/sevntu-checkstyle-sonar-plugin/pom.xml b/sevntu-checkstyle-sonar-plugin/pom.xml
index 75ac4c8351..fabbc2b576 100644
--- a/sevntu-checkstyle-sonar-plugin/pom.xml
+++ b/sevntu-checkstyle-sonar-plugin/pom.xml
@@ -94,6 +94,7 @@
sonatype-nexus-staginghttps://oss.sonatype.org/false
+ true
From 68df71aff236404f56a13f2a74fde3fff22a2057 Mon Sep 17 00:00:00 2001
From: rnveach
Date: Fri, 12 May 2017 16:37:58 -0400
Subject: [PATCH 083/208] Issue #448: rewrote EnumValueNameCheck to follow
naming check pattern
---
.../naming/checkstyle-metadata.properties | 6 +-
.../checks/naming/checkstyle-metadata.xml | 13 +-
.../checks/naming/EnumValueNameCheck.java | 255 ++----------------
.../checks/naming/messages.properties | 2 -
.../checks/naming/EnumValueNameCheckTest.java | 181 ++-----------
.../sonar/checkstyle-extensions.xml | 14 +-
6 files changed, 55 insertions(+), 416 deletions(-)
diff --git a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/naming/checkstyle-metadata.properties b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/naming/checkstyle-metadata.properties
index 82007098cb..ea8d1349b9 100644
--- a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/naming/checkstyle-metadata.properties
+++ b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/naming/checkstyle-metadata.properties
@@ -3,10 +3,8 @@ InterfaceTypeParameterNameCheck.desc = Checks that interface type parameter name
InterfaceTypeParameterNameCheck.format = Regex that interface type parameter names must to conform
EnumValueNameCheck.name = Enum values name
-EnumValueNameCheck.desc =
Check forces enum values to match the specific pattern. According to "Java Coding Style" by Achut Reddy p 3.3 constants include "all static final object reference types that are never followed by " ." (dot).", i.e. enums, which are followed by dot while used in the code are to be treated as static object references, while enums, that are not used with following dot, should be treated as constants.
Enums are defined to be used as class have some own methods. This condition is used to distinguish between Values Enumeration and Class Enumeration. Values Enumeration looks like the following:
Name format for Class Enumeration is specified with setObjFormat(String) , while format for enum constants - with setConstFormat(String)
To avoid assuming enum as static object reference, while using some specific methods, setExcludes(List) can be used. For example to make enum in the previous example a constant set Excludes property to a value toString
By default toString is used as an exclusion.
-EnumValueNameCheck.constFormat = Regex for Values Enumeration names to conform
-EnumValueNameCheck.objFormat = Regex for Class Enumeration names to conform
-EnumValueNameCheck.excludes = Exclude method and field names regexp list (comma-separated)
+EnumValueNameCheck.desc = Checks that enumeration value names conform to a format specified by the format property.
+EnumValueNameCheck.format = Regex for enumeration value names to conform
UniformEnumConstantNameCheck.name = Enum values name
UniformEnumConstantNameCheck.desc = Check forces enum values to match one of the specified patterns and forces all the values to follow only one of the specified patterns.
diff --git a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/naming/checkstyle-metadata.xml b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/naming/checkstyle-metadata.xml
index 7cfc921795..acb07027ae 100644
--- a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/naming/checkstyle-metadata.xml
+++ b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/naming/checkstyle-metadata.xml
@@ -20,18 +20,11 @@
%EnumValueNameCheck.desc
-
- %EnumValueNameCheck.constFormat
-
-
- %EnumValueNameCheck.objFormat
-
-
- %EnumValueNameCheck.excludes
+
+ %EnumValueNameCheck.format
-
-
+
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/naming/EnumValueNameCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/naming/EnumValueNameCheck.java
index 05d3554465..8427b177c2 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/naming/EnumValueNameCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/naming/EnumValueNameCheck.java
@@ -19,258 +19,61 @@
package com.github.sevntu.checkstyle.checks.naming;
-import java.util.Collection;
-import java.util.List;
-import java.util.regex.Pattern;
-
-import com.google.common.collect.Lists;
-import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
+import com.puppycrawl.tools.checkstyle.checks.naming.AbstractNameCheck;
/**
- * Check forces enum values to match the specific pattern. According to
- * "Java Coding Style" by Achut Reddy p 3.3 constants include
- * "all static final object reference types that are never followed by "
- * ." (dot).", i.e. enums, which are followed by dot while used in the code are
- * to be treated as static object references, while enums, that are not used
- * with following dot, should be treated as constants.
- *
- * Enums are defined to be used as class have some own methods. This condition
- * is used to distinguish between Values Enumeration and Class Enumeration.
- * Values Enumeration looks like the following:
- * enum SimpleErrorEnum
- * {
- * FIRST_SIMPLE, SECOND_SIMPLE, THIRD_SIMPLE;
- * }
- *
- *
- * While Class Enumeration has some methods, for example:
- * enum SimpleErrorEnum
- * {
- * FIRST_SIMPLE, SECOND_SIMPLE, THIRD_SIMPLE;
- *
- * public String toString() {
- * return Integer.toString(ordinal() + 10);
- * }
- * }
- *
*
- * Name format for Class Enumeration values is specified with
- * {@link #setObjFormat(String)} , while format for enum constants - with
- * {@link #setConstFormat(String)}
+ * Checks that enumeration value names conform to a format specified
+ * by the format property. The format is a
+ * {@link java.util.regex.Pattern regular expression} and defaults to
+ * ^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$.
+ *
*
- * To avoid assuming enum as static object reference, while using some specific
- * methods, {@link #setExcludes(String[])} can be used. For example to make enum in
- * the previous example a constant set Excludes property to a value
- * toString
+ * An example of how to configure the check is:
+ *
+ *
+ * <module name="EnumValueName"/>
+ *
*
- * By default toString is used as an exclusion.
+ * An example of how to configure the check for names that requires all names to be lowercase
+ * with underscores and digits is:
+ *
- * Return true, if inner class contain override method readObject() and
- * writeObject();
- *
+ * Return {@code true}, if inner class contain override method {@code readObject()} and
+ * {@code writeObject()}.
+ *
* @param classNode
* the start node of class definition.
* @return The boolean value. True, if method was override.
@@ -198,9 +197,8 @@ private static boolean hasCorrectParameter(DetailAST methodNode,
}
/**
- *
- * Return true, if class implement Serializable interface;
- *
+ * Return {@code true}, if class implement Serializable interface.
+ *
* @param classDefNode
* - the start node for class definition.
* @return boolean value. True, if class implements Serializable interface.
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheck.java
index be6de0c161..85900008de 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheck.java
@@ -416,7 +416,7 @@ public void leaveToken(DetailAST ast) {
/**
* Parse input current declaration rule and create new instance of
- * FormatMather with matcher
+ * FormatMather with matcher.
*
* @param currentState input string with MemberDefinition and RegExp.
* @return new FormatMatcher with parsed and compile rule
@@ -969,9 +969,8 @@ private static String getNameOfSuperClassUpdatedField(DetailAST methodCallAst) {
}
/**
- *
- * Gets name of the field, that was used in calling setter from a super class
- *
+ * Gets name of the field, that was used in calling setter from a super class.
+ *
* @param methodCallDotAst The token to examine.
* @return
* name of field in method parameter.
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EitherLogOrThrowCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EitherLogOrThrowCheck.java
index 29fbfa86f6..aba3af25fa 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EitherLogOrThrowCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EitherLogOrThrowCheck.java
@@ -256,6 +256,7 @@ && isLoggerVariableDefinition(ast)) {
}
/**
+ * Checks if AST object is logger import.
* @param importAst
* DetailAST of import statement.
* @return true if import equals logger full class name.
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/FinalizeImplementationCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/FinalizeImplementationCheck.java
index 147a876c39..2db3962cd5 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/FinalizeImplementationCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/FinalizeImplementationCheck.java
@@ -24,6 +24,7 @@
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
/**
+ * Validates finalize method implementation.
*
* This Check detects 3 most common cases of incorrect finalize() method implementation:
*
* This check prevents any calls to overridable methods that are take place in:
*
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UselessSingleCatchCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UselessSingleCatchCheck.java
index 6e1c16e95d..9895d11061 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UselessSingleCatchCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UselessSingleCatchCheck.java
@@ -88,7 +88,7 @@ && isSimpleRethrow(firstStatementNode)) {
/**
* Determines whether throw node is of form
- * throw exceptionObject;
+ * throw exceptionObject;.
* @param throwNode
* node of type TokenTypes.LITERAL_THROW
* @return wheather this throw node is of specified form
@@ -101,7 +101,7 @@ private static boolean isSimpleRethrow(DetailAST throwNode) {
}
/**
- * Gets catch parameter name
+ * Gets catch parameter name.
* @param catchNode
* node of type TokenTypes.LITERAL_CATCH
* @return catch parameter name
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UselessSuperCtorCallCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UselessSuperCtorCallCheck.java
index 8cf17e4372..4f2ff5f3e9 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UselessSuperCtorCallCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UselessSuperCtorCallCheck.java
@@ -279,7 +279,7 @@ private static int getClassPublicCtorCount(DetailAST aClassDefNode) {
}
/**
- * Checks whether given ctor is public
+ * Checks whether given ctor is public.
* @param aCtorDefNode
* a ctor definition node(TokenTypes.CTOR_DEF)
* @return true, if given ctor is public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/AvoidConditionInversionCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/AvoidConditionInversionCheck.java
index a03a0c0575..15c25f22e7 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/AvoidConditionInversionCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/AvoidConditionInversionCheck.java
@@ -118,7 +118,7 @@ public class AvoidConditionInversionCheck extends AbstractCheck {
/**
* If true - Check only puts violation on conditions with
*
- * relational operands
+ * relational operands.
*/
private boolean applyOnlyToRelationalOperands;
@@ -200,7 +200,7 @@ public void visitToken(DetailAST ast) {
}
/**
- * Checks if return statement is not empty
+ * Checks if return statement is not empty.
* @param returnAst
* Node of type
* {@link com.puppycrawl.tools.checkstyle.api.TokenTypes#LITERAL_RETURN}
@@ -212,7 +212,7 @@ private static boolean isEmptyReturn(DetailAST returnAst) {
}
/**
- * Checks if condition in for-loop is not empty
+ * Checks if condition in for-loop is not empty.
* @param forConditionAst
* Node of type {@link com.puppycrawl.tools.checkstyle.api.TokenTypes#FOR_CONDITION}
* @return true if the for condition is empty.
@@ -223,7 +223,7 @@ private static boolean isEmptyForCondition(DetailAST forConditionAst) {
}
/**
- * Gets inversion node of condition if one exists
+ * Gets inversion node of condition if one exists.
* @param expressionAst
* Node of type {@link com.puppycrawl.tools.checkstyle.api.TokenTypes#EXPR}
* @return Node of type {@link com.puppycrawl.tools.checkstyle.api.TokenTypes#LNOT}
@@ -235,7 +235,7 @@ private static DetailAST getInversion(DetailAST expressionAst) {
}
/**
- * Checks if current inversion is avoidable according to Check's properties
+ * Checks if current inversion is avoidable according to Check's properties.
* @param inversionAst
* Node of type {@link com.puppycrawl.tools.checkstyle.api.TokenTypes#LNOT}
* @return true if the inversion is avoidable.
@@ -247,7 +247,7 @@ private boolean isAvoidableInversion(DetailAST inversionAst) {
/**
* Checks if current inverted condition has to be skipped by Check,
- * it depends from user-defined property "applyOnlyToRelationalOperands"
+ * it depends from user-defined property "applyOnlyToRelationalOperands".
* if it's true - Check will ignore inverted conditions with
* non-relational operands
* @param inversionConditionAst
@@ -264,7 +264,7 @@ private boolean isSkipCondition(DetailAST inversionConditionAst) {
/**
* Checks if current inverted condition contains only
*
- * relational operands
+ * relational operands.
* @param inversionConditionAst
* Node of type {@link com.puppycrawl.tools.checkstyle.api.TokenTypes#LNOT}
* @return true if the node contains only relation operands.
@@ -301,7 +301,7 @@ private static boolean containsRelationalOperandsOnly(DetailAST inversionConditi
/**
* Checks if current operand is
*
- * relational operand
+ * relational operand.
* @param operandAst
* Child node of {@link com.puppycrawl.tools.checkstyle.api.TokenTypes#LNOT} node
* @return true if the operand is relational.
@@ -315,7 +315,7 @@ private static boolean isRelationalOperand(DetailAST operandAst) {
/**
* Checks if current condition contains
*
- * conditional operators
+ * conditional operators.
* @param inversionAst
* Node of type {@link com.puppycrawl.tools.checkstyle.api.TokenTypes#LNOT}
* @return true if the node contains conditional or relational operands.
@@ -340,7 +340,7 @@ private static boolean containsConditionalOrRelationalOperands(DetailAST inversi
}
/**
- * Logs message on line where inverted condition is used
+ * Logs message on line where inverted condition is used.
* @param inversionAst
* Node of type {@link com.puppycrawl.tools.checkstyle.api.TokenTypes#LNOT}
*/
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/HideUtilityClassConstructorCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/HideUtilityClassConstructorCheck.java
index 9d997da0b0..c5b6f4df14 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/HideUtilityClassConstructorCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/HideUtilityClassConstructorCheck.java
@@ -125,6 +125,7 @@ public void visitToken(DetailAST ast) {
}
/**
+ * Test is AST object has abstract modifier.
* @param ast class definition for check.
* @return true if a given class declared as abstract.
*/
@@ -136,6 +137,7 @@ private static boolean isAbstract(DetailAST ast) {
}
/**
+ * Test is AST object has static modifier.
* @param ast class definition for check.
* @return true if a given class declared as static.
*/
From 54a4978bfeda47513ca81664955ef20275234d10 Mon Sep 17 00:00:00 2001
From: Roman Ivanov
Date: Fri, 28 Jul 2017 19:45:51 -0700
Subject: [PATCH 110/208] config: add no-validations profile to ease only
checkstyle testing
---
sevntu-checks/pom.xml | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml
index 980685aa1a..7dd0ae3cd5 100644
--- a/sevntu-checks/pom.xml
+++ b/sevntu-checks/pom.xml
@@ -270,6 +270,21 @@
+
+ no-validations
+
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+
+ selftesting
From 8d5d9fbcc896272398c35e15722e92b8d742cc5d Mon Sep 17 00:00:00 2001
From: Roman Ivanov
Date: Mon, 21 Aug 2017 19:11:44 -0700
Subject: [PATCH 111/208] config: minor update for supprssions to pass
checkstyle/checkstyle#4982
---
sevntu-checks/suppressions.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/sevntu-checks/suppressions.xml b/sevntu-checks/suppressions.xml
index 29a7191515..8c00a58274 100644
--- a/sevntu-checks/suppressions.xml
+++ b/sevntu-checks/suppressions.xml
@@ -21,6 +21,7 @@
+
From 81b68cc706cba5941c3e1313b55301cfa206d1e1 Mon Sep 17 00:00:00 2001
From: Roman Ivanov
Date: Thu, 31 Aug 2017 05:53:23 -0700
Subject: [PATCH 112/208] config: bump checkstyle version
---
sevntu-checks/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml
index 7dd0ae3cd5..4632d41698 100644
--- a/sevntu-checks/pom.xml
+++ b/sevntu-checks/pom.xml
@@ -16,7 +16,7 @@
iso-8859-1
- 8.1
+ 8.2https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.version}/config/checkstyle_checks.xml7.6
From 92dfe390f38e7876b8efe6eb13c70a8de84ff589 Mon Sep 17 00:00:00 2001
From: Roman Ivanov
Date: Thu, 31 Aug 2017 06:01:49 -0700
Subject: [PATCH 113/208] config: removal of FileContentsHolder
---
sevntu-checks/sevntu-checks.xml | 3 ---
1 file changed, 3 deletions(-)
diff --git a/sevntu-checks/sevntu-checks.xml b/sevntu-checks/sevntu-checks.xml
index 8eee769330..96c0955519 100644
--- a/sevntu-checks/sevntu-checks.xml
+++ b/sevntu-checks/sevntu-checks.xml
@@ -19,9 +19,6 @@
-
-
-
From fea8bc984d6d35000d2b67365d6e3568d15f76fe Mon Sep 17 00:00:00 2001
From: Roman Ivanov
Date: Wed, 20 Sep 2017 14:39:35 -0700
Subject: [PATCH 114/208] minor: put link to repository for eclipse-cs
artifacts
---
README.textile | 1 +
1 file changed, 1 insertion(+)
diff --git a/README.textile b/README.textile
index 39d2597bb3..b089b0cdb4 100644
--- a/README.textile
+++ b/README.textile
@@ -4,6 +4,7 @@ sevntu-checks: !https://maven-badges.herokuapp.com/maven-central/com.github.sevn
sevntu-checkstyle-idea-extension:!https://maven-badges.herokuapp.com/maven-central/com.github.sevntu-checkstyle/sevntu-checkstyle-idea-extension/badge.svg!:https://search.maven.org/#search|gav|1|g%3A%22com.github.sevntu-checkstyle%22%20AND%20a%3A%22sevntu-checkstyle-idea-extension%22
sevntu-checkstyle-maven-plugin:!https://maven-badges.herokuapp.com/maven-central/com.github.sevntu-checkstyle/sevntu-checkstyle-maven-plugin/badge.svg!:https://search.maven.org/#search|gav|1|g%3A%22com.github.sevntu-checkstyle%22%20AND%20a%3A%22sevntu-checkstyle-maven-plugin%22
sevntu-checkstyle-sonar-plugin:!https://maven-badges.herokuapp.com/maven-central/com.github.sevntu-checkstyle/sevntu-checkstyle-sonar-plugin/badge.svg!:https://search.maven.org/#search|gav|1|g%3A%22com.github.sevntu-checkstyle%22%20AND%20a%3A%22sevntu-checkstyle-sonar-plugin%22
+eclipsecs-sevntu-plugin: "all versions":https://github.com/sevntu-checkstyle/sevntu.checkstyle/tree/gh-pages/update-site/plugins
Additional(non-standard) checks for Checkstyle that are compiled as:
From 48f1555e8a110bc8665ed400a993583d09ec1105 Mon Sep 17 00:00:00 2001
From: rnveach
Date: Tue, 26 Sep 2017 10:03:12 -0400
Subject: [PATCH 115/208] Issue #525: removed line length suppression and fixed
violations
---
...antAsFirstOperandInConditionCheckTest.java | 18 ++++---
...ltSerializableInInnerClassesCheckTest.java | 24 ++++++---
.../AvoidHidingCauseExceptionCheckTest.java | 9 ++--
.../AvoidModifiersForTypesCheckTest.java | 15 ++++--
...rtCircuitOperatorsForBooleanCheckTest.java | 6 ++-
.../CustomDeclarationOrderCheckTest.java | 54 +++++++++++++------
...peratorForVariableDefinitionCheckTest.java | 3 +-
.../EmptyPublicCtorInClassCheckTest.java | 6 ++-
.../ForbidCCommentsInMethodsCheckTest.java | 9 ++--
.../coding/ForbidCertainImportsCheckTest.java | 43 ++++++++++-----
.../coding/ForbidInstantiationCheckTest.java | 6 ++-
.../ForbidReturnInFinallyBlockCheckTest.java | 3 +-
.../coding/IllegalCatchExtendedCheckTest.java | 3 +-
...gicConditionNeedOptimizationCheckTest.java | 3 +-
...ltipleStringLiteralsExtendedCheckTest.java | 3 +-
...VariableDeclarationsExtendedCheckTest.java | 24 ++++++---
...nventionForJunit4TestClassesCheckTest.java | 30 +++++++----
.../NoNullForCollectionReturnCheckTest.java | 39 +++++++++-----
...umericLiteralNeedsUnderscoreCheckTest.java | 32 ++++++-----
...erridableMethodInConstructorCheckTest.java | 3 +-
.../coding/ReturnCountExtendedCheckTest.java | 6 ++-
.../SimpleAccessorNameNotationCheckTest.java | 36 ++++++++-----
.../SingleBreakOrContinueCheckTest.java | 3 +-
.../TernaryPerExpressionCountCheckTest.java | 9 ++--
...necessaryParenthesesExtendedCheckTest.java | 6 ++-
.../coding/UselessSuperCtorCallCheckTest.java | 3 +-
...espaceBeforeArrayInitializerCheckTest.java | 6 ++-
.../CauseParameterInExceptionCheckTest.java | 3 +-
.../design/ChildBlockLengthCheckTest.java | 9 ++--
.../ConstructorWithoutParamsCheckTest.java | 10 ++--
.../StaticMethodCandidateCheckTest.java | 3 +-
.../checkstyle/internal/ChecksTest.java | 24 +++++----
.../internal/CheckstyleRegressionTest.java | 3 +-
sevntu-checks/suppressions.xml | 1 -
34 files changed, 303 insertions(+), 152 deletions(-)
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidConstantAsFirstOperandInConditionCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidConstantAsFirstOperandInConditionCheckTest.java
index 48f2287f3b..8712370464 100755
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidConstantAsFirstOperandInConditionCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidConstantAsFirstOperandInConditionCheckTest.java
@@ -30,7 +30,8 @@ public class AvoidConstantAsFirstOperandInConditionCheckTest extends BaseCheckTe
@Test
public void testAll() throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(AvoidConstantAsFirstOperandInConditionCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(AvoidConstantAsFirstOperandInConditionCheck.class);
final String[] expected = {
"24: " + getCheckMessage(MSG_KEY, "=="),
"25: " + getCheckMessage(MSG_KEY, "=="),
@@ -61,25 +62,29 @@ public void testAll() throws Exception {
"111: " + getCheckMessage(MSG_KEY, "=="),
"112: " + getCheckMessage(MSG_KEY, "=="),
};
- verify(checkConfig, getPath("InputAvoidConstantAsFirstOperandInConditionCheck.java"), expected);
+ verify(checkConfig, getPath("InputAvoidConstantAsFirstOperandInConditionCheck.java"),
+ expected);
}
@Test
public void testAttributes() throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(AvoidConstantAsFirstOperandInConditionCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(AvoidConstantAsFirstOperandInConditionCheck.class);
checkConfig.addAttribute("targetConstantTypes", "LITERAL_FALSE,NUM_INT,NUM_FLOAT");
final String[] expected = {
"25: " + getCheckMessage(MSG_KEY, "=="),
"28: " + getCheckMessage(MSG_KEY, "=="),
"31: " + getCheckMessage(MSG_KEY, "=="),
};
- verify(checkConfig, getPath("InputAvoidConstantAsFirstOperandInConditionCheck.java"), expected);
+ verify(checkConfig, getPath("InputAvoidConstantAsFirstOperandInConditionCheck.java"),
+ expected);
}
@Test
public void testNullProperties() throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(AvoidConstantAsFirstOperandInConditionCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(AvoidConstantAsFirstOperandInConditionCheck.class);
checkConfig.addAttribute("targetConstantTypes", null);
@@ -114,6 +119,7 @@ public void testNullProperties() throws Exception {
"112: " + getCheckMessage(MSG_KEY, "=="),
};
- verify(checkConfig, getPath("InputAvoidConstantAsFirstOperandInConditionCheck.java"), expected);
+ verify(checkConfig, getPath("InputAvoidConstantAsFirstOperandInConditionCheck.java"),
+ expected);
}
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidDefaultSerializableInInnerClassesCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidDefaultSerializableInInnerClassesCheckTest.java
index 284d0e418f..51683efb0c 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidDefaultSerializableInInnerClassesCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidDefaultSerializableInInnerClassesCheckTest.java
@@ -33,7 +33,8 @@ public class AvoidDefaultSerializableInInnerClassesCheckTest extends
@Test
public void testWithAllowPartiaFalse()
throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(AvoidDefaultSerializableInInnerClassesCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(AvoidDefaultSerializableInInnerClassesCheck.class);
final String[] expected = {
"33: " + warningMessage,
@@ -52,36 +53,42 @@ public void testWithAllowPartiaFalse()
"179: " + warningMessage,
"187: " + warningMessage,
};
- verify(checkConfig, getPath("InputAvoidDefaultSerializableInInnerClassesCheck1.java"), expected);
+ verify(checkConfig, getPath("InputAvoidDefaultSerializableInInnerClassesCheck1.java"),
+ expected);
}
@Test
public void testPrivateNotRealReadObject()
throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(AvoidDefaultSerializableInInnerClassesCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(AvoidDefaultSerializableInInnerClassesCheck.class);
checkConfig.addAttribute("allowPartialImplementation", "true");
final String[] expected = {
"10: " + warningMessage,
};
- verify(checkConfig, getPath("InputAvoidDefaultSerializableInInnerClassesCheck2.java"), expected);
+ verify(checkConfig, getPath("InputAvoidDefaultSerializableInInnerClassesCheck2.java"),
+ expected);
}
@Test
public void testRealReadObjectNotRealReadObjectRealPrivate()
throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(AvoidDefaultSerializableInInnerClassesCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(AvoidDefaultSerializableInInnerClassesCheck.class);
final String[] expected = {};
- verify(checkConfig, getPath("InputAvoidDefaultSerializableInInnerClassesCheck3.java"), expected);
+ verify(checkConfig, getPath("InputAvoidDefaultSerializableInInnerClassesCheck3.java"),
+ expected);
}
@Test
public void testWithAllowPartiaTrue()
throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(AvoidDefaultSerializableInInnerClassesCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(AvoidDefaultSerializableInInnerClassesCheck.class);
checkConfig.addAttribute("allowPartialImplementation", "true");
final String[] expected = {
"33: " + warningMessage,
@@ -96,6 +103,7 @@ public void testWithAllowPartiaTrue()
"171: " + warningMessage,
"187: " + warningMessage,
};
- verify(checkConfig, getPath("InputAvoidDefaultSerializableInInnerClassesCheck1.java"), expected);
+ verify(checkConfig, getPath("InputAvoidDefaultSerializableInInnerClassesCheck1.java"),
+ expected);
}
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidHidingCauseExceptionCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidHidingCauseExceptionCheckTest.java
index 56d3d4a5cd..73320d63f9 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidHidingCauseExceptionCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidHidingCauseExceptionCheckTest.java
@@ -31,7 +31,8 @@ public class AvoidHidingCauseExceptionCheckTest extends BaseCheckTestSupport {
@Test
public final void issue52Test() throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(AvoidHidingCauseExceptionCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(AvoidHidingCauseExceptionCheck.class);
final String[] expected = {};
@@ -40,7 +41,8 @@ public final void issue52Test() throws Exception {
@Test
public final void test() throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(AvoidHidingCauseExceptionCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(AvoidHidingCauseExceptionCheck.class);
final String[] expected = {
"18:13: " + getCheckMessage(MSG_KEY, "e"),
@@ -66,7 +68,8 @@ public final void test() throws Exception {
@Test
public final void testWrappingException() throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(AvoidHidingCauseExceptionCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(AvoidHidingCauseExceptionCheck.class);
verify(checkConfig, getPath("InputAvoidHidingCauseExceptionCheckWrapping.java"),
CommonUtils.EMPTY_STRING_ARRAY);
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidModifiersForTypesCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidModifiersForTypesCheckTest.java
index 49dee2b377..d2307b3885 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidModifiersForTypesCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidModifiersForTypesCheckTest.java
@@ -37,7 +37,8 @@
*/
public class AvoidModifiersForTypesCheckTest extends BaseCheckTestSupport {
- private final DefaultConfiguration checkConfig = createCheckConfig(AvoidModifiersForTypesCheck.class);
+ private final DefaultConfiguration checkConfig =
+ createCheckConfig(AvoidModifiersForTypesCheck.class);
@Test
public void testFinal() throws Exception {
@@ -94,8 +95,10 @@ public void testPackagePrivate() throws Exception {
checkConfig.addAttribute("forbiddenClassesRegexpPublic", publicRegexp);
final String[] expected = {
- "23:5: " + getCheckMessage(MSG_KEY, "InputAvoidModifiersForTypesCheck", "package-private"),
- "24:5: " + getCheckMessage(MSG_KEY, "InputAvoidModifiersForTypesCheck", "package-private"),
+ "23:5: " + getCheckMessage(MSG_KEY, "InputAvoidModifiersForTypesCheck",
+ "package-private"),
+ "24:5: " + getCheckMessage(MSG_KEY, "InputAvoidModifiersForTypesCheck",
+ "package-private"),
};
verify(checkConfig, getPath("InputAvoidModifiersForTypesCheck.java"), expected);
@@ -217,9 +220,11 @@ public void testFinalAndPrivatePackage() throws Exception {
final String[] expected = {
"19:5: " + getCheckMessage(MSG_KEY, "InputAvoidModifiersForTypesCheck", "final"),
"20:5: " + getCheckMessage(MSG_KEY, "InputAvoidModifiersForTypesCheck", "final"),
- "23:5: " + getCheckMessage(MSG_KEY, "InputAvoidModifiersForTypesCheck", "package-private"),
+ "23:5: " + getCheckMessage(MSG_KEY, "InputAvoidModifiersForTypesCheck",
+ "package-private"),
"24:5: " + getCheckMessage(MSG_KEY, "InputAvoidModifiersForTypesCheck", "final"),
- "24:5: " + getCheckMessage(MSG_KEY, "InputAvoidModifiersForTypesCheck", "package-private"),
+ "24:5: " + getCheckMessage(MSG_KEY, "InputAvoidModifiersForTypesCheck",
+ "package-private"),
"29:9: " + getCheckMessage(MSG_KEY, "InputAvoidModifiersForTypesCheck", "final"),
};
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidNotShortCircuitOperatorsForBooleanCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidNotShortCircuitOperatorsForBooleanCheckTest.java
index bca0349d60..8bfe2bd199 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidNotShortCircuitOperatorsForBooleanCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidNotShortCircuitOperatorsForBooleanCheckTest.java
@@ -29,7 +29,8 @@
public class AvoidNotShortCircuitOperatorsForBooleanCheckTest extends BaseCheckTestSupport {
- private final DefaultConfiguration checkConfig = createCheckConfig(AvoidNotShortCircuitOperatorsForBooleanCheck.class);
+ private final DefaultConfiguration checkConfig =
+ createCheckConfig(AvoidNotShortCircuitOperatorsForBooleanCheck.class);
@Test
public final void testAll() throws Exception {
@@ -51,7 +52,8 @@ public final void testAll() throws Exception {
"97:11: " + getCheckMessage(MSG_KEY, "|="),
};
- verify(checkConfig, getPath("InputAvoidNotShortCircuitOperatorsForBooleanCheck.java"), expected);
+ verify(checkConfig, getPath("InputAvoidNotShortCircuitOperatorsForBooleanCheck.java"),
+ expected);
}
@Test
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheckTest.java
index cf38233e94..ab5b089117 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheckTest.java
@@ -38,15 +38,26 @@ public void testCustomDecrationOrder() throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(CustomDeclarationOrderCheck.class);
final String[] expected = {
- "10:5: " + getCheckMessage(MSG_KEY_FIELD, "Field(private static final long serialVersionUID)", "Field(.*final public .*|.*public final .*)"),
+ "10:5: " + getCheckMessage(MSG_KEY_FIELD,
+ "Field(private static final long serialVersionUID)",
+ "Field(.*final public .*|.*public final .*)"),
"20:5: " + getCheckMessage(MSG_KEY_FIELD, "Field(protected .*)", "Field(private .*)"),
- "22:5: " + getCheckMessage(MSG_KEY_FIELD, "Field(@SuppressWarnings(.*serial.*).*)", "Field(private .*)"),
- "45:5: " + getCheckMessage(MSG_KEY_CONSTRUCTOR, "Ctor()", "Method(.*abstract .*public .*|.*public .*abstract .*|protected .*)"),
- "52:5: " + getCheckMessage(MSG_KEY_METHOD, "Method(public static .*(new|edit|create).*)", "Method(.*abstract .*public .*|.*public .*abstract .*|protected .*)"),
- "60:9: " + getCheckMessage(MSG_KEY_FIELD, "Field(.*final public .*|.*public final .*)", "Field(private .*)"),
- "80:9: " + getCheckMessage(MSG_KEY_CLASS, "InnerClass (public .*abstract .*)", "InnerClass (private .*)"),
- "84:5: " + getCheckMessage(MSG_KEY_METHOD, "Method(@Deprecated .*)", "InnerClass (private .*)"),
- "95:5: " + getCheckMessage(MSG_KEY_METHOD, "Method(.*abstract .*public .*|.*public .*abstract .*|protected .*)", "InnerClass (private .*)"),
+ "22:5: " + getCheckMessage(MSG_KEY_FIELD, "Field(@SuppressWarnings(.*serial.*).*)",
+ "Field(private .*)"),
+ "45:5: " + getCheckMessage(MSG_KEY_CONSTRUCTOR, "Ctor()",
+ "Method(.*abstract .*public .*|.*public .*abstract .*|protected .*)"),
+ "52:5: " + getCheckMessage(MSG_KEY_METHOD,
+ "Method(public static .*(new|edit|create).*)",
+ "Method(.*abstract .*public .*|.*public .*abstract .*|protected .*)"),
+ "60:9: " + getCheckMessage(MSG_KEY_FIELD, "Field(.*final public .*|.*public final .*)",
+ "Field(private .*)"),
+ "80:9: " + getCheckMessage(MSG_KEY_CLASS, "InnerClass (public .*abstract .*)",
+ "InnerClass (private .*)"),
+ "84:5: " + getCheckMessage(MSG_KEY_METHOD, "Method(@Deprecated .*)",
+ "InnerClass (private .*)"),
+ "95:5: " + getCheckMessage(MSG_KEY_METHOD,
+ "Method(.*abstract .*public .*|.*public .*abstract .*|protected .*)",
+ "InnerClass (private .*)"),
"105:5: " + getCheckMessage(MSG_KEY_FIELD, "Field(private .*)", "Ctor()"),
};
checkConfig.addAttribute("customDeclarationOrder",
@@ -59,12 +70,14 @@ public void testCustomDecrationOrder() throws Exception {
+ "Method(@Deprecated .*) ###"
+ "Method(public static .*(new|edit|create).*) ###"
+ "Method() ###"
- + "Method(.*abstract .*public .*|.*public .*abstract .*|protected .*) ###"
+ + "Method(.*abstract .*public .*|.*public .*abstract .*|"
+ + "protected .*) ###"
+ "InnerClass (public .*abstract .*) ###"
+ "InnerClass (private .*)");
checkConfig.addAttribute("caseSensitive", "true");
verify(checkConfig, getPath("InputCustomDeclarationOrderCheck.java"), expected);
- checkConfig.addAttribute("customDeclarationOrder", "Field .*final.*public|.*public.*final)");
+ checkConfig
+ .addAttribute("customDeclarationOrder", "Field .*final.*public|.*public.*final)");
}
@Test
@@ -73,10 +86,14 @@ public void anonymousClasses()
final DefaultConfiguration checkConfig =
createCheckConfig(CustomDeclarationOrderCheck.class);
final String[] expected = {
- "39:5: " + getCheckMessage(MSG_KEY_FIELD, "DeclareAnnonClassField(private .*)", "Field(public .*)"),
- "54:5: " + getCheckMessage(MSG_KEY_FIELD, "DeclareAnnonClassField(private .*)", "Field(private .*)"),
- "66:5: " + getCheckMessage(MSG_KEY_FIELD, "DeclareAnnonClassField()", "Ctor(public .*)"),
- "95:9: " + getCheckMessage(MSG_KEY_FIELD, "DeclareAnnonClassField(private .*)", "Field(private .*)"),
+ "39:5: " + getCheckMessage(MSG_KEY_FIELD, "DeclareAnnonClassField(private .*)",
+ "Field(public .*)"),
+ "54:5: " + getCheckMessage(MSG_KEY_FIELD, "DeclareAnnonClassField(private .*)",
+ "Field(private .*)"),
+ "66:5: " + getCheckMessage(MSG_KEY_FIELD, "DeclareAnnonClassField()",
+ "Ctor(public .*)"),
+ "95:9: " + getCheckMessage(MSG_KEY_FIELD, "DeclareAnnonClassField(private .*)",
+ "Field(private .*)"),
};
checkConfig
.addAttribute(
@@ -123,7 +140,8 @@ public void gettersSetters()
"GetterSetter(.*) ### Method(.*)"
);
checkConfig.addAttribute("caseSensitive", "false");
- verify(checkConfig, getPath("InputCustomDeclarationOrderCheckGettersSetters.java"), expected);
+ verify(checkConfig, getPath("InputCustomDeclarationOrderCheckGettersSetters.java"),
+ expected);
}
@Test
@@ -140,10 +158,12 @@ public void innerInterfacesAndEnums()
checkConfig.addAttribute(
"customDeclarationOrder",
- "Field(private ) ### Field(public ) ### Method(.*) ### InnerInterface(.*) ### InnerEnum(.*)"
+ "Field(private ) ### Field(public ) ### Method(.*) ### InnerInterface(.*) ### "
+ + "InnerEnum(.*)"
);
checkConfig.addAttribute("caseSensitive", "true");
- verify(checkConfig, getPath("InputCustomDeclarationOrderCheckInnerInterfaceEnum.java"), expected);
+ verify(checkConfig, getPath("InputCustomDeclarationOrderCheckInnerInterfaceEnum.java"),
+ expected);
}
@Test
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/DiamondOperatorForVariableDefinitionCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/DiamondOperatorForVariableDefinitionCheckTest.java
index 3f9f8a7ad9..b60dbd7695 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/DiamondOperatorForVariableDefinitionCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/DiamondOperatorForVariableDefinitionCheckTest.java
@@ -27,7 +27,8 @@
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
public class DiamondOperatorForVariableDefinitionCheckTest extends BaseCheckTestSupport {
- private final DefaultConfiguration checkConfig = createCheckConfig(DiamondOperatorForVariableDefinitionCheck.class);
+ private final DefaultConfiguration checkConfig =
+ createCheckConfig(DiamondOperatorForVariableDefinitionCheck.class);
@Test
public void testDefault() throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/EmptyPublicCtorInClassCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/EmptyPublicCtorInClassCheckTest.java
index ccb2c4c2c9..630f1215bd 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/EmptyPublicCtorInClassCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/EmptyPublicCtorInClassCheckTest.java
@@ -91,7 +91,8 @@ public void testClassWithInnerClasses()
public void testCtorAnnotatedWithAnnotation() throws Exception {
final DefaultConfiguration config = createCheckConfig(EmptyPublicCtorInClassCheck.class);
- config.addAttribute("ctorAnnotationNames", "com\\.github\\.sevntu\\.checkstyle\\.checks\\.coding\\.AnnotationName");
+ config.addAttribute("ctorAnnotationNames", "com\\.github\\.sevntu\\.checkstyle\\.checks\\."
+ + "coding\\.AnnotationName");
final String[] expected = {};
@@ -106,7 +107,8 @@ public void testClassAnnotatedWithAnnotation1() throws Exception {
"com\\.github\\.sevntu\\.checkstyle\\.checks\\.coding\\.AnnotationName|"
+ "org\\.junit\\.runner\\.RunWith|"
+ "org\\.junit\\.Ignore|"
- + "com\\.github\\.sevntu\\.checkstyle\\.checks\\.coding\\.InputEmptyPublicCtorInClassCheck9\\.InnerAnnotation");
+ + "com\\.github\\.sevntu\\.checkstyle\\.checks\\.coding\\."
+ + "InputEmptyPublicCtorInClassCheck9\\.InnerAnnotation");
final String[] expected = {};
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidCCommentsInMethodsCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidCCommentsInMethodsCheckTest.java
index d267b70b76..f302d82602 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidCCommentsInMethodsCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidCCommentsInMethodsCheckTest.java
@@ -34,7 +34,8 @@ public class ForbidCCommentsInMethodsCheckTest extends
public void defaultTest()
throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(ForbidCCommentsInMethodsCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(ForbidCCommentsInMethodsCheck.class);
final String[] expected = {
"10: " + warningMessage,
"17: " + warningMessage,
@@ -51,7 +52,8 @@ public void defaultTest()
@Test
public void testFileWithoutComments()
throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(ForbidCCommentsInMethodsCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(ForbidCCommentsInMethodsCheck.class);
final String[] expected = {};
verify(checkConfig, getPath("InputForbidCCommentsInMethodsCheck2.java"), expected);
}
@@ -59,7 +61,8 @@ public void testFileWithoutComments()
@Test
public void testInterface()
throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(ForbidCCommentsInMethodsCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(ForbidCCommentsInMethodsCheck.class);
final String[] expected = {};
verify(checkConfig, getPath("InputForbidCCommentsInMethodsCheck3.java"), expected);
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidCertainImportsCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidCertainImportsCheckTest.java
index c7e2ae3f3d..096fe0f2d5 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidCertainImportsCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidCertainImportsCheckTest.java
@@ -34,7 +34,8 @@
* Yaroslavtsev
*/
public class ForbidCertainImportsCheckTest extends BaseCheckTestSupport {
- private final DefaultConfiguration checkConfig = createCheckConfig(ForbidCertainImportsCheck.class);
+ private final DefaultConfiguration checkConfig =
+ createCheckConfig(ForbidCertainImportsCheck.class);
@Test
public void testNormalWork() throws Exception {
@@ -45,9 +46,12 @@ public void testNormalWork() throws Exception {
checkConfig.addAttribute("forbiddenImportsExcludesRegexp", "");
final String[] expected = {
- "3: " + getCheckMessage(MSG_KEY, importRegexp, "com.puppycrawl.tools.checkstyle.api.AutomaticBean"),
- "9: " + getCheckMessage(MSG_KEY, importRegexp, "com.puppycrawl.tools.checkstyle.api.AutomaticBean"),
- "21: " + getCheckMessage(MSG_KEY, importRegexp, "com.puppycrawl.tools.checkstyle.api.AutomaticBean"),
+ "3: " + getCheckMessage(MSG_KEY, importRegexp,
+ "com.puppycrawl.tools.checkstyle.api.AutomaticBean"),
+ "9: " + getCheckMessage(MSG_KEY, importRegexp,
+ "com.puppycrawl.tools.checkstyle.api.AutomaticBean"),
+ "21: " + getCheckMessage(MSG_KEY, importRegexp,
+ "com.puppycrawl.tools.checkstyle.api.AutomaticBean"),
};
verify(checkConfig, getPath("InputForbidCertainImportsCheck.java"), expected);
@@ -85,7 +89,9 @@ public void testEmptyImportsAndDefaultPackage() throws Exception {
final String[] expected = {};
- verify(checkConfig, getPath("InputForbidCertainImportsCheckDefaultPackageWithoutImports.java"), expected);
+ verify(checkConfig,
+ getPath("InputForbidCertainImportsCheckDefaultPackageWithoutImports.java"),
+ expected);
}
@Test
@@ -96,7 +102,9 @@ public void testEmptyParams() throws Exception {
final String[] expected = {};
- verify(checkConfig, getPath("InputForbidCertainImportsCheckDefaultPackageWithoutImports.java"), expected);
+ verify(checkConfig,
+ getPath("InputForbidCertainImportsCheckDefaultPackageWithoutImports.java"),
+ expected);
}
@Test
@@ -107,7 +115,9 @@ public void testNullParams() throws Exception {
final String[] expected = {};
- verify(checkConfig, getPath("InputForbidCertainImportsCheckDefaultPackageWithoutImports.java"), expected);
+ verify(checkConfig,
+ getPath("InputForbidCertainImportsCheckDefaultPackageWithoutImports.java"),
+ expected);
}
@Test
@@ -130,9 +140,12 @@ public void testPackageForbiddenImportMatchButNullExclude() throws Exception {
checkConfig.addAttribute("forbiddenImportsExcludesRegexp", null);
final String[] expected = {
- "3: " + getCheckMessage(MSG_KEY, importRegexp, "com.puppycrawl.tools.checkstyle.api.AutomaticBean"),
- "9: " + getCheckMessage(MSG_KEY, importRegexp, "com.puppycrawl.tools.checkstyle.api.AutomaticBean"),
- "21: " + getCheckMessage(MSG_KEY, importRegexp, "com.puppycrawl.tools.checkstyle.api.AutomaticBean"),
+ "3: " + getCheckMessage(MSG_KEY, importRegexp,
+ "com.puppycrawl.tools.checkstyle.api.AutomaticBean"),
+ "9: " + getCheckMessage(MSG_KEY, importRegexp,
+ "com.puppycrawl.tools.checkstyle.api.AutomaticBean"),
+ "21: " + getCheckMessage(MSG_KEY, importRegexp,
+ "com.puppycrawl.tools.checkstyle.api.AutomaticBean"),
};
verify(checkConfig, getPath("InputForbidCertainImportsCheck.java"), expected);
@@ -146,7 +159,9 @@ public void testNoImports() throws Exception {
final String[] expected = {};
- verify(checkConfig, getPath("InputForbidCertainImportsCheckDefaultPackageWithoutImports.java"), expected);
+ verify(checkConfig,
+ getPath("InputForbidCertainImportsCheckDefaultPackageWithoutImports.java"),
+ expected);
}
@Test
@@ -158,8 +173,10 @@ public void testSinglePackage() throws Exception {
checkConfig.addAttribute("forbiddenImportsExcludesRegexp", "");
final String[] expected = {
- "3: " + getCheckMessage(MSG_KEY, importRegexp, "com.puppycrawl.tools.checkstyle.api.AutomaticBean"),
- "10: " + getCheckMessage(MSG_KEY, importRegexp, "com.puppycrawl.tools.checkstyle.api.AutomaticBean"),
+ "3: " + getCheckMessage(MSG_KEY, importRegexp,
+ "com.puppycrawl.tools.checkstyle.api.AutomaticBean"),
+ "10: " + getCheckMessage(MSG_KEY, importRegexp,
+ "com.puppycrawl.tools.checkstyle.api.AutomaticBean"),
};
verify(checkConfig, getPath("InputForbidCertainImportsCheckSinglePackage.java"), expected);
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidInstantiationCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidInstantiationCheckTest.java
index 36b4c6433a..9329561692 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidInstantiationCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidInstantiationCheckTest.java
@@ -34,7 +34,8 @@
* Yaroslavtsev
*/
public class ForbidInstantiationCheckTest extends BaseCheckTestSupport {
- private final DefaultConfiguration checkConfig = createCheckConfig(ForbidInstantiationCheck.class);
+ private final DefaultConfiguration checkConfig =
+ createCheckConfig(ForbidInstantiationCheck.class);
@Test
public void testNullProperties() throws Exception {
@@ -75,7 +76,8 @@ public void testNormalWork() throws Exception {
@Test
public void testNormalWork2() throws Exception {
- checkConfig.addAttribute("forbiddenClasses", "com.github.sevntu.checkstyle.checks.coding.InputForbidInstantiationCheck");
+ checkConfig.addAttribute("forbiddenClasses",
+ "com.github.sevntu.checkstyle.checks.coding.InputForbidInstantiationCheck");
final String[] expected = {
"12:89: " + getCheckMessage(MSG_KEY, "InputForbidInstantiationCheck"),
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidReturnInFinallyBlockCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidReturnInFinallyBlockCheckTest.java
index 8999892db2..151b87c916 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidReturnInFinallyBlockCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidReturnInFinallyBlockCheckTest.java
@@ -36,7 +36,8 @@ public class ForbidReturnInFinallyBlockCheckTest
@Test
public void testDefault()
throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(ForbidReturnInFinallyBlockCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(ForbidReturnInFinallyBlockCheck.class);
final String[] expected = {
"13: " + warningMessage,
"28: " + warningMessage,
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/IllegalCatchExtendedCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/IllegalCatchExtendedCheckTest.java
index 80b57f4161..946b1a3f0b 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/IllegalCatchExtendedCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/IllegalCatchExtendedCheckTest.java
@@ -28,7 +28,8 @@
public class IllegalCatchExtendedCheckTest extends BaseCheckTestSupport {
- private final DefaultConfiguration checkConfig = createCheckConfig(IllegalCatchExtendedCheck.class);
+ private final DefaultConfiguration checkConfig =
+ createCheckConfig(IllegalCatchExtendedCheck.class);
@Test
public final void testDefault() throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/LogicConditionNeedOptimizationCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/LogicConditionNeedOptimizationCheckTest.java
index eef12a11f0..7c7dbfbd37 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/LogicConditionNeedOptimizationCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/LogicConditionNeedOptimizationCheckTest.java
@@ -30,7 +30,8 @@ public class LogicConditionNeedOptimizationCheckTest extends BaseCheckTestSuppor
@Test
public void test() throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(LogicConditionNeedOptimizationCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(LogicConditionNeedOptimizationCheck.class);
final String[] expected = {
"26: " + getCheckMessage(MSG_KEY, "&&", 26, 27),
"28: " + getCheckMessage(MSG_KEY, "&&", 28, 21),
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MultipleStringLiteralsExtendedCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MultipleStringLiteralsExtendedCheckTest.java
index 4f8d088445..3ccc4ca2dc 100755
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MultipleStringLiteralsExtendedCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MultipleStringLiteralsExtendedCheckTest.java
@@ -47,7 +47,8 @@ public void testIt() throws Exception {
@Test
public void testItAndShowAllWarnings()
throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(MultipleStringLiteralsExtendedCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(MultipleStringLiteralsExtendedCheck.class);
checkConfig.addAttribute("allowedDuplicates", "2");
checkConfig.addAttribute("ignoreStringsRegexp", "");
checkConfig.addAttribute("highlightAllDuplicates", "true");
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MultipleVariableDeclarationsExtendedCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MultipleVariableDeclarationsExtendedCheckTest.java
index 11b11085b5..1aa770c2a6 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MultipleVariableDeclarationsExtendedCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MultipleVariableDeclarationsExtendedCheckTest.java
@@ -34,7 +34,8 @@ public class MultipleVariableDeclarationsExtendedCheckTest extends BaseCheckTest
@Test
public void testStandartSituation() throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(MultipleVariableDeclarationsExtendedCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(MultipleVariableDeclarationsExtendedCheck.class);
final String[] expected = {
"3:5: " + msgVarDeclarationsComa,
@@ -49,12 +50,14 @@ public void testStandartSituation() throws Exception {
checkConfig.addAttribute("ignoreCycles", "false");
checkConfig.addAttribute("ignoreMethods", "false");
- verify(checkConfig, getPath("InputMultipleVariableDeclarationsExtendedCheck.java"), expected);
+ verify(checkConfig, getPath("InputMultipleVariableDeclarationsExtendedCheck.java"),
+ expected);
}
@Test
public void testIgnoreCycles() throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(MultipleVariableDeclarationsExtendedCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(MultipleVariableDeclarationsExtendedCheck.class);
final String[] expected = {
"3:5: " + msgVarDeclarationsComa,
@@ -67,12 +70,14 @@ public void testIgnoreCycles() throws Exception {
checkConfig.addAttribute("ignoreCycles", "true");
checkConfig.addAttribute("ignoreMethods", "false");
- verify(checkConfig, getPath("InputMultipleVariableDeclarationsExtendedCheck.java"), expected);
+ verify(checkConfig, getPath("InputMultipleVariableDeclarationsExtendedCheck.java"),
+ expected);
}
@Test
public void testIgnoreMethods() throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(MultipleVariableDeclarationsExtendedCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(MultipleVariableDeclarationsExtendedCheck.class);
final String[] expected = {
"3:5: " + msgVarDeclarationsComa,
@@ -84,12 +89,14 @@ public void testIgnoreMethods() throws Exception {
checkConfig.addAttribute("ignoreCycles", "false");
checkConfig.addAttribute("ignoreMethods", "true");
- verify(checkConfig, getPath("InputMultipleVariableDeclarationsExtendedCheck.java"), expected);
+ verify(checkConfig, getPath("InputMultipleVariableDeclarationsExtendedCheck.java"),
+ expected);
}
@Test
public void testIgnoreMethodsAndIgnoreCycles() throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(MultipleVariableDeclarationsExtendedCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(MultipleVariableDeclarationsExtendedCheck.class);
final String[] expected = {
"3:5: " + msgVarDeclarationsComa,
@@ -100,7 +107,8 @@ public void testIgnoreMethodsAndIgnoreCycles() throws Exception {
checkConfig.addAttribute("ignoreCycles", "true");
checkConfig.addAttribute("ignoreMethods", "true");
- verify(checkConfig, getPath("InputMultipleVariableDeclarationsExtendedCheck.java"), expected);
+ verify(checkConfig, getPath("InputMultipleVariableDeclarationsExtendedCheck.java"),
+ expected);
}
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NameConventionForJunit4TestClassesCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NameConventionForJunit4TestClassesCheckTest.java
index d0bacd4d09..15deda3a9b 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NameConventionForJunit4TestClassesCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NameConventionForJunit4TestClassesCheckTest.java
@@ -51,7 +51,8 @@ public void testAnnotatedClass()
buildMesssage("14:18: ", defaultTestClassName),
};
- verify(customConfig, getPath("InputNameConventionForJunit4TestClassesCheck1.java"), expected);
+ verify(customConfig, getPath("InputNameConventionForJunit4TestClassesCheck1.java"),
+ expected);
}
@Test
@@ -61,7 +62,8 @@ public void testAnnotatedMethod()
buildMesssage("8:18: ", defaultTestClassName),
};
- verify(checkConfig, getPath("InputNameConventionForJunit4TestClassesCheck2.java"), expected);
+ verify(checkConfig, getPath("InputNameConventionForJunit4TestClassesCheck2.java"),
+ expected);
}
@Test
@@ -70,7 +72,8 @@ public void testClassIsNotTest()
final String[] expected = {
};
- verify(checkConfig, getPath("InputNameConventionForJunit4TestClassesCheck3.java"), expected);
+ verify(checkConfig, getPath("InputNameConventionForJunit4TestClassesCheck3.java"),
+ expected);
}
@Test
@@ -80,7 +83,8 @@ public void testRegex()
buildMesssage("7:18: ", defaultTestClassName),
};
- verify(checkConfig, getPath("InputNameConventionForJunit4TestClassesCheck4.java"), expected);
+ verify(checkConfig, getPath("InputNameConventionForJunit4TestClassesCheck4.java"),
+ expected);
}
@Test
@@ -93,7 +97,8 @@ public void testQualifiedAnnotationName()
buildMesssage("8:18: ", defaultTestClassName),
};
- verify(customConfig, getPath("InputNameConventionForJunit4TestClassesCheck5.java"), expected);
+ verify(customConfig, getPath("InputNameConventionForJunit4TestClassesCheck5.java"),
+ expected);
}
@Test
@@ -106,7 +111,8 @@ public void testJunitClassTestAnnotationNamesRegexOption()
buildMesssage("7:18: ", defaultTestClassName),
};
- verify(customConfig, getPath("InputNameConventionForJunit4TestClassesCheck6.java"), expected);
+ verify(customConfig, getPath("InputNameConventionForJunit4TestClassesCheck6.java"),
+ expected);
}
@Test
@@ -119,7 +125,8 @@ public void testJunitMethodTestAnnotationNamesRegexOption()
buildMesssage("6:18: ", defaultTestClassName),
};
- verify(customConfig, getPath("InputNameConventionForJunit4TestClassesCheck7.java"), expected);
+ verify(customConfig, getPath("InputNameConventionForJunit4TestClassesCheck7.java"),
+ expected);
}
@Test
@@ -132,7 +139,8 @@ public void testCorrectTestClassNameRegexOption()
buildMesssage("5:14: ", "Hello*"),
};
- verify(customConfig, getPath("InputNameConventionForJunit4TestClassesCheck8.java"), expected);
+ verify(customConfig, getPath("InputNameConventionForJunit4TestClassesCheck8.java"),
+ expected);
}
@Test
@@ -143,7 +151,8 @@ public void testNullProperties()
final String[] expected = {};
- verify(customConfig, getPath("InputNameConventionForJunit4TestClassesCheck8.java"), expected);
+ verify(customConfig, getPath("InputNameConventionForJunit4TestClassesCheck8.java"),
+ expected);
}
@Test
@@ -154,7 +163,8 @@ public void testEmptyProperties()
final String[] expected = {};
- verify(customConfig, getPath("InputNameConventionForJunit4TestClassesCheck8.java"), expected);
+ verify(customConfig, getPath("InputNameConventionForJunit4TestClassesCheck8.java"),
+ expected);
}
private static DefaultConfiguration buildConfiguration(String expectedNameRegex,
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NoNullForCollectionReturnCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NoNullForCollectionReturnCheckTest.java
index e869675545..0f10cfd600 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NoNullForCollectionReturnCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NoNullForCollectionReturnCheckTest.java
@@ -32,7 +32,8 @@ public class NoNullForCollectionReturnCheckTest extends BaseCheckTestSupport {
@Test
public void testArraysNotDeep() throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(NoNullForCollectionReturnCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(NoNullForCollectionReturnCheck.class);
final String[] expected = {
"11: " + warningMessage,
"46: " + warningMessage,
@@ -45,7 +46,8 @@ public void testArraysNotDeep() throws Exception {
@Test
public void testArraysDeep() throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(NoNullForCollectionReturnCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(NoNullForCollectionReturnCheck.class);
checkConfig.addAttribute("searchThroughMethodBody", "true");
final String[] expected = {
"11: " + warningMessage,
@@ -60,8 +62,10 @@ public void testArraysDeep() throws Exception {
@Test
public void testCollections() throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(NoNullForCollectionReturnCheck.class);
- final String listOfCollecton = "Collection ArrayList LinkedList Stack Vector HashSet TreeSet";
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(NoNullForCollectionReturnCheck.class);
+ final String listOfCollecton =
+ "Collection ArrayList LinkedList Stack Vector HashSet TreeSet";
checkConfig.addAttribute("collectionList", listOfCollecton);
final String[] expected = {
"7: " + warningMessage,
@@ -78,7 +82,8 @@ public void testCollections() throws Exception {
@Test
public void testRevereCode() throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(NoNullForCollectionReturnCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(NoNullForCollectionReturnCheck.class);
final String[] expected = {
"13: " + warningMessage,
"16: " + warningMessage,
@@ -89,7 +94,8 @@ public void testRevereCode() throws Exception {
@Test
public void testRevereCodeDeep() throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(NoNullForCollectionReturnCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(NoNullForCollectionReturnCheck.class);
checkConfig.addAttribute("searchThroughMethodBody", "true");
final String[] expected = {
"13: " + warningMessage,
@@ -101,7 +107,8 @@ public void testRevereCodeDeep() throws Exception {
@Test
public void testInterface() throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(NoNullForCollectionReturnCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(NoNullForCollectionReturnCheck.class);
final String[] expected = {
};
@@ -110,7 +117,8 @@ public void testInterface() throws Exception {
@Test
public void testInnerClasses() throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(NoNullForCollectionReturnCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(NoNullForCollectionReturnCheck.class);
final String[] expected = {
"17: " + warningMessage,
"25: " + warningMessage,
@@ -123,7 +131,8 @@ public void testInnerClasses() throws Exception {
@Test
public void testRealCode() throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(NoNullForCollectionReturnCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(NoNullForCollectionReturnCheck.class);
checkConfig.addAttribute("searchThroughMethodBody", "true");
final String[] expected = {
};
@@ -134,7 +143,8 @@ public void testRealCode() throws Exception {
@Test
public void testIss148()
throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(NoNullForCollectionReturnCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(NoNullForCollectionReturnCheck.class);
final String[] expected = {
"8: " + warningMessage,
};
@@ -145,7 +155,8 @@ public void testIss148()
@Test
public void testIss148Deep()
throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(NoNullForCollectionReturnCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(NoNullForCollectionReturnCheck.class);
checkConfig.addAttribute("searchThroughMethodBody", "true");
final String[] expected = {
"8: " + warningMessage,
@@ -157,11 +168,13 @@ public void testIss148Deep()
@Test
public void testConstructor()
throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(NoNullForCollectionReturnCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(NoNullForCollectionReturnCheck.class);
final String[] expected = {
"5: " + warningMessage,
};
- verify(checkConfig, getPath("InputNoNullForCollectionReturnCheckConstructor.java"), expected);
+ verify(checkConfig, getPath("InputNoNullForCollectionReturnCheckConstructor.java"),
+ expected);
}
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NumericLiteralNeedsUnderscoreCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NumericLiteralNeedsUnderscoreCheckTest.java
index 0bc29ba103..1e5caefa35 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NumericLiteralNeedsUnderscoreCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NumericLiteralNeedsUnderscoreCheckTest.java
@@ -45,7 +45,8 @@ public class NumericLiteralNeedsUnderscoreCheckTest extends BaseCheckTestSupport
@Test
public void test() throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(NumericLiteralNeedsUnderscoreCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(NumericLiteralNeedsUnderscoreCheck.class);
final String[] expected = {
"27: " + warningMessage,
"28: " + warningMessage,
@@ -86,7 +87,8 @@ public void test() throws Exception {
@Test
public void testWithConfig() throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(NumericLiteralNeedsUnderscoreCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(NumericLiteralNeedsUnderscoreCheck.class);
checkConfig.addAttribute("minDecimalSymbolLength", "1");
checkConfig.addAttribute("maxDecimalSymbolsUntilUnderscore", "3");
checkConfig.addAttribute("minHexSymbolLength", "1");
@@ -143,9 +145,10 @@ public void testIgnore() throws Exception {
"33: " + warningMessage,
"40: " + warningMessage,
};
- verify(checkConfig, new File("src/test/resources-noncompilable/com/github/sevntu/checkstyle/checks/"
- + "coding/InputNumericLiteralNeedsUnderscoreCheck3.java").getCanonicalPath(),
- expected);
+ verify(checkConfig,
+ new File("src/test/resources-noncompilable/com/github/sevntu/"
+ + "checkstyle/checks/coding/InputNumericLiteralNeedsUnderscoreCheck3.java")
+ .getCanonicalPath(), expected);
}
@Test
@@ -169,15 +172,17 @@ public void testConfiguredIgnore() throws Exception {
"33: " + warningMessage,
"38: " + warningMessage,
};
- verify(checkConfig, new File("src/test/resources-noncompilable/com/github/sevntu/checkstyle/checks/"
- + "coding/InputNumericLiteralNeedsUnderscoreCheck3.java").getCanonicalPath(),
- expected);
+ verify(checkConfig,
+ new File("src/test/resources-noncompilable/com/github/sevntu/"
+ + "checkstyle/checks/coding/InputNumericLiteralNeedsUnderscoreCheck3.java")
+ .getCanonicalPath(), expected);
}
@Test
public void testMinSymbolsBeforeCheckingSwitchReflection() throws Exception {
try {
- final NumericLiteralNeedsUnderscoreCheck check = new NumericLiteralNeedsUnderscoreCheck();
+ final NumericLiteralNeedsUnderscoreCheck check =
+ new NumericLiteralNeedsUnderscoreCheck();
final NumericType mockType = PowerMockito.mock(NumericType.class);
WhiteboxImpl.invokeMethod(check, "minSymbolsBeforeChecking", mockType);
}
@@ -189,7 +194,8 @@ public void testMinSymbolsBeforeCheckingSwitchReflection() throws Exception {
@Test
public void testMaxSymbolsUntilUnderscoreSwitchReflection() throws Exception {
try {
- final NumericLiteralNeedsUnderscoreCheck check = new NumericLiteralNeedsUnderscoreCheck();
+ final NumericLiteralNeedsUnderscoreCheck check =
+ new NumericLiteralNeedsUnderscoreCheck();
final NumericType mockType = PowerMockito.mock(NumericType.class);
WhiteboxImpl.invokeMethod(check, "maxSymbolsUntilUnderscore", mockType);
}
@@ -201,7 +207,8 @@ public void testMaxSymbolsUntilUnderscoreSwitchReflection() throws Exception {
@Test
public void testGetNumericSegmentsSwitchReflection() throws Exception {
try {
- final NumericLiteralNeedsUnderscoreCheck check = new NumericLiteralNeedsUnderscoreCheck();
+ final NumericLiteralNeedsUnderscoreCheck check =
+ new NumericLiteralNeedsUnderscoreCheck();
final NumericType mockType = PowerMockito.mock(NumericType.class);
WhiteboxImpl.invokeMethod(check, "getNumericSegments", "", mockType);
}
@@ -213,7 +220,8 @@ public void testGetNumericSegmentsSwitchReflection() throws Exception {
@Test
public void testRemovePrePostfixByTypeSwitchReflection() throws Exception {
try {
- final NumericLiteralNeedsUnderscoreCheck check = new NumericLiteralNeedsUnderscoreCheck();
+ final NumericLiteralNeedsUnderscoreCheck check =
+ new NumericLiteralNeedsUnderscoreCheck();
final NumericType mockType = PowerMockito.mock(NumericType.class);
WhiteboxImpl.invokeMethod(check, "removePrePostfixByType", "", mockType);
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/OverridableMethodInConstructorCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/OverridableMethodInConstructorCheckTest.java
index 3c48382480..2854a391dc 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/OverridableMethodInConstructorCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/OverridableMethodInConstructorCheckTest.java
@@ -33,7 +33,8 @@ public class OverridableMethodInConstructorCheckTest extends BaseCheckTestSuppor
private static final String CLONE_KEY = "'clone()' method";
private static final String READ_OBJECT_KEY = "'readObject()' method";
- private final DefaultConfiguration checkConfig = createCheckConfig(OverridableMethodInConstructorCheck.class);
+ private final DefaultConfiguration checkConfig =
+ createCheckConfig(OverridableMethodInConstructorCheck.class);
@Test
public final void revereCodeTest() throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnCountExtendedCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnCountExtendedCheckTest.java
index 67a8caaf8f..5fa5658fa0 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnCountExtendedCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnCountExtendedCheckTest.java
@@ -30,7 +30,8 @@
public class ReturnCountExtendedCheckTest extends BaseCheckTestSupport {
- private final DefaultConfiguration checkConfig = createCheckConfig(ReturnCountExtendedCheck.class);
+ private final DefaultConfiguration checkConfig =
+ createCheckConfig(ReturnCountExtendedCheck.class);
@Test
public void testNullOnIgnoreMethodsNames() throws Exception {
@@ -252,7 +253,8 @@ public void testAnonymousClass() throws Exception {
"16:24: " + getCheckMessage(MSG_KEY_METHOD, "method2", 2, 1),
};
- verify(checkConfig, getPath("InputReturnCountExtendedCheckAnonymousClasses.java"), expected);
+ verify(checkConfig, getPath("InputReturnCountExtendedCheckAnonymousClasses.java"),
+ expected);
}
@Test
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/SimpleAccessorNameNotationCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/SimpleAccessorNameNotationCheckTest.java
index 14c3016e25..9dadb49852 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/SimpleAccessorNameNotationCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/SimpleAccessorNameNotationCheckTest.java
@@ -34,7 +34,8 @@ public class SimpleAccessorNameNotationCheckTest extends BaseCheckTestSupport {
@Test
public void test() throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(SimpleAccessorNameNotationCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(SimpleAccessorNameNotationCheck.class);
checkConfig.addAttribute("prefix", "m");
@@ -52,7 +53,8 @@ public void test() throws Exception {
@Test
public void correctWithoutPrefix() throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(SimpleAccessorNameNotationCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(SimpleAccessorNameNotationCheck.class);
final String[] expected = {
"17: " + warningSetterMessage,
"22: " + warningGetterMessage,
@@ -62,7 +64,8 @@ public void correctWithoutPrefix() throws Exception {
@Test
public void correctWithtPrefix() throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(SimpleAccessorNameNotationCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(SimpleAccessorNameNotationCheck.class);
checkConfig.addAttribute("prefix", "m");
final String[] expected = {
"7: " + warningSetterMessage,
@@ -73,7 +76,8 @@ public void correctWithtPrefix() throws Exception {
@Test
public void partlyWithoutPrefix() throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(SimpleAccessorNameNotationCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(SimpleAccessorNameNotationCheck.class);
final String[] expected = {
"15: " + warningGetterMessage,
"20: " + warningSetterMessage,
@@ -87,7 +91,8 @@ public void partlyWithoutPrefix() throws Exception {
@Test
public void partlyWithPrefix() throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(SimpleAccessorNameNotationCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(SimpleAccessorNameNotationCheck.class);
checkConfig.addAttribute("prefix", "m");
final String[] expected = {
"10: " + warningSetterMessage,
@@ -102,7 +107,8 @@ public void partlyWithPrefix() throws Exception {
@Test
public void errorsWithoutPrefix() throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(SimpleAccessorNameNotationCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(SimpleAccessorNameNotationCheck.class);
final String[] expected = {
"7: " + warningSetterMessage,
"12: " + warningGetterMessage,
@@ -114,7 +120,8 @@ public void errorsWithoutPrefix() throws Exception {
@Test
public void errorsWithPrefix() throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(SimpleAccessorNameNotationCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(SimpleAccessorNameNotationCheck.class);
checkConfig.addAttribute("prefix", "m");
final String[] expected = {
"7: " + warningSetterMessage,
@@ -127,14 +134,16 @@ public void errorsWithPrefix() throws Exception {
@Test
public void cleanWithoutPrefix() throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(SimpleAccessorNameNotationCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(SimpleAccessorNameNotationCheck.class);
final String[] expected = {};
verify(checkConfig, getPath("InputSimpleAccessorNameNotationCheck4.java"), expected);
}
@Test
public void cleanWithPrefix() throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(SimpleAccessorNameNotationCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(SimpleAccessorNameNotationCheck.class);
checkConfig.addAttribute("prefix", "m");
final String[] expected = {};
verify(checkConfig, getPath("InputSimpleAccessorNameNotationCheck4.java"), expected);
@@ -142,7 +151,8 @@ public void cleanWithPrefix() throws Exception {
@Test
public void testBoolean() throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(SimpleAccessorNameNotationCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(SimpleAccessorNameNotationCheck.class);
final String[] expected = {
"28: " + warningSetterMessage,
"33: " + warningGetterMessage,
@@ -152,14 +162,16 @@ public void testBoolean() throws Exception {
@Test
public void testAnonymousCases() throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(SimpleAccessorNameNotationCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(SimpleAccessorNameNotationCheck.class);
final String[] expected = {};
verify(checkConfig, getPath("InputSimpleAccessorNameNotationCheck6.java"), expected);
}
@Test
public void testInterface() throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(SimpleAccessorNameNotationCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(SimpleAccessorNameNotationCheck.class);
final String[] expected = {};
verify(checkConfig, getPath("InputSimpleAccessorNameNotationCheck7.java"), expected);
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/SingleBreakOrContinueCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/SingleBreakOrContinueCheckTest.java
index 8bb1868dfb..8b8e4c24ed 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/SingleBreakOrContinueCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/SingleBreakOrContinueCheckTest.java
@@ -39,7 +39,8 @@ public class SingleBreakOrContinueCheckTest extends BaseCheckTestSupport {
@Test
public void testDefault()
throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(SingleBreakOrContinueCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(SingleBreakOrContinueCheck.class);
final String[] expected = {
"8: " + warningMessage,
"26: " + warningMessage,
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/TernaryPerExpressionCountCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/TernaryPerExpressionCountCheckTest.java
index a1fc19b8df..fbd26f4809 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/TernaryPerExpressionCountCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/TernaryPerExpressionCountCheckTest.java
@@ -33,7 +33,8 @@
*/
public class TernaryPerExpressionCountCheckTest extends BaseCheckTestSupport {
- private final DefaultConfiguration checkConfig = createCheckConfig(TernaryPerExpressionCountCheck.class);
+ private final DefaultConfiguration checkConfig =
+ createCheckConfig(TernaryPerExpressionCountCheck.class);
@Test
public void testWithDefaultTernaryPerExpressionCountValue()
@@ -84,8 +85,10 @@ public void testWithNegativeTernaryPerExpressionCountValue()
catch (CheckstyleException ex) {
final String errorMsg = ex.getMessage();
Assert.assertTrue(errorMsg
- .contains("Cannot set property 'maxTernaryPerExpressionCount' to '-1' in module "
- + "com.github.sevntu.checkstyle.checks.coding.TernaryPerExpressionCountCheck"));
+ .contains("Cannot set property 'maxTernaryPerExpressionCount' "
+ + "to '-1' in module "
+ + "com.github.sevntu.checkstyle.checks.coding."
+ + "TernaryPerExpressionCountCheck"));
}
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UnnecessaryParenthesesExtendedCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UnnecessaryParenthesesExtendedCheckTest.java
index e37a918fda..d5a0e74d25 100755
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UnnecessaryParenthesesExtendedCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UnnecessaryParenthesesExtendedCheckTest.java
@@ -98,7 +98,8 @@ public void testDefault() throws Exception {
@Test
public void test15Extensions() throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(UnnecessaryParenthesesExtendedCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(UnnecessaryParenthesesExtendedCheck.class);
final String[] expected = {};
checkConfig.addAttribute("ignoreCalculationOfBooleanVariables", "false");
checkConfig.addAttribute("ignoreCalculationOfBooleanVariablesWithReturn", "false");
@@ -108,7 +109,8 @@ public void test15Extensions() throws Exception {
@Test
public void testUbv() throws Exception {
- final DefaultConfiguration checkConfig = createCheckConfig(UnnecessaryParenthesesExtendedCheck.class);
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(UnnecessaryParenthesesExtendedCheck.class);
final String[] expected = {
"5:22: " + getCheckMessage(MSG_KEY_ASSIGN),
"5:29: " + getCheckMessage(MSG_KEY_EXPR),
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UselessSuperCtorCallCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UselessSuperCtorCallCheckTest.java
index 5bc40c2890..f311dc0455 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UselessSuperCtorCallCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UselessSuperCtorCallCheckTest.java
@@ -28,7 +28,8 @@
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
public class UselessSuperCtorCallCheckTest extends BaseCheckTestSupport {
- private final DefaultConfiguration mDefaultConfig = createCheckConfig(UselessSuperCtorCallCheck.class);
+ private final DefaultConfiguration mDefaultConfig =
+ createCheckConfig(UselessSuperCtorCallCheck.class);
@Test
public void testSingleCtorWithSuperWithinNotDerivedClass()
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/WhitespaceBeforeArrayInitializerCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/WhitespaceBeforeArrayInitializerCheckTest.java
index e2dee8be51..ea7d29a43c 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/WhitespaceBeforeArrayInitializerCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/WhitespaceBeforeArrayInitializerCheckTest.java
@@ -27,7 +27,8 @@
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
public class WhitespaceBeforeArrayInitializerCheckTest extends BaseCheckTestSupport {
- private final DefaultConfiguration mDefaultConfig = createCheckConfig(WhitespaceBeforeArrayInitializerCheck.class);
+ private final DefaultConfiguration mDefaultConfig =
+ createCheckConfig(WhitespaceBeforeArrayInitializerCheck.class);
@Test
public void testWhitespaceBeforeArrayInitializer() throws Exception {
@@ -38,6 +39,7 @@ public void testWhitespaceBeforeArrayInitializer() throws Exception {
"17:21: " + getCheckMessage(MSG_KEY),
"24:56: " + getCheckMessage(MSG_KEY),
};
- verify(mDefaultConfig, getPath("InputWhitespaceBeforeArrayInitializerCheck.java"), expected);
+ verify(mDefaultConfig, getPath("InputWhitespaceBeforeArrayInitializerCheck.java"),
+ expected);
}
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/CauseParameterInExceptionCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/CauseParameterInExceptionCheckTest.java
index 775110e4be..415a825888 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/CauseParameterInExceptionCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/CauseParameterInExceptionCheckTest.java
@@ -34,7 +34,8 @@
* Yaroslavtsev
*/
public class CauseParameterInExceptionCheckTest extends BaseCheckTestSupport {
- private final DefaultConfiguration checkConfig = createCheckConfig(CauseParameterInExceptionCheck.class);
+ private final DefaultConfiguration checkConfig =
+ createCheckConfig(CauseParameterInExceptionCheck.class);
@Test
public void testNormalWork() throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ChildBlockLengthCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ChildBlockLengthCheckTest.java
index 28e685f1ab..920b3eb268 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ChildBlockLengthCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ChildBlockLengthCheckTest.java
@@ -68,7 +68,8 @@ public void testManyBadChildBlocks() throws Exception {
"15:15: " + getCheckMessage(MSG_KEY, 13, 5),
};
- verify(checkConfig, getPath("InputChildBlockLengthCheckManyBlocksOnOneScope.java"), expected);
+ verify(checkConfig, getPath("InputChildBlockLengthCheckManyBlocksOnOneScope.java"),
+ expected);
}
@Test
@@ -83,7 +84,8 @@ public void testManyBadChildBlocks2() throws Exception {
"31:15: " + getCheckMessage(MSG_KEY, 5, 4),
};
- verify(checkConfig, getPath("InputChildBlockLengthCheckManyBlocksOnOneScope.java"), expected);
+ verify(checkConfig, getPath("InputChildBlockLengthCheckManyBlocksOnOneScope.java"),
+ expected);
}
@Test
@@ -111,7 +113,8 @@ public void testIgnoreBlockLinesCountOption() throws Exception {
final String[] expected = {
};
- verify(checkConfig, getPath("InputChildBlockLengthCheckManyBlocksOnOneScope.java"), expected);
+ verify(checkConfig, getPath("InputChildBlockLengthCheckManyBlocksOnOneScope.java"),
+ expected);
}
@Test
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ConstructorWithoutParamsCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ConstructorWithoutParamsCheckTest.java
index 788d5605d8..8cbd438682 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ConstructorWithoutParamsCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ConstructorWithoutParamsCheckTest.java
@@ -39,8 +39,11 @@ public void getDefaultConfiguration() {
@Test
public void testDefaultConfigProhibitsExceptionsWithoutParams() throws Exception {
- final String[] expectedViolationMsg = {"35:37: " + getCheckMessage(MSG_KEY, "RuntimeException")};
- verify(defaultConfig, getPath("InputConstructorWithoutParamsCheck.java"), expectedViolationMsg);
+ final String[] expectedViolationMsg = {
+ "35:37: " + getCheckMessage(MSG_KEY, "RuntimeException"),
+ };
+ verify(defaultConfig, getPath("InputConstructorWithoutParamsCheck.java"),
+ expectedViolationMsg);
}
@Test
@@ -51,7 +54,8 @@ public void testUserDefinedConfigProhibitsCustomClasses() throws Exception {
"69:27: " + getCheckMessage(MSG_KEY, "Clazz1"),
"72:27: " + getCheckMessage(MSG_KEY, "Clazz2"),
};
- verify(defaultConfig, getPath("InputConstructorWithoutParamsCheck.java"), expectedViolationMsg);
+ verify(defaultConfig, getPath("InputConstructorWithoutParamsCheck.java"),
+ expectedViolationMsg);
}
/*
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/StaticMethodCandidateCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/StaticMethodCandidateCheckTest.java
index d605e977a2..2e0f0b919c 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/StaticMethodCandidateCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/StaticMethodCandidateCheckTest.java
@@ -57,7 +57,8 @@ public void testSkippedMethods() throws Exception {
createCheckConfig(StaticMethodCandidateCheck.class);
checkConfig.addAttribute("skippedMethods", "foo, bar,foobar");
final String[] expected = {};
- verify(checkConfig, getPath("InputStaticMethodCandidateCheckSkippedMethods.java"), expected);
+ verify(checkConfig, getPath("InputStaticMethodCandidateCheckSkippedMethods.java"),
+ expected);
}
@Test
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/ChecksTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/ChecksTest.java
index 447f347604..43d0b746cb 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/ChecksTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/ChecksTest.java
@@ -47,7 +47,8 @@
public final class ChecksTest {
private static final Set CHECK_PROPERTIES = getProperties(AbstractCheck.class);
- private static final Set JAVADOC_CHECK_PROPERTIES = getProperties(AbstractJavadocCheck.class);
+ private static final Set JAVADOC_CHECK_PROPERTIES =
+ getProperties(AbstractJavadocCheck.class);
private static final Set FILESET_PROPERTIES = getProperties(AbstractFileSetCheck.class);
@Test
@@ -271,33 +272,38 @@ private static void validateEclipseCsMetaXmlFileRule(String packge, Class> mod
case "description":
Assert.assertEquals(
packge + " checkstyle-metadata.xml requires a valid description for "
- + moduleName, "%" + moduleName + ".desc", child.getTextContent());
+ + moduleName, "%" + moduleName + ".desc",
+ child.getTextContent());
break;
case "property-metadata":
final String propertyName = attributes.getNamedItem("name").getTextContent();
- Assert.assertTrue(packge + " checkstyle-metadata.xml has an unknown parameter for "
+ Assert.assertTrue(packge
+ + " checkstyle-metadata.xml has an unknown parameter for "
+ moduleName + ": " + propertyName, properties.remove(propertyName));
final Node firstChild = child.getFirstChild().getNextSibling();
Assert.assertNotNull(packge
- + " checkstyle-metadata.xml requires atleast one child for " + moduleName
- + ", " + propertyName, firstChild);
+ + " checkstyle-metadata.xml requires atleast one child for "
+ + moduleName + ", " + propertyName, firstChild);
Assert.assertEquals(
packge
- + " checkstyle-metadata.xml should have a description for the first child of "
+ + " checkstyle-metadata.xml should have a description for the "
+ + "first child of "
+ moduleName + ", " + propertyName, "description",
firstChild.getNodeName());
Assert.assertEquals(packge
- + " checkstyle-metadata.xml requires a valid description for " + moduleName
- + ", " + propertyName, "%" + moduleName + "." + propertyName,
+ + " checkstyle-metadata.xml requires a valid description for "
+ + moduleName + ", " + propertyName, "%" + moduleName + "."
+ + propertyName,
firstChild.getTextContent());
break;
case "message-key":
final String key = attributes.getNamedItem("key").getTextContent();
- Assert.assertTrue(packge + " checkstyle-metadata.xml has an unknown message for "
+ Assert.assertTrue(packge
+ + " checkstyle-metadata.xml has an unknown message for "
+ moduleName + ": " + key, messages.remove(key));
break;
default:
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckstyleRegressionTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckstyleRegressionTest.java
index 9249db4c96..a0452218bd 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckstyleRegressionTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckstyleRegressionTest.java
@@ -121,7 +121,8 @@ private static void work(File config, File suppression) throws Exception {
Files.write(config.toPath(), configContents.getBytes(UTF_8), StandardOpenOption.CREATE);
if (!suppressionAdditions.isEmpty()) {
- String suppressionContents = new String(Files.readAllBytes(suppression.toPath()), UTF_8);
+ String suppressionContents = new String(Files.readAllBytes(suppression.toPath()),
+ UTF_8);
final int position = suppressionContents.lastIndexOf("
-
From c2835bd80310a33e79447aa5e22d1b527372e0b7 Mon Sep 17 00:00:00 2001
From: rnveach
Date: Tue, 26 Sep 2017 10:27:07 -0400
Subject: [PATCH 116/208] Issue #525: removed unnecessary suppressions
---
sevntu-checks/suppressions.xml | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/sevntu-checks/suppressions.xml b/sevntu-checks/suppressions.xml
index 37f1570bdc..9b5a43a13c 100644
--- a/sevntu-checks/suppressions.xml
+++ b/sevntu-checks/suppressions.xml
@@ -24,8 +24,6 @@
-
-
@@ -39,14 +37,11 @@
-
+
-
-
-
From 3b9593ae87eb294c4dc96b972a3e86e0c2486c30 Mon Sep 17 00:00:00 2001
From: rnveach
Date: Tue, 26 Sep 2017 10:44:16 -0400
Subject: [PATCH 117/208] Issue #525: removed return count suppression and
fixed violations
---
.../annotation/ForbidAnnotationCheck.java | 7 ++--
.../coding/CustomDeclarationOrderCheck.java | 5 +--
.../coding/EmptyPublicCtorInClassCheck.java | 14 +++++---
.../coding/FinalizeImplementationCheck.java | 5 +--
.../ForbidReturnInFinallyBlockCheck.java | 4 +--
.../MapIterationInForEachLoopCheck.java | 24 +++++++++-----
.../MultipleStringLiteralsExtendedCheck.java | 6 ++--
...meConventionForJunit4TestClassesCheck.java | 12 ++++---
.../NumericLiteralNeedsUnderscoreCheck.java | 32 +++++++++----------
.../UnnecessaryParenthesesExtendedCheck.java | 8 +++--
.../checkstyle/BaseCheckTestSupport.java | 6 ++--
.../sevntu/checkstyle/internal/CheckUtil.java | 8 +++--
.../sevntu/checkstyle/internal/XmlUtil.java | 5 +--
sevntu-checks/suppressions.xml | 1 -
14 files changed, 85 insertions(+), 52 deletions(-)
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationCheck.java
index e0c4b7b810..2b36af2885 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationCheck.java
@@ -123,15 +123,18 @@ && isForbiddenAnnotationTarget(targetType)) {
* @return The name of the annotation.
*/
private static String getAnnotationName(DetailAST annotation) {
+ final String result;
final DetailAST directname = annotation.findFirstToken(TokenTypes.IDENT);
if (directname != null) {
- return directname.getText();
+ result = directname.getText();
}
else {
//This means that annotation is specified with the full package name
- return annotation.findFirstToken(TokenTypes.DOT).getLastChild().getText();
+ result = annotation.findFirstToken(TokenTypes.DOT).getLastChild().getText();
}
+
+ return result;
}
/**
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheck.java
index 85900008de..3cc1f24724 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheck.java
@@ -877,11 +877,12 @@ private static String getNameWithoutPrefix(String name, String prefix) {
* @return identifier of AST, null if AST does not have name.
*/
private static String getIdentifier(final DetailAST ast) {
+ String result = null;
final DetailAST ident = ast.findFirstToken(TokenTypes.IDENT);
if (ident != null) {
- return ident.getText();
+ result = ident.getText();
}
- return null;
+ return result;
}
/**
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EmptyPublicCtorInClassCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EmptyPublicCtorInClassCheck.java
index a5715f4e25..22f24eed61 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EmptyPublicCtorInClassCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EmptyPublicCtorInClassCheck.java
@@ -418,15 +418,18 @@ private static boolean isOnDemandImport(String importTargetName) {
*/
private static String
joinSingleTypeImportWithIdentifier(String importEntry, String identifierName) {
+ final String result;
final String importEntryLastPart = getSimpleIdentifierNameFromQualifiedName(importEntry);
final String annotationNameFirstPart = getQualifiedNameFirstPart(identifierName);
if (importEntryLastPart.equals(annotationNameFirstPart)) {
- return importEntry + identifierName.substring(annotationNameFirstPart.length());
+ result = importEntry + identifierName.substring(annotationNameFirstPart.length());
}
else {
- return null;
+ result = null;
}
+
+ return result;
}
/**
@@ -475,14 +478,17 @@ private static boolean isOnDemandImport(String importTargetName) {
* argument.
*/
private static String getQualifiedNameFirstPart(String canonicalName) {
+ final String result;
final int firstDotIndex = canonicalName.indexOf('.');
if (firstDotIndex == -1) {
- return canonicalName;
+ result = canonicalName;
}
else {
- return canonicalName.substring(0, firstDotIndex);
+ result = canonicalName.substring(0, firstDotIndex);
}
+
+ return result;
}
/**
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/FinalizeImplementationCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/FinalizeImplementationCheck.java
index 2db3962cd5..6aadd1d7dc 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/FinalizeImplementationCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/FinalizeImplementationCheck.java
@@ -218,14 +218,15 @@ private static int getParamsCount(DetailAST methodDefToken) {
* @return true, if method has super.finalize() call.
*/
private static boolean containsSuperFinalizeCall(DetailAST openingBrace) {
+ boolean result = false;
final DetailAST methodCallToken = openingBrace.getFirstChild().getFirstChild();
if (methodCallToken != null && methodCallToken.getType() == TokenTypes.METHOD_CALL) {
final DetailAST dotToken = methodCallToken.getFirstChild();
if (dotToken.getType() == TokenTypes.DOT
&& dotToken.findFirstToken(TokenTypes.LITERAL_SUPER) != null) {
- return true;
+ result = true;
}
}
- return false;
+ return result;
}
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidReturnInFinallyBlockCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidReturnInFinallyBlockCheck.java
index 6adaf53011..928ced933a 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidReturnInFinallyBlockCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidReturnInFinallyBlockCheck.java
@@ -20,7 +20,6 @@
package com.github.sevntu.checkstyle.checks.coding;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
@@ -86,7 +85,8 @@ private List getReturnNodes(DetailAST node) {
DetailAST child = node.getFirstChild();
while (child != null) {
if (child.getType() == TokenTypes.LITERAL_RETURN) {
- return Collections.singletonList(child);
+ result.add(child);
+ break;
}
result.addAll(getReturnNodes(child));
child = child.getNextSibling();
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MapIterationInForEachLoopCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MapIterationInForEachLoopCheck.java
index 0da95e5a88..a3cba7a789 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MapIterationInForEachLoopCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MapIterationInForEachLoopCheck.java
@@ -442,14 +442,16 @@ private DetailAST getKeySetOrEntrySetNode(DetailAST forEachNode) {
* @return true, if any Method Call contains Map Parameter.
*/
private boolean isMapPassedIntoAnyMethod(DetailAST forEachOpeningBraceNode) {
+ boolean result = false;
final List methodCallNodeList = getSubTreeNodesOfType(
forEachOpeningBraceNode, TokenTypes.METHOD_CALL);
for (DetailAST methodCallNode : methodCallNodeList) {
if (hasMapAsParameter(methodCallNode)) {
- return true;
+ result = true;
+ break;
}
}
- return false;
+ return result;
}
/**
@@ -661,13 +663,15 @@ private boolean isClassContainsInsideQualifiedImportList(String className) {
* if class name is missed, returns null.
*/
private static String getClassName(final List literaNewNodesList) {
+ String result = null;
for (DetailAST literalNewNode : literaNewNodesList) {
final DetailAST exprNode = literalNewNode.getParent();
if (exprNode.getParent().getType() == TokenTypes.ASSIGN) {
- return literalNewNode.getFirstChild().getText();
+ result = literalNewNode.getFirstChild().getText();
+ break;
}
}
- return null;
+ return result;
}
/**
@@ -681,12 +685,14 @@ private static String getClassName(final List literaNewNodesList) {
*/
private static DetailAST getFirstNodeOfType(List nodesList,
int aSpecificType) {
+ DetailAST result = null;
for (DetailAST node : nodesList) {
if (node.getType() == aSpecificType) {
- return node;
+ result = node;
+ break;
}
}
- return null;
+ return result;
}
/**
@@ -697,14 +703,16 @@ private static DetailAST getFirstNodeOfType(List nodesList,
* @return full path of map implementation or null.
*/
private String getMapImportQualifiedName(DetailAST importNode) {
+ String result = null;
final String mapClassQualifiedName = FullIdent.createFullIdent(
importNode.getFirstChild()).getText();
for (String qualifiedName : supportedMapImplQualifiedNames) {
if (mapClassQualifiedName.equals(qualifiedName)) {
- return mapClassQualifiedName;
+ result = mapClassQualifiedName;
+ break;
}
}
- return null;
+ return result;
}
/**
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MultipleStringLiteralsExtendedCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MultipleStringLiteralsExtendedCheck.java
index 9538ba89f3..aff08f8b1f 100755
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MultipleStringLiteralsExtendedCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MultipleStringLiteralsExtendedCheck.java
@@ -173,15 +173,17 @@ public void visitToken(DetailAST ast) {
* {@link #ignoreOccurrenceContext}.
*/
private boolean isInIgnoreOccurrenceContext(DetailAST ast) {
+ boolean result = false;
DetailAST token = ast.getParent();
while (token != null) {
final int type = token.getType();
if (ignoreOccurrenceContext.get(type)) {
- return true;
+ result = true;
+ break;
}
token = token.getParent();
}
- return false;
+ return result;
}
@Override
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NameConventionForJunit4TestClassesCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NameConventionForJunit4TestClassesCheck.java
index ab057dfae5..693d05396c 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NameConventionForJunit4TestClassesCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NameConventionForJunit4TestClassesCheck.java
@@ -232,19 +232,21 @@ private boolean isClassDefinitionAnnotated(DetailAST classDefNode) {
* defined annotation
*/
private boolean isAtleastOneMethodAnnotated(DetailAST classDefNode) {
+ boolean result = false;
DetailAST classMemberNode =
classDefNode.findFirstToken(TokenTypes.OBJBLOCK).getFirstChild();
while (classMemberNode != null) {
if (classMemberNode.getType() == TokenTypes.METHOD_DEF
&& hasAnnotation(classMemberNode, methodAnnotationNameRegex)) {
- return true;
+ result = true;
+ break;
}
classMemberNode = classMemberNode.getNextSibling();
}
- return false;
+ return result;
}
/**
@@ -341,11 +343,13 @@ private static String getIdentifierName(DetailAST identifierNode) {
* against regex.
*/
private static boolean isMatchesRegex(Pattern regexPattern, String str) {
+ final boolean result;
if (regexPattern != null) {
- return regexPattern.matcher(str).matches();
+ result = regexPattern.matcher(str).matches();
}
else {
- return false;
+ result = false;
}
+ return result;
}
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NumericLiteralNeedsUnderscoreCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NumericLiteralNeedsUnderscoreCheck.java
index f5a5892833..bbbdbdd17c 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NumericLiteralNeedsUnderscoreCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NumericLiteralNeedsUnderscoreCheck.java
@@ -552,23 +552,23 @@ else if ("0b".equals(prefix)) {
*/
private static boolean numericSegmentPassesRequirement(String numericSegment,
int minLength, int symbolsUntilUnderscore) {
- if (numericSegment.length() < minLength) {
- return true;
- }
- final char underscore = '_';
- int symbolCount = 0;
boolean passes = true;
- for (int i = 0; i < numericSegment.length(); i++) {
- final char current = numericSegment.charAt(i);
- if (symbolCount >= symbolsUntilUnderscore && current != underscore) {
- passes = false;
- break;
- }
- if (current == underscore) {
- symbolCount = 0;
- }
- else {
- symbolCount++;
+ if (numericSegment.length() >= minLength) {
+ final char underscore = '_';
+ int symbolCount = 0;
+
+ for (int i = 0; i < numericSegment.length(); i++) {
+ final char current = numericSegment.charAt(i);
+ if (symbolCount >= symbolsUntilUnderscore && current != underscore) {
+ passes = false;
+ break;
+ }
+ if (current == underscore) {
+ symbolCount = 0;
+ }
+ else {
+ symbolCount++;
+ }
}
}
return passes;
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UnnecessaryParenthesesExtendedCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UnnecessaryParenthesesExtendedCheck.java
index d77bce6d6f..0b1619c3a3 100755
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UnnecessaryParenthesesExtendedCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UnnecessaryParenthesesExtendedCheck.java
@@ -324,10 +324,14 @@ private static boolean inTokenList(int type, int[] tokens) {
* MAX_QUOTED_LENGTH; otherwise aString.
*/
private static String chopString(String string) {
+ final String result;
if (string.length() > MAX_QUOTED_LENGTH) {
- return string.substring(0, MAX_QUOTED_LENGTH) + "...\"";
+ result = string.substring(0, MAX_QUOTED_LENGTH) + "...\"";
}
- return string;
+ else {
+ result = string;
+ }
+ return result;
}
/**
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/BaseCheckTestSupport.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/BaseCheckTestSupport.java
index 22e58ce462..7fcb7ff230 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/BaseCheckTestSupport.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/BaseCheckTestSupport.java
@@ -144,14 +144,16 @@ protected String getPath(String filename) {
* @param messageKey the key of message in 'messages.properties' file.
*/
public String getCheckMessage(String messageKey) {
+ String result;
final Properties pr = new Properties();
try {
pr.load(getClass().getResourceAsStream("messages.properties"));
+ result = pr.getProperty(messageKey);
}
catch (IOException ex) {
- return null;
+ result = null;
}
- return pr.getProperty(messageKey);
+ return result;
}
/**
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckUtil.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckUtil.java
index 01b628b795..c2164ad6bb 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckUtil.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckUtil.java
@@ -282,14 +282,16 @@ private static boolean isFileFilterModule(Class> loadedClass, String className
*/
public static String getCheckMessage(Class> module, String messageKey,
Object... arguments) {
+ String result;
final Properties pr = new Properties();
try {
pr.load(module.getResourceAsStream("messages.properties"));
+ final MessageFormat formatter = new MessageFormat(pr.getProperty(messageKey));
+ result = formatter.format(arguments);
}
catch (IOException ex) {
- return null;
+ result = null;
}
- final MessageFormat formatter = new MessageFormat(pr.getProperty(messageKey));
- return formatter.format(arguments);
+ return result;
}
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/XmlUtil.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/XmlUtil.java
index 00a589a781..9ac557a17a 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/XmlUtil.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/XmlUtil.java
@@ -41,6 +41,7 @@ private XmlUtil() {
public static Document getRawXml(String fileName, String code, String unserializedSource)
throws ParserConfigurationException {
+ Document rawXml = null;
try {
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(false);
@@ -48,14 +49,14 @@ public static Document getRawXml(String fileName, String code, String unserializ
final DocumentBuilder builder = factory.newDocumentBuilder();
- return builder.parse(new InputSource(new StringReader(code)));
+ rawXml = builder.parse(new InputSource(new StringReader(code)));
}
catch (IOException | SAXException ex) {
Assert.fail(fileName + " has invalid xml (" + ex.getMessage() + "): "
+ unserializedSource);
}
- return null;
+ return rawXml;
}
public static Set getChildrenElements(Node node) {
diff --git a/sevntu-checks/suppressions.xml b/sevntu-checks/suppressions.xml
index 9b5a43a13c..16b7937feb 100644
--- a/sevntu-checks/suppressions.xml
+++ b/sevntu-checks/suppressions.xml
@@ -20,7 +20,6 @@
-
From a6533b8fc2c0052c183a71fe58d72e147390099a Mon Sep 17 00:00:00 2001
From: rnveach
Date: Tue, 26 Sep 2017 10:48:28 -0400
Subject: [PATCH 118/208] Issue #525: removed javadoc package suppression and
fixed violations
---
.../checkstyle/checks/sizes/package-info.java | 24 +++++++++++++++++++
.../sevntu/checkstyle/package-info.java | 24 +++++++++++++++++++
sevntu-checks/suppressions.xml | 1 -
3 files changed, 48 insertions(+), 1 deletion(-)
create mode 100644 sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/sizes/package-info.java
create mode 100644 sevntu-checks/src/main/java/com/github/sevntu/checkstyle/package-info.java
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/sizes/package-info.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/sizes/package-info.java
new file mode 100644
index 0000000000..7053240875
--- /dev/null
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/sizes/package-info.java
@@ -0,0 +1,24 @@
+////////////////////////////////////////////////////////////////////////////////
+// checkstyle: Checks Java source code for adherence to a set of rules.
+// Copyright (C) 2001-2017 the original author or authors.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Contains the Size checks
+ * that are bundled with the main distribution.
+ */
+package com.github.sevntu.checkstyle.checks.sizes;
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/package-info.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/package-info.java
new file mode 100644
index 0000000000..9dc6a0f74b
--- /dev/null
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/package-info.java
@@ -0,0 +1,24 @@
+////////////////////////////////////////////////////////////////////////////////
+// checkstyle: Checks Java source code for adherence to a set of rules.
+// Copyright (C) 2001-2017 the original author or authors.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Contains the miscellaneous utilities that are bundled with the main distribution.
+ */
+package com.github.sevntu.checkstyle;
+
diff --git a/sevntu-checks/suppressions.xml b/sevntu-checks/suppressions.xml
index 16b7937feb..a5aca9e391 100644
--- a/sevntu-checks/suppressions.xml
+++ b/sevntu-checks/suppressions.xml
@@ -18,7 +18,6 @@
-
From ad73cfbef965caf4750b3b95b1ca8ed314063a5b Mon Sep 17 00:00:00 2001
From: rnveach
Date: Tue, 26 Sep 2017 10:53:28 -0400
Subject: [PATCH 119/208] Issue #525: removed boolean complexity suppression
and fixed violations
---
.../design/ForbidWildcardAsReturnTypeCheck.java | 17 +++++++++++++----
sevntu-checks/suppressions.xml | 1 -
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ForbidWildcardAsReturnTypeCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ForbidWildcardAsReturnTypeCheck.java
index 04273ac985..e15a91de18 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ForbidWildcardAsReturnTypeCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ForbidWildcardAsReturnTypeCheck.java
@@ -210,10 +210,7 @@ public int[] getRequiredTokens() {
@Override
public void visitToken(DetailAST methodDefAst) {
final String methodScope = getVisibilityScope(methodDefAst);
- if (((checkPublicMethods && "public".equals(methodScope))
- || (checkPrivateMethods && "private".equals(methodScope))
- || (checkProtectedMethods && "protected".equals(methodScope))
- || (checkPackageMethods && "package".equals(methodScope)))
+ if (isCheckableMethodScope(methodScope)
&& (checkOverrideMethods
|| (!AnnotationUtility.containsAnnotation(methodDefAst, OVERRIDE)
&& !AnnotationUtility.containsAnnotation(methodDefAst, FQ_OVERRIDE)))
@@ -230,6 +227,18 @@ public void visitToken(DetailAST methodDefAst) {
}
}
+ /**
+ * Checks if the method scope is defined as one of the types to check.
+ * @param methodScope The string version of the scope.
+ * @return {@code true} if the method should be checked.
+ */
+ private boolean isCheckableMethodScope(String methodScope) {
+ return (checkPublicMethods && "public".equals(methodScope))
+ || (checkPrivateMethods && "private".equals(methodScope))
+ || (checkProtectedMethods && "protected".equals(methodScope))
+ || (checkPackageMethods && "package".equals(methodScope));
+ }
+
/**
* Returns the visibility scope of method.
* @param methodDefAst DetailAST of method definition.
diff --git a/sevntu-checks/suppressions.xml b/sevntu-checks/suppressions.xml
index a5aca9e391..25b804f529 100644
--- a/sevntu-checks/suppressions.xml
+++ b/sevntu-checks/suppressions.xml
@@ -17,7 +17,6 @@
-
From dfda43e1cf434db88c4eaf187cdcad6e7443319d Mon Sep 17 00:00:00 2001
From: Roman Ivanov
Date: Sat, 7 Oct 2017 16:07:34 -0700
Subject: [PATCH 120/208] config: bump checkstyle version
---
sevntu-checks/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml
index 4632d41698..8027aed8f6 100644
--- a/sevntu-checks/pom.xml
+++ b/sevntu-checks/pom.xml
@@ -16,7 +16,7 @@
iso-8859-1
- 8.2
+ 8.3https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.version}/config/checkstyle_checks.xml7.6
From 63bf474081741c51ed090ad47c60570d497c5d06 Mon Sep 17 00:00:00 2001
From: rnveach
Date: Mon, 23 Oct 2017 16:21:58 -0400
Subject: [PATCH 121/208] Issue #616: add eclipse violation check as a maven
plugin
---
.travis.yml | 6 +++
sevntu-checks/.ci/eclipse-compiler-javac.sh | 42 +++++++++++++++++++++
sevntu-checks/pom.xml | 27 +++++++++++++
3 files changed, 75 insertions(+)
create mode 100755 sevntu-checks/.ci/eclipse-compiler-javac.sh
diff --git a/.travis.yml b/.travis.yml
index f2d4c0f2a2..c96613deda 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -69,6 +69,12 @@ matrix:
- CMD3=" && cd ../ && cd checkstyle && mvn clean verify -e -DskipTests -DskipITs -Dpmd.skip=true -Dfindbugs.skip=true -Dcobertura.skip=true"
- CMD=$CMD0$CMD1$CMD2$CMD3
+ # eclipse static analysis
+ - jdk: oraclejdk8
+ env:
+ - DESC="eclipse static analysis
+ - CMD="cd sevntu-checks && mvn clean compile exec:exec -Peclipse-compiler"
+
# testing of PR format
- env:
- DESC="test Issue ref in PR description"
diff --git a/sevntu-checks/.ci/eclipse-compiler-javac.sh b/sevntu-checks/.ci/eclipse-compiler-javac.sh
new file mode 100755
index 0000000000..256e3e03ec
--- /dev/null
+++ b/sevntu-checks/.ci/eclipse-compiler-javac.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+set -e
+
+if [ -z "$1" ]; then
+ echo "No parameters supplied!"
+ echo " The classpath of the project and it's libraries to compile must be supplied."
+ exit 1
+fi
+if [ -z "$2" ]; then
+ echo "Second parameter not supplied!"
+ echo " The checkstyle release name must be supplied as the second parameter."
+ exit 1
+fi
+
+ECJ_JAR="ecj-4.7.jar"
+ECJ_MAVEN_VERSION="R-4.7-201706120950"
+ECJ_PATH=~/.m2/repository/$ECJ_MAVEN_VERSION/$ECJ_JAR
+
+if [ ! -f $ECJ_PATH ]; then
+ echo "$ECJ_PATH is not found, downloading ..."
+ mkdir -p $(dirname "$ECJ_PATH")
+ wget http://ftp-stud.fht-esslingen.de/pub/Mirrors/eclipse/eclipse/downloads/drops4/$ECJ_MAVEN_VERSION/$ECJ_JAR -O $ECJ_PATH
+fi
+
+wget https://github.com/checkstyle/checkstyle/blob/checkstyle-$2/config/org.eclipse.jdt.core.prefs
+
+mkdir -p target/classes
+mkdir -p target/eclipse
+
+RESULT_FILE=target/eclipse/report.txt
+
+echo "Executing eclipse compiler, output is redirected to $RESULT_FILE..."
+java -jar $ECJ_PATH -target 1.8 -source 1.8 -cp $1 \
+ -d target/eclipse-compile \
+ -enableJavadoc src/main/java src/test/java -properties org.eclipse.jdt.core.prefs \
+ > $RESULT_FILE 2>&1 | true
+
+echo "Checking for ERROR|WARNING|INFO in $RESULT_FILE ..."
+if [[ $(grep -E "ERROR|WARNING|INFO" $RESULT_FILE | cat | wc -l) > 0 ]]; then
+ cat $RESULT_FILE
+ false
+fi
diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml
index 8027aed8f6..9e853a757b 100644
--- a/sevntu-checks/pom.xml
+++ b/sevntu-checks/pom.xml
@@ -270,6 +270,33 @@
+
+ eclipse-compiler
+
+
+ org.eclipse.jdt
+ org.eclipse.jdt.annotation
+ 2.1.0
+
+
+
+
+
+ org.codehaus.mojo
+ exec-maven-plugin
+ 1.6.0
+
+ .ci/eclipse-compiler-javac.sh
+ test
+
+
+ ${checkstyle.version}
+
+
+
+
+
+ no-validations
From 773d09de53bdc2e23d97e47587a1074daf8676bf Mon Sep 17 00:00:00 2001
From: rnveach
Date: Tue, 24 Oct 2017 00:00:08 -0400
Subject: [PATCH 122/208] Issue #616: fixed violations from eclipse violation
check
---
.../checkstyle/checks/coding/ForbidCCommentsInMethodsCheck.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidCCommentsInMethodsCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidCCommentsInMethodsCheck.java
index 0dd833e6b0..28acd6535d 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidCCommentsInMethodsCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidCCommentsInMethodsCheck.java
@@ -62,7 +62,7 @@ public int[] getRequiredTokens() {
@Override
public void beginTree(DetailAST rootAST) {
- clangComments = getFileContents().getCComments().keySet();
+ clangComments = getFileContents().getBlockComments().keySet();
}
@Override
From 9bd0ebe62458bec239b2f2225bd30b6f960536d9 Mon Sep 17 00:00:00 2001
From: rnveach
Date: Mon, 23 Oct 2017 15:00:02 -0400
Subject: [PATCH 123/208] Issue #525: removed modified control suppression and
fixed violations
---
.../AvoidNotShortCircuitOperatorsForBooleanCheck.java | 8 --------
sevntu-checks/suppressions.xml | 1 -
2 files changed, 9 deletions(-)
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidNotShortCircuitOperatorsForBooleanCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidNotShortCircuitOperatorsForBooleanCheck.java
index 44cdd2baf3..aa7b76fd2e 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidNotShortCircuitOperatorsForBooleanCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidNotShortCircuitOperatorsForBooleanCheck.java
@@ -209,10 +209,6 @@ public final List getSupportedOperandsNames(
&& currentNode.getParent().getType() != TokenTypes.DOT) {
supportedOperands.add(currentNode.getText());
}
-
- if (currentNode.getNextSibling() != null) {
- currentNode = currentNode.getNextSibling();
- }
}
return supportedOperands;
}
@@ -238,10 +234,6 @@ public final boolean hasTrueOrFalseLiteral(final DetailAST parentAST) {
hasTrueOrFalseLiteral = true;
}
- if (currentNode.getNextSibling() != null) {
- currentNode = currentNode.getNextSibling();
- }
-
if (hasTrueOrFalseLiteral) {
break;
}
diff --git a/sevntu-checks/suppressions.xml b/sevntu-checks/suppressions.xml
index 25b804f529..374b28e399 100644
--- a/sevntu-checks/suppressions.xml
+++ b/sevntu-checks/suppressions.xml
@@ -12,7 +12,6 @@
-
From 4e5fe72c1e269152977874c46d18571cce89de15 Mon Sep 17 00:00:00 2001
From: Roman Ivanov
Date: Sun, 29 Oct 2017 07:29:59 -0700
Subject: [PATCH 124/208] config: bump checkstyle version
---
sevntu-checks/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml
index 9e853a757b..e1b1455ef4 100644
--- a/sevntu-checks/pom.xml
+++ b/sevntu-checks/pom.xml
@@ -16,7 +16,7 @@
iso-8859-1
- 8.3
+ 8.4https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.version}/config/checkstyle_checks.xml7.6
From 0a5df296a721263373584f583eaa8bd0451d8673 Mon Sep 17 00:00:00 2001
From: Roman Ivanov
Date: Sun, 29 Oct 2017 07:47:20 -0700
Subject: [PATCH 125/208] config: update to fully qualified names, details are
at checkstyle/checkstyle#4456
---
sevntu-checks/sevntu-checks.xml | 116 ++++++++++++++++----------------
1 file changed, 58 insertions(+), 58 deletions(-)
diff --git a/sevntu-checks/sevntu-checks.xml b/sevntu-checks/sevntu-checks.xml
index 96c0955519..90b18c16ee 100644
--- a/sevntu-checks/sevntu-checks.xml
+++ b/sevntu-checks/sevntu-checks.xml
@@ -20,56 +20,56 @@
-
+
-
+
-
-
+
+
-
-
+
+
-
+
-
-
+
+
-
+
-
+
-
-
-
-
-
+
+
+
+
+
@@ -80,26 +80,26 @@
-
+
-
-
+
+
-
+
-
-
+
+
-
+
@@ -107,38 +107,38 @@
-
-
+
+
-
-
+
+
-
+
-
-
+
+
-
+
-
+
-
+
-
-
+
+
@@ -147,22 +147,22 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
-
+
@@ -173,34 +173,34 @@
-
-
-
+
+
+
-
+
-
-
-
-
-
+
+
+
+
+
-
+
-
+
-
+
-
+
@@ -212,7 +212,7 @@
From ca33c1f536da131f0fdd0fef486032bedbcdb832 Mon Sep 17 00:00:00 2001
From: Roman Ivanov
Date: Sun, 29 Oct 2017 08:22:34 -0700
Subject: [PATCH 126/208] config: update to fully qualified names, details are
at checkstyle/checkstyle#4456
---
.../com/github/sevntu/checkstyle/internal/AllChecksTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/AllChecksTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/AllChecksTest.java
index 224e3a4dfd..0d38664f93 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/AllChecksTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/AllChecksTest.java
@@ -300,7 +300,7 @@ private static void verifyInputFile(Map> allTests, File fil
* @return a set of simple names.
*/
private static Set getFullNames(Set> checks) {
- return checks.stream().map(check -> check.getName().replace("Check", ""))
+ return checks.stream().map(check -> check.getName())
.collect(Collectors.toSet());
}
From 8b34b335853a50dd770fd3222c92e5aa75924c41 Mon Sep 17 00:00:00 2001
From: Roman Ivanov
Date: Thu, 9 Nov 2017 13:11:46 -0800
Subject: [PATCH 127/208] minor: add link to import-control-test.xml
---
sevntu-checks/checkstyle.properties | 1 +
1 file changed, 1 insertion(+)
diff --git a/sevntu-checks/checkstyle.properties b/sevntu-checks/checkstyle.properties
index 6b8f3fc973..9ca9648368 100644
--- a/sevntu-checks/checkstyle.properties
+++ b/sevntu-checks/checkstyle.properties
@@ -2,3 +2,4 @@ checkstyle.suppressions.file=suppressions.xml
checkstyle.header.file=https://raw.githubusercontent.com/checkstyle/checkstyle/master/config/java.header
checkstyle.regexp.header.file=https://raw.githubusercontent.com/checkstyle/checkstyle/master/config/java_regexp.header
checkstyle.importcontrol.file=import-control.xml
+checkstyle.importcontroltest.file=https://raw.githubusercontent.com/checkstyle/checkstyle/master/config/import-control-test.xml
From cbb18c9bafa6e28373b8d3216a7151e6d5d5c18d Mon Sep 17 00:00:00 2001
From: rnveach
Date: Thu, 26 Oct 2017 14:47:25 -0400
Subject: [PATCH 128/208] Issue #618: added RequireFailForTryCatchInJunitCheck
---
.../coding/checkstyle-metadata.properties | 3 +
.../checks/coding/checkstyle-metadata.xml | 7 +
sevntu-checks/sevntu-checks.xml | 1 +
.../RequireFailForTryCatchInJunitCheck.java | 246 ++++++++++++++++++
.../checks/coding/messages.properties | 1 +
...equireFailForTryCatchInJunitCheckTest.java | 107 ++++++++
...utRequireFailForTryCatchInJunitCheck1.java | 48 ++++
...utRequireFailForTryCatchInJunitCheck2.java | 14 +
...utRequireFailForTryCatchInJunitCheck3.java | 94 +++++++
...utRequireFailForTryCatchInJunitCheck4.java | 25 ++
...utRequireFailForTryCatchInJunitCheck5.java | 58 +++++
.../sonar/checkstyle-extensions.xml | 8 +
12 files changed, 612 insertions(+)
create mode 100644 sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/RequireFailForTryCatchInJunitCheck.java
create mode 100644 sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/RequireFailForTryCatchInJunitCheckTest.java
create mode 100644 sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRequireFailForTryCatchInJunitCheck1.java
create mode 100644 sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRequireFailForTryCatchInJunitCheck2.java
create mode 100644 sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRequireFailForTryCatchInJunitCheck3.java
create mode 100644 sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRequireFailForTryCatchInJunitCheck4.java
create mode 100644 sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRequireFailForTryCatchInJunitCheck5.java
diff --git a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/coding/checkstyle-metadata.properties b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/coding/checkstyle-metadata.properties
index c68322df03..990e5d59b1 100755
--- a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/coding/checkstyle-metadata.properties
+++ b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/coding/checkstyle-metadata.properties
@@ -180,3 +180,6 @@ WhitespaceBeforeArrayInitializerCheck.desc = This checks enforces whitespace bef
MoveVariableInsideIfCheck.name = Move Variable Inside If Check
MoveVariableInsideIfCheck.desc = Checks if a variable is only used inside if statements and asks for it's declaration to be moved there too.
+
+RequireFailForTryCatchInJunitCheck.name = Require Fail For Try/Catch in JUnit Check
+RequireFailForTryCatchInJunitCheck.desc = Checks if a try/catch block has a junit fail assertion inside the try for a junit method.
diff --git a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/coding/checkstyle-metadata.xml b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/coding/checkstyle-metadata.xml
index 5e930c3902..4d10db211f 100644
--- a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/coding/checkstyle-metadata.xml
+++ b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/coding/checkstyle-metadata.xml
@@ -536,5 +536,12 @@
+
+
+ %RequireFailForTryCatchInJunitCheck.desc
+
+
+
+
diff --git a/sevntu-checks/sevntu-checks.xml b/sevntu-checks/sevntu-checks.xml
index 90b18c16ee..931a3ecc1d 100644
--- a/sevntu-checks/sevntu-checks.xml
+++ b/sevntu-checks/sevntu-checks.xml
@@ -154,6 +154,7 @@
+
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/RequireFailForTryCatchInJunitCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/RequireFailForTryCatchInJunitCheck.java
new file mode 100644
index 0000000000..b09257198d
--- /dev/null
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/RequireFailForTryCatchInJunitCheck.java
@@ -0,0 +1,246 @@
+////////////////////////////////////////////////////////////////////////////////
+// checkstyle: Checks Java source code for adherence to a set of rules.
+// Copyright (C) 2001-2017 the original author or authors.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+////////////////////////////////////////////////////////////////////////////////
+
+package com.github.sevntu.checkstyle.checks.coding;
+
+import com.github.sevntu.checkstyle.Utils;
+import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
+import com.puppycrawl.tools.checkstyle.api.DetailAST;
+import com.puppycrawl.tools.checkstyle.api.FullIdent;
+import com.puppycrawl.tools.checkstyle.api.TokenTypes;
+import com.puppycrawl.tools.checkstyle.utils.AnnotationUtility;
+
+/**
+ *
+ * Checks if a try/catch block has a junit fail assertion inside the try for a junit method.
+ *
+ *
+ * Rationale: Tests should not complete the try block naturally if they are expecting a failure.
+ * If the try completes normally the test will pass successfully and skip over any assertions in
+ * the catch block.
+ * If tests are not expecting exceptions, then they should remove the catch block and propagate
+ * the exception to the junit caller which will display the full exception to the user.
+ *
+ *
+ * A junit test method is identified by the annotations placed on it. It is only considered a junit
+ * method if it contains the annotation 'org.junit.Test'. This check doesn't examine methods called
+ * by a test method. It must contain the annotation. Failures are identified by the
+ * method call to the method 'org.junit.Assert.fail'.
+ *
+ *
+ * An example of how to configure the check is:
+ *
+ * which will cause a violation in the example below:
+ *
+ *
+ * @Test
+ * public void testMyCase() {
+ * try { // violation here as try block has no 'Assert.fail()'.
+ * verifySomeResult();
+ * }
+ * catch (IllegalArgumentException ex) {
+ * assertEquals("expected exception message",
+ * "Some message that is expected", ex.getMessage());
+ * }
+ * }
+ *
+ * @author Richard Veach
+ */
+public class RequireFailForTryCatchInJunitCheck extends AbstractCheck {
+ /**
+ * Violation message key.
+ */
+ public static final String MSG_KEY = "require.fail";
+
+ /**
+ * Fully qualified junit test annotation.
+ */
+ private static final String FQ_JUNIT_TEST = "org.junit.Test";
+ /**
+ * JUnit's fail assertion method name.
+ */
+ private static final String FAIL = "fail";
+
+ /**
+ * {@code true} if the junit test is imported.
+ */
+ private boolean importTest;
+ /**
+ * {@code true} if the junit assert is imported.
+ */
+ private boolean importAssert;
+ /**
+ * {@code true} if the junit fail assertion method is statically imported.
+ */
+ private boolean importStaticFail;
+
+ @Override
+ public int[] getDefaultTokens() {
+ return getRequiredTokens();
+ }
+
+ @Override
+ public int[] getAcceptableTokens() {
+ return getRequiredTokens();
+ }
+
+ @Override
+ public int[] getRequiredTokens() {
+ return new int[] {
+ TokenTypes.IMPORT,
+ TokenTypes.STATIC_IMPORT,
+ TokenTypes.LITERAL_TRY,
+ };
+ }
+
+ @Override
+ public void beginTree(DetailAST rootAST) {
+ importTest = false;
+ importAssert = false;
+ importStaticFail = false;
+ }
+
+ @Override
+ public void visitToken(DetailAST ast) {
+ switch (ast.getType()) {
+ case TokenTypes.IMPORT:
+ final String imprt = getImportText(ast);
+
+ if (FQ_JUNIT_TEST.equals(imprt)) {
+ importTest = true;
+ }
+ if ("org.junit.Assert".equals(imprt)) {
+ importAssert = true;
+ }
+ break;
+ case TokenTypes.STATIC_IMPORT:
+ final String staticImprt = getImportText(ast);
+
+ if ("org.junit.Assert.fail".equals(staticImprt)) {
+ importStaticFail = true;
+ }
+ break;
+ case TokenTypes.LITERAL_TRY:
+ examineTry(ast);
+ break;
+ default:
+ Utils.reportInvalidToken(ast.getType());
+ break;
+ }
+ }
+
+ /**
+ * Examines the try block for violations.
+ * @param ast The try block to examine.
+ */
+ private void examineTry(DetailAST ast) {
+ final DetailAST method = getMethod(ast);
+
+ if (isTestMethod(method)
+ && ast.findFirstToken(TokenTypes.LITERAL_CATCH) != null) {
+ final DetailAST last = ast.findFirstToken(TokenTypes.SLIST).getLastChild()
+ .getPreviousSibling();
+
+ if (last == null
+ || last.getType() != TokenTypes.SEMI
+ || !isValidFail(last.getPreviousSibling())) {
+ log(ast, MSG_KEY);
+ }
+ }
+ }
+
+ /**
+ * Checks if the given method is a test method, defined by the junit annotation Test.
+ * @param method the method AST to examine.
+ * @return {@code true} if the method is a test method.
+ */
+ private boolean isTestMethod(DetailAST method) {
+ return method != null
+ && ((importTest && AnnotationUtility.containsAnnotation(method, "Test"))
+ || AnnotationUtility.containsAnnotation(method, FQ_JUNIT_TEST));
+ }
+
+ /**
+ * Checks if the expression is an junit fail assertion.
+ * @param expression The expression to examine.
+ * @return {@code true} if the expression is a valid junit fail assertion.
+ */
+ private boolean isValidFail(DetailAST expression) {
+ boolean result = false;
+
+ if (expression.getFirstChild().getType() == TokenTypes.METHOD_CALL) {
+ final DetailAST ident = expression.getFirstChild().getFirstChild();
+
+ if (importAssert && ident.getType() == TokenTypes.DOT) {
+ final DetailAST firstChild = ident.getFirstChild();
+
+ result = "Assert".equals(firstChild.getText())
+ && FAIL.equals(firstChild.getNextSibling().getText());
+ }
+ else if (importStaticFail) {
+ result = FAIL.equals(ident.getText());
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Retrieves the method definition AST parent from the specified node, as long as it doesn't
+ * contain a lambda.
+ * @param node The node to examine.
+ * @return The parent method definition.
+ */
+ private static DetailAST getMethod(DetailAST node) {
+ DetailAST result = null;
+
+ for (DetailAST token = node.getParent(); token != null; token = token.getParent()) {
+ final int type = token.getType();
+ if (type == TokenTypes.METHOD_DEF) {
+ result = token;
+ }
+ if (type == TokenTypes.METHOD_DEF || type == TokenTypes.LAMBDA) {
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Returns import text.
+ *
+ * @param ast ast node that represents import
+ * @return String that represents importing class
+ */
+ private static String getImportText(DetailAST ast) {
+ final FullIdent imp;
+ if (ast.getType() == TokenTypes.IMPORT) {
+ imp = FullIdent.createFullIdentBelow(ast);
+ }
+ else {
+ imp = FullIdent.createFullIdent(ast.getFirstChild().getNextSibling());
+ }
+ return imp.getText();
+ }
+}
diff --git a/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/coding/messages.properties b/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/coding/messages.properties
index afb68173ff..216612d9ff 100644
--- a/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/coding/messages.properties
+++ b/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/coding/messages.properties
@@ -40,6 +40,7 @@ numeric.literal.need.underscore=Numeric literal should have underscores.
overridable.method=Overridable method ''{0}'' is called in {1} body.
overridable.method.leads=Calling the method ''{0}'' in {1} body leads to the call of the overridable method ''{2}''.
redundant.return.check=Redundant return.
+require.fail=try/catch either requires a fail at the end of the try clause for junit tests or to remove the try/catch completely.
return.count.extended.method=Return count for ''{0}'' method is {1} (max allowed is {2}).
return.count.extended.ctor=Return count for ''{0}'' constructor is {1} (max allowed is {2}).
return.count.extended.lambda=Return count for the lambda is {0} (max allowed is {1}).
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/RequireFailForTryCatchInJunitCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/RequireFailForTryCatchInJunitCheckTest.java
new file mode 100644
index 0000000000..6741d55aad
--- /dev/null
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/RequireFailForTryCatchInJunitCheckTest.java
@@ -0,0 +1,107 @@
+////////////////////////////////////////////////////////////////////////////////
+// checkstyle: Checks Java source code for adherence to a set of rules.
+// Copyright (C) 2001-2017 the original author or authors.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+////////////////////////////////////////////////////////////////////////////////
+
+package com.github.sevntu.checkstyle.checks.coding;
+
+import static com.github.sevntu.checkstyle.checks.coding.RequireFailForTryCatchInJunitCheck.MSG_KEY;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
+import com.puppycrawl.tools.checkstyle.api.DetailAST;
+import com.puppycrawl.tools.checkstyle.api.TokenTypes;
+import com.puppycrawl.tools.checkstyle.utils.CommonUtils;
+
+public class RequireFailForTryCatchInJunitCheckTest extends BaseCheckTestSupport {
+ @Test
+ public void testIndifferent1() throws Exception {
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(RequireFailForTryCatchInJunitCheck.class);
+ final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
+ verify(checkConfig, getPath("InputRequireFailForTryCatchInJunitCheck1.java"), expected);
+ }
+
+ @Test
+ public void testIndifferent2() throws Exception {
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(RequireFailForTryCatchInJunitCheck.class);
+ final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
+ verify(checkConfig, getPath("InputRequireFailForTryCatchInJunitCheck2.java"), expected);
+ }
+
+ @Test
+ public void testBad1() throws Exception {
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(RequireFailForTryCatchInJunitCheck.class);
+ final String[] expected = {
+ "8:9: " + getCheckMessage(MSG_KEY),
+ "12:9: " + getCheckMessage(MSG_KEY),
+ "18:9: " + getCheckMessage(MSG_KEY),
+ "23:9: " + getCheckMessage(MSG_KEY),
+ "28:9: " + getCheckMessage(MSG_KEY),
+ "33:9: " + getCheckMessage(MSG_KEY),
+ "42:9: " + getCheckMessage(MSG_KEY),
+ "46:9: " + getCheckMessage(MSG_KEY),
+ "52:9: " + getCheckMessage(MSG_KEY),
+ "57:9: " + getCheckMessage(MSG_KEY),
+ "62:9: " + getCheckMessage(MSG_KEY),
+ "67:9: " + getCheckMessage(MSG_KEY),
+ "76:9: " + getCheckMessage(MSG_KEY),
+ };
+ verify(checkConfig, getPath("InputRequireFailForTryCatchInJunitCheck3.java"), expected);
+ }
+
+ @Test
+ public void testBad2() throws Exception {
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(RequireFailForTryCatchInJunitCheck.class);
+ final String[] expected = {
+ "9:9: " + getCheckMessage(MSG_KEY),
+ "14:9: " + getCheckMessage(MSG_KEY),
+ };
+ verify(checkConfig, getPath("InputRequireFailForTryCatchInJunitCheck4.java"), expected);
+ }
+
+ @Test
+ public void testGood() throws Exception {
+ final DefaultConfiguration checkConfig =
+ createCheckConfig(RequireFailForTryCatchInJunitCheck.class);
+ final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
+ verify(checkConfig, getPath("InputRequireFailForTryCatchInJunitCheck5.java"), expected);
+ }
+
+ @Test
+ public void testUnsupportedNode() {
+ final DetailAST sync = new DetailAST();
+ sync.setType(TokenTypes.LITERAL_SYNCHRONIZED);
+
+ try {
+ final RequireFailForTryCatchInJunitCheck check =
+ new RequireFailForTryCatchInJunitCheck();
+ check.visitToken(sync);
+
+ fail();
+ }
+ catch (IllegalArgumentException ex) {
+ Assert.assertEquals("Found unsupported token: LITERAL_SYNCHRONIZED", ex.getMessage());
+ }
+ }
+}
diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRequireFailForTryCatchInJunitCheck1.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRequireFailForTryCatchInJunitCheck1.java
new file mode 100644
index 0000000000..e262e3ab80
--- /dev/null
+++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRequireFailForTryCatchInJunitCheck1.java
@@ -0,0 +1,48 @@
+package com.github.sevntu.checkstyle.checks.coding;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class InputRequireFailForTryCatchInJunitCheck1 {
+ static {
+ }
+
+ static {
+ try {
+ }
+ catch (Exception e) {
+ }
+ }
+
+ public void method1() {
+ }
+
+ public void method2() {
+ try {
+ }
+ catch (Exception e) {
+ }
+ }
+
+ @Test
+ public void method3() {
+ }
+
+ @Test
+ public void method4() throws Exception {
+ try {
+ }
+ finally {
+ }
+ try (MyAutoClosable test = new MyAutoClosable()) {
+ test.close();
+ }
+ }
+}
+
+class MyAutoClosable implements AutoCloseable {
+ @Override
+ public void close() throws Exception {
+ }
+}
diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRequireFailForTryCatchInJunitCheck2.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRequireFailForTryCatchInJunitCheck2.java
new file mode 100644
index 0000000000..d502eb6171
--- /dev/null
+++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRequireFailForTryCatchInJunitCheck2.java
@@ -0,0 +1,14 @@
+package com.github.sevntu.checkstyle.checks.coding;
+
+public class InputRequireFailForTryCatchInJunitCheck2 {
+ @Test
+ public void method() {
+ try {
+ }
+ catch (Exception e) {
+ }
+ }
+}
+
+@interface Test {
+}
diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRequireFailForTryCatchInJunitCheck3.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRequireFailForTryCatchInJunitCheck3.java
new file mode 100644
index 0000000000..b2cc1c7ae6
--- /dev/null
+++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRequireFailForTryCatchInJunitCheck3.java
@@ -0,0 +1,94 @@
+package com.github.sevntu.checkstyle.checks.coding;
+
+import org.junit.Test;
+
+public class InputRequireFailForTryCatchInJunitCheck3 {
+ @Test
+ public void method1() throws Exception {
+ try {
+ }
+ catch (Exception e) {
+ }
+ try {
+ for (int a = 0; a < 5; a++) {
+ }
+ }
+ catch (Exception e) {
+ }
+ try {
+ method1();
+ }
+ catch (Exception e) {
+ }
+ try {
+ InputRequireFailForTryCatchInJunitCheck3.method();
+ }
+ catch (Exception e) {
+ }
+ try {
+ fail("message");
+ }
+ catch (Exception e) {
+ }
+ try {
+ Assert.fail("message");
+ }
+ catch (Exception e) {
+ }
+ }
+
+ @org.junit.Test
+ public void method2() throws Exception {
+ try {
+ }
+ catch (Exception e) {
+ }
+ try {
+ for (int a = 0; a < 5; a++) {
+ }
+ }
+ catch (Exception e) {
+ }
+ try {
+ method2();
+ }
+ catch (Exception e) {
+ }
+ try {
+ InputRequireFailForTryCatchInJunitCheck3.method();
+ }
+ catch (Exception e) {
+ }
+ try {
+ fail("message");
+ }
+ catch (Exception e) {
+ }
+ try {
+ Assert.fail("message");
+ }
+ catch (Exception e) {
+ }
+ }
+
+ @Test
+ public void method3() throws Exception {
+ try {
+ int a = 0;
+ a++;
+ }
+ catch (Exception e) {
+ }
+ }
+
+ public static void method() {
+ }
+
+ public static void fail(String s) {
+ }
+
+ public static class Assert {
+ public static void fail(String s) {
+ }
+ }
+}
diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRequireFailForTryCatchInJunitCheck4.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRequireFailForTryCatchInJunitCheck4.java
new file mode 100644
index 0000000000..36fd214de7
--- /dev/null
+++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRequireFailForTryCatchInJunitCheck4.java
@@ -0,0 +1,25 @@
+package com.github.sevntu.checkstyle.checks.coding;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class InputRequireFailForTryCatchInJunitCheck4 {
+ @Test
+ public void method1() throws Exception {
+ try {
+ Assert.assertEquals("", "");
+ }
+ catch (Exception e) {
+ }
+ try {
+ Dummy.fail();
+ }
+ catch (Exception e) {
+ }
+ }
+
+ public static class Dummy {
+ public static void fail() {
+ }
+ }
+}
diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRequireFailForTryCatchInJunitCheck5.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRequireFailForTryCatchInJunitCheck5.java
new file mode 100644
index 0000000000..47cc619ec1
--- /dev/null
+++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRequireFailForTryCatchInJunitCheck5.java
@@ -0,0 +1,58 @@
+package com.github.sevntu.checkstyle.checks.coding;
+
+import static org.junit.Assert.fail;
+
+import java.util.function.Consumer;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class InputRequireFailForTryCatchInJunitCheck5 {
+ @Test
+ public void method1() throws Exception {
+ try {
+ Assert.fail();
+ }
+ catch (Exception e) {
+ }
+ try {
+ fail();
+ }
+ catch (Exception e) {
+ }
+
+ final Consumer
diff --git a/sevntu-checkstyle-idea-extension/pom.xml b/sevntu-checkstyle-idea-extension/pom.xml
index 31d76fb777..1bedc43fb8 100644
--- a/sevntu-checkstyle-idea-extension/pom.xml
+++ b/sevntu-checkstyle-idea-extension/pom.xml
@@ -11,7 +11,7 @@
com.github.sevntu-checkstylesevntu-checkstyle-idea-extension
- 1.24.2
+ 1.25.0jarSevntu Checkstyle Idea extension
diff --git a/sevntu-checkstyle-maven-plugin/pom.xml b/sevntu-checkstyle-maven-plugin/pom.xml
index ad89acc5a4..48f14556e6 100644
--- a/sevntu-checkstyle-maven-plugin/pom.xml
+++ b/sevntu-checkstyle-maven-plugin/pom.xml
@@ -12,7 +12,7 @@
com.github.sevntu-checkstylesevntu-checkstyle-maven-pluginSevntu Checkstyle Maven Plugin
- 1.24.2
+ 1.25.0
@@ -25,7 +25,7 @@
com.github.sevntu-checkstylesevntu-checks
- 1.24.2
+ 1.25.0org.apache.maven.plugins
diff --git a/sevntu-checkstyle-sonar-plugin/pom.xml b/sevntu-checkstyle-sonar-plugin/pom.xml
index d5e4d93978..df32bfefe1 100644
--- a/sevntu-checkstyle-sonar-plugin/pom.xml
+++ b/sevntu-checkstyle-sonar-plugin/pom.xml
@@ -11,7 +11,7 @@
com.github.sevntu-checkstylesevntu-checkstyle-sonar-plugin
- 1.24.2
+ 1.25.0sonar-pluginSevNTU Checkstyle Sonar Extension Plugin
diff --git a/update-site/pom.xml b/update-site/pom.xml
index 56103d22ef..30d41bdb7a 100644
--- a/update-site/pom.xml
+++ b/update-site/pom.xml
@@ -7,7 +7,7 @@
../eclipse-pom.xmlcom.github.sevntu-checkstyleparent
- 1.24.2
+ 1.25.0com.github.sevntu.checkstyle.p2updatesite
From 47cdae23ae4c3a2bf4d77c2690da4873e4c70fb6 Mon Sep 17 00:00:00 2001
From: Roman Ivanov
Date: Sun, 26 Nov 2017 07:14:54 -0800
Subject: [PATCH 134/208] config: checkstyle version bump
---
sevntu-checks/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml
index ff9085797d..47ea1ddebf 100644
--- a/sevntu-checks/pom.xml
+++ b/sevntu-checks/pom.xml
@@ -16,7 +16,7 @@
iso-8859-1
- 8.4
+ 8.5https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.version}/config/checkstyle_checks.xml7.6
From dd174342be66e8ca4133e37f945dded2f7ace3d1 Mon Sep 17 00:00:00 2001
From: Roman Ivanov
Date: Thu, 14 Dec 2017 14:49:23 -0800
Subject: [PATCH 135/208] config: set autoReleaseAfterClose=true for
sonatype-staging plugin
---
sevntu-checks/pom.xml | 2 +-
sevntu-checkstyle-idea-extension/pom.xml | 2 +-
sevntu-checkstyle-maven-plugin/pom.xml | 2 +-
sevntu-checkstyle-sonar-plugin/pom.xml | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml
index 47ea1ddebf..1a1381ea27 100644
--- a/sevntu-checks/pom.xml
+++ b/sevntu-checks/pom.xml
@@ -130,7 +130,7 @@
-->
sonatype-nexus-staginghttps://oss.sonatype.org/
- false
+ truetrue
diff --git a/sevntu-checkstyle-idea-extension/pom.xml b/sevntu-checkstyle-idea-extension/pom.xml
index 1bedc43fb8..94ee500246 100644
--- a/sevntu-checkstyle-idea-extension/pom.xml
+++ b/sevntu-checkstyle-idea-extension/pom.xml
@@ -82,7 +82,7 @@
-->
sonatype-nexus-staginghttps://oss.sonatype.org/
- false
+ truetrue
diff --git a/sevntu-checkstyle-maven-plugin/pom.xml b/sevntu-checkstyle-maven-plugin/pom.xml
index 48f14556e6..0109386f96 100644
--- a/sevntu-checkstyle-maven-plugin/pom.xml
+++ b/sevntu-checkstyle-maven-plugin/pom.xml
@@ -77,7 +77,7 @@
-->
sonatype-nexus-staginghttps://oss.sonatype.org/
- false
+ truetrue
diff --git a/sevntu-checkstyle-sonar-plugin/pom.xml b/sevntu-checkstyle-sonar-plugin/pom.xml
index df32bfefe1..ab1a7c91c7 100644
--- a/sevntu-checkstyle-sonar-plugin/pom.xml
+++ b/sevntu-checkstyle-sonar-plugin/pom.xml
@@ -93,7 +93,7 @@
-->
sonatype-nexus-staginghttps://oss.sonatype.org/
- false
+ truetrue
From 7e1b156c231f5826080d2b0ec5aff2e461d0b521 Mon Sep 17 00:00:00 2001
From: Pavel Bludov
Date: Fri, 15 Dec 2017 10:50:23 +0800
Subject: [PATCH 136/208] minor: fix blank lines in the blocks
---
.../com/github/sevntu/checkstyle/Utils.java | 2 ++
.../annotation/ForbidAnnotationCheck.java | 3 +-
.../ForbidAnnotationElementValueCheck.java | 2 ++
.../RequiredParameterForAnnotationCheck.java | 2 +-
...onstantAsFirstOperandInConditionCheck.java | 2 ++
...efaultSerializableInInnerClassesCheck.java | 4 +++
.../AvoidHidingCauseExceptionCheck.java | 10 +------
.../coding/AvoidModifiersForTypesCheck.java | 1 -
...tShortCircuitOperatorsForBooleanCheck.java | 7 -----
.../coding/ConfusingConditionCheck.java | 1 +
.../coding/CustomDeclarationOrderCheck.java | 19 ++++--------
...ondOperatorForVariableDefinitionCheck.java | 4 ---
.../checks/coding/EitherLogOrThrowCheck.java | 1 +
.../coding/EmptyPublicCtorInClassCheck.java | 3 +-
.../coding/FinalizeImplementationCheck.java | 4 +--
.../coding/ForbidCCommentsInMethodsCheck.java | 2 ++
.../coding/ForbidInstantiationCheck.java | 3 --
.../ForbidReturnInFinallyBlockCheck.java | 2 ++
.../ForbidThrowAnonymousExceptionsCheck.java | 1 +
.../coding/IllegalCatchExtendedCheck.java | 3 +-
.../LogicConditionNeedOptimizationCheck.java | 2 ++
.../MapIterationInForEachLoopCheck.java | 6 +---
.../coding/MoveVariableInsideIfCheck.java | 4 +++
.../MultipleStringLiteralsExtendedCheck.java | 3 ++
...ipleVariableDeclarationsExtendedCheck.java | 5 ++--
...meConventionForJunit4TestClassesCheck.java | 2 ++
.../NoNullForCollectionReturnCheck.java | 2 ++
.../NumericLiteralNeedsUnderscoreCheck.java | 2 ++
.../OverridableMethodInConstructorCheck.java | 24 ++-------------
.../checks/coding/RedundantReturnCheck.java | 16 +---------
.../RequireFailForTryCatchInJunitCheck.java | 2 ++
.../coding/ReturnBooleanFromTernaryCheck.java | 1 +
.../coding/ReturnCountExtendedCheck.java | 2 --
.../ReturnNullInsteadOfBooleanCheck.java | 1 +
.../SimpleAccessorNameNotationCheck.java | 21 ++------------
.../coding/SingleBreakOrContinueCheck.java | 1 +
.../TernaryPerExpressionCountCheck.java | 4 +--
.../UnnecessaryParenthesesExtendedCheck.java | 4 +--
.../coding/UselessSingleCatchCheck.java | 1 +
.../coding/UselessSuperCtorCallCheck.java | 1 +
...WhitespaceBeforeArrayInitializerCheck.java | 1 +
.../design/AvoidConditionInversionCheck.java | 29 ++-----------------
.../CauseParameterInExceptionCheck.java | 1 +
.../design/CheckstyleTestMakeupCheck.java | 2 ++
.../checks/design/ChildBlockLengthCheck.java | 3 --
.../design/ConstructorWithoutParamsCheck.java | 3 +-
.../ForbidWildcardAsReturnTypeCheck.java | 2 ++
.../HideUtilityClassConstructorCheck.java | 3 +-
.../checks/design/InnerClassCheck.java | 2 ++
.../checks/design/NestedSwitchCheck.java | 2 ++
.../NoMainMethodInAbstractClassCheck.java | 2 ++
.../PublicReferenceToPrivateTypeCheck.java | 5 +---
.../design/StaticMethodCandidateCheck.java | 3 ++
.../checks/naming/EnumValueNameCheck.java | 2 ++
.../InterfaceTypeParameterNameCheck.java | 1 +
.../naming/UniformEnumConstantNameCheck.java | 2 ++
.../checks/sizes/LineLengthExtendedCheck.java | 3 +-
.../checkstyle/BaseCheckTestSupport.java | 3 ++
.../github/sevntu/checkstyle/UtilsTest.java | 2 ++
.../annotation/ForbidAnnotationCheckTest.java | 1 +
...ForbidAnnotationElementValueCheckTest.java | 2 ++
...antAsFirstOperandInConditionCheckTest.java | 2 +-
...ltSerializableInInnerClassesCheckTest.java | 2 ++
.../AvoidModifiersForTypesCheckTest.java | 1 +
...rtCircuitOperatorsForBooleanCheckTest.java | 1 +
.../coding/ConfusingConditionCheckTest.java | 1 +
.../CustomDeclarationOrderCheckTest.java | 1 +
...peratorForVariableDefinitionCheckTest.java | 1 +
.../coding/EitherLogOrThrowCheckTest.java | 2 ++
.../EmptyPublicCtorInClassCheckTest.java | 2 ++
.../FinalizeImplementationCheckTest.java | 1 +
.../ForbidCCommentsInMethodsCheckTest.java | 3 +-
.../coding/ForbidCertainImportsCheckTest.java | 3 +-
.../coding/ForbidInstantiationCheckTest.java | 2 ++
.../ForbidReturnInFinallyBlockCheckTest.java | 2 ++
.../coding/IllegalCatchExtendedCheckTest.java | 1 +
...gicConditionNeedOptimizationCheckTest.java | 1 +
.../coding/MoveVariableInsideIfCheckTest.java | 2 ++
...ltipleStringLiteralsExtendedCheckTest.java | 1 +
...VariableDeclarationsExtendedCheckTest.java | 1 +
...nventionForJunit4TestClassesCheckTest.java | 2 ++
.../NoNullForCollectionReturnCheckTest.java | 1 +
...erridableMethodInConstructorCheckTest.java | 1 +
.../coding/RedundantReturnCheckTest.java | 5 +---
...equireFailForTryCatchInJunitCheckTest.java | 2 ++
.../ReturnBooleanFromTernaryCheckTest.java | 1 +
.../coding/ReturnCountExtendedCheckTest.java | 1 +
.../ReturnNullInsteadOfBooleanCheckTest.java | 1 +
.../SimpleAccessorNameNotationCheckTest.java | 1 +
...necessaryParenthesesExtendedCheckTest.java | 2 ++
.../coding/UselessSingleCatchCheckTest.java | 2 ++
.../coding/UselessSuperCtorCallCheckTest.java | 2 ++
...espaceBeforeArrayInitializerCheckTest.java | 2 ++
.../AvoidConditionInversionCheckTest.java | 1 +
.../CauseParameterInExceptionCheckTest.java | 2 ++
.../design/CheckstyleTestMakeupCheckTest.java | 2 ++
.../design/ChildBlockLengthCheckTest.java | 2 ++
.../ForbidWildcardAsReturnTypeCheckTest.java | 2 ++
.../HideUtilityClassConstructorCheckTest.java | 1 +
.../checks/design/InnerClassCheckTest.java | 1 +
.../checks/design/NestedSwitchCheckTest.java | 2 ++
.../NoMainMethodInAbstractClassCheckTest.java | 2 ++
...PublicReferenceToPrivateTypeCheckTest.java | 1 +
.../StaticMethodCandidateCheckTest.java | 1 +
.../checks/naming/EnumValueNameCheckTest.java | 2 ++
.../InterfaceTypeParameterNameCheckTest.java | 2 ++
.../UniformEnumConstantNameCheckTest.java | 1 +
.../sizes/LineLengthExtendedCheckTest.java | 2 ++
.../checkstyle/internal/AllChecksTest.java | 1 +
.../sevntu/checkstyle/internal/CheckUtil.java | 2 ++
.../checkstyle/internal/ChecksTest.java | 2 ++
.../internal/CheckstyleRegressionTest.java | 2 ++
.../internal/CommitValidationTest.java | 6 ++++
.../sevntu/checkstyle/internal/XmlUtil.java | 2 ++
.../sonar/CheckstyleExtensionPlugin.java | 1 +
.../sonar/CheckstyleExtensionRepository.java | 1 +
116 files changed, 187 insertions(+), 161 deletions(-)
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/Utils.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/Utils.java
index 10d94d2e1d..c45bf977dc 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/Utils.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/Utils.java
@@ -29,6 +29,7 @@
* @author Damian Szczepanik
*/
public final class Utils {
+
/** Prevent instances. */
private Utils() {
}
@@ -74,4 +75,5 @@ public static DetailAST getNextSubTreeNode(DetailAST node, DetailAST subTreeRoot
}
return toVisitAst;
}
+
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationCheck.java
index 2b36af2885..76a94d8f02 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationCheck.java
@@ -99,7 +99,6 @@ public int[] getRequiredTokens() {
@Override
public void visitToken(DetailAST annotation) {
-
final String annotationName = getAnnotationName(annotation);
// first parent - 'MODIFIERS', second parent - annotation's target
final DetailAST annotationTarget = annotation.getParent().getParent();
@@ -108,7 +107,6 @@ public void visitToken(DetailAST annotation) {
if (isRequiredAnnotationName(annotationName)
&& isForbiddenAnnotationTarget(targetType)) {
-
final String currentTarget = annotationTarget.getText();
log(annotation.getLineNo(), MSG_KEY,
@@ -154,4 +152,5 @@ private boolean isRequiredAnnotationName(String annotationName) {
private boolean isForbiddenAnnotationTarget(int targetType) {
return Arrays.binarySearch(annotationTargets, targetType) > -1;
}
+
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationElementValueCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationElementValueCheck.java
index 75e0ed78d5..71e5a69efd 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationElementValueCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationElementValueCheck.java
@@ -112,6 +112,7 @@
* @author Richard Veach
*/
public class ForbidAnnotationElementValueCheck extends AbstractCheck {
+
/** Message key. */
public static final String MSG_KEY = "annotation.forbid.element.value";
@@ -396,4 +397,5 @@ private static String getElementName(DetailAST memberValuePair) {
final DetailAST elementName = memberValuePair.findFirstToken(TokenTypes.IDENT);
return elementName.getText();
}
+
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/annotation/RequiredParameterForAnnotationCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/annotation/RequiredParameterForAnnotationCheck.java
index 774b70d7dc..b1aa57fbf8 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/annotation/RequiredParameterForAnnotationCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/annotation/RequiredParameterForAnnotationCheck.java
@@ -98,6 +98,7 @@
*/
public class RequiredParameterForAnnotationCheck extends AbstractCheck {
+
/**
* Key for error message.
*/
@@ -155,7 +156,6 @@ public void visitToken(DetailAST annotationNode) {
final String annotationNameCheck = getAnnotationName(annotationNode);
if (annotationNameCheck.equals(this.annotationName)) {
-
final Set missingParameters =
Sets.difference(requiredParameters, getAnnotationParameters(annotationNode));
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidConstantAsFirstOperandInConditionCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidConstantAsFirstOperandInConditionCheck.java
index 27247c2b5f..daccc13790 100755
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidConstantAsFirstOperandInConditionCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidConstantAsFirstOperandInConditionCheck.java
@@ -53,6 +53,7 @@
* @author Sergey Burtsev
*/
public class AvoidConstantAsFirstOperandInConditionCheck extends AbstractCheck {
+
/**
* A key is pointing to the warning message text in "messages.properties"
* file.
@@ -158,4 +159,5 @@ private static DetailAST[] getBothChildren(DetailAST logicNode) {
private boolean isTargetConstantType(int targetType) {
return Arrays.binarySearch(targetConstantTypes, targetType) > -1;
}
+
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidDefaultSerializableInInnerClassesCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidDefaultSerializableInInnerClassesCheck.java
index 56bbcdf1b6..434a0aef05 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidDefaultSerializableInInnerClassesCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidDefaultSerializableInInnerClassesCheck.java
@@ -35,6 +35,7 @@
* @author Ilia Dubinin
*/
public class AvoidDefaultSerializableInInnerClassesCheck extends AbstractCheck {
+
/**
* A key is pointing to the warning message text in "messages.properties"
* file.
@@ -226,6 +227,7 @@ private static boolean isSerializable(DetailAST classDefNode) {
*
*/
private final class SiblingIterator {
+
/**
*
*Next.
@@ -270,5 +272,7 @@ public DetailAST nextSibling() {
}
return result;
}
+
}
+
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidHidingCauseExceptionCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidHidingCauseExceptionCheck.java
index 2c5f296bef..172ea1fa5d 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidHidingCauseExceptionCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidHidingCauseExceptionCheck.java
@@ -65,6 +65,7 @@
* @author Ilja Dubinin
*/
public class AvoidHidingCauseExceptionCheck extends AbstractCheck {
+
/**
* A key is pointing to the warning message text in "messages.properties"
* file.
@@ -90,7 +91,6 @@ public int[] getRequiredTokens() {
@Override
public void visitToken(DetailAST detailAST) {
-
final String originExcName = detailAST
.findFirstToken(TokenTypes.PARAMETER_DEF).getLastChild()
.getText();
@@ -142,7 +142,6 @@ private static boolean isContainsCaughtExc(List throwParamNamesList,
private List buildThrowParamNamesList(DetailAST startNode,
List paramNamesAST) {
for (DetailAST currentNode : getChildNodes(startNode)) {
-
if (currentNode.getType() == TokenTypes.IDENT) {
paramNamesAST.add(currentNode);
}
@@ -152,7 +151,6 @@ private List buildThrowParamNamesList(DetailAST startNode,
&& currentNode.getNumberOfChildren() > 0) {
buildThrowParamNamesList(currentNode, paramNamesAST);
}
-
}
return paramNamesAST;
}
@@ -166,10 +164,8 @@ private List buildThrowParamNamesList(DetailAST startNode,
* @return null-safe list of LITERAL_THROW literals
*/
private List makeThrowList(DetailAST parentAST) {
-
final List throwList = new LinkedList<>();
for (DetailAST currentNode : getChildNodes(parentAST)) {
-
if (currentNode.getType() == TokenTypes.LITERAL_THROW) {
throwList.add(currentNode);
}
@@ -180,7 +176,6 @@ private List makeThrowList(DetailAST parentAST) {
&& currentNode.getNumberOfChildren() > 0) {
throwList.addAll(makeThrowList(currentNode));
}
-
}
return throwList;
}
@@ -201,11 +196,9 @@ private List makeExceptionsList(DetailAST currentCatchAST,
final List wrapExcNames = new LinkedList<>();
for (DetailAST currentNode : getChildNodes(parentAST)) {
-
if (currentNode.getType() == TokenTypes.IDENT
&& currentNode.getText().equals(currentExcName)
&& currentNode.getParent().getType() != TokenTypes.DOT) {
-
DetailAST temp = currentNode;
while (!temp.equals(currentCatchAST)
@@ -232,7 +225,6 @@ private List makeExceptionsList(DetailAST currentCatchAST,
wrapExcNames.addAll(makeExceptionsList(currentCatchAST,
currentNode, currentExcName));
}
-
}
return wrapExcNames;
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidModifiersForTypesCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidModifiersForTypesCheck.java
index 141b5d8088..f8ba8a5f2d 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidModifiersForTypesCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidModifiersForTypesCheck.java
@@ -399,7 +399,6 @@ public void visitToken(DetailAST ast) {
final String classNameAndPath = getClassNameAndPath(ast);
if (classNameAndPath != null) {
-
final String className = getClassName(classNameAndPath);
final Set modifiersSet = getModifiers(ast);
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidNotShortCircuitOperatorsForBooleanCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidNotShortCircuitOperatorsForBooleanCheck.java
index aa7b76fd2e..13c20a1c4c 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidNotShortCircuitOperatorsForBooleanCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidNotShortCircuitOperatorsForBooleanCheck.java
@@ -112,7 +112,6 @@ public int[] getRequiredTokens() {
@Override
public final void visitToken(final DetailAST detailAST) {
-
DetailAST currentNode = detailAST;
// look for EXPR which is always around BOR/BAND... operators
while (currentNode != null && currentNode.getType() != TokenTypes.EXPR) {
@@ -169,7 +168,6 @@ public final boolean isBooleanExpression(final DetailAST node) {
for (DetailAST currentNode : getChildren(curNode.getLastChild())) {
if (currentNode.getLineNo() < line
&& currentNode.getType() == TokenTypes.VARIABLE_DEF) {
-
if (isBooleanType(currentNode)) {
booleanVariablesNames.add(currentNode.findFirstToken(
TokenTypes.IDENT).getText());
@@ -178,7 +176,6 @@ public final boolean isBooleanExpression(final DetailAST node) {
}
boolean result = false;
-
for (String name : childNames) {
if (booleanVariablesNames.contains(name)) {
result = true;
@@ -197,9 +194,7 @@ public final boolean isBooleanExpression(final DetailAST node) {
*/
public final List getSupportedOperandsNames(
final DetailAST exprParentAST) {
-
for (DetailAST currentNode : getChildren(exprParentAST)) {
-
if (currentNode.getNumberOfChildren() > 0
&& currentNode.getType() != TokenTypes.METHOD_CALL) {
getSupportedOperandsNames(currentNode);
@@ -221,9 +216,7 @@ public final List getSupportedOperandsNames(
* "true" or "false" keywords and false otherwise.
*/
public final boolean hasTrueOrFalseLiteral(final DetailAST parentAST) {
-
for (DetailAST currentNode : getChildren(parentAST)) {
-
if (currentNode.getNumberOfChildren() > 0) {
hasTrueOrFalseLiteral(currentNode);
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ConfusingConditionCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ConfusingConditionCheck.java
index 57c7ca8aa7..b412837252 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ConfusingConditionCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ConfusingConditionCheck.java
@@ -61,6 +61,7 @@
* @author Vadim Panasiuk
*/
public class ConfusingConditionCheck extends AbstractCheck {
+
/**
* The key is pointing to the message text String in
* "messages.properties file".This message used for common cases.
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheck.java
index 3cc1f24724..1ce9f95ae1 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheck.java
@@ -150,6 +150,7 @@
* @author Baratali Izmailov
*/
public class CustomDeclarationOrderCheck extends AbstractCheck {
+
/**
* A key is pointing to the warning message text in "messages.properties"
* file.
@@ -346,11 +347,9 @@ public int[] getRequiredTokens() {
@Override
public void visitToken(DetailAST ast) {
switch (ast.getType()) {
-
case TokenTypes.CLASS_DEF:
if (!isClassDefInMethodDef(ast)) {
if (checkInnerClasses && !classDetails.isEmpty()) {
-
final int position = getPositionInOrderDeclaration(ast);
if (position != -1) {
@@ -371,7 +370,6 @@ public void visitToken(DetailAST ast) {
final DetailAST objBlockAst = ast.getParent();
if (objBlockAst != null
&& objBlockAst.getType() == TokenTypes.OBJBLOCK) {
-
final DetailAST classDefAst = objBlockAst.getParent();
if (classDefAst.getType() == TokenTypes.CLASS_DEF
@@ -392,7 +390,6 @@ public void visitToken(DetailAST ast) {
}
}
}
-
}
}
@@ -405,7 +402,6 @@ public void leaveToken(DetailAST ast) {
final ClassDetail classDetail = classDetails.pop();
if (checkGettersSetters) {
-
final Map gettersSetters =
classDetail.getWrongOrderedGettersSetters();
@@ -559,7 +555,6 @@ private boolean isWrongPosition(final int position) {
*/
private void logWrongOrderedSetters(Map gettersSetters) {
for (Entry entry: gettersSetters.entrySet()) {
-
final DetailAST setterAst = entry.getKey();
final DetailAST getterAst = entry.getValue();
@@ -613,7 +608,6 @@ private int getPositionInOrderDeclaration(final DetailAST ast) {
if (currentRule.hasRule(ANNON_CLASS_FIELD_MACRO)
|| currentRule.hasRule(GETTER_SETTER_MACRO)
|| currentRule.hasRule(MAIN_METHOD_MACRO)) {
-
final String methodName = getIdentifier(ast);
final ClassDetail classDetail = classDetails.peek();
@@ -703,7 +697,6 @@ private boolean isGetterCorrect(DetailAST methodDef, String methodPrefix) {
// no parameters
if (parameters.getChildCount() == 0) {
-
final DetailAST statementsAst = methodDef.findFirstToken(TokenTypes.SLIST);
if (statementsAst != null) {
final DetailAST returnStatementAst = statementsAst
@@ -763,7 +756,6 @@ private boolean isSetterCorrect(DetailAST methodDefAst, String methodPrefix) {
final DetailAST methodTypeAst = methodDefAst.findFirstToken(TokenTypes.TYPE);
if (methodTypeAst.branchContains(TokenTypes.LITERAL_VOID)) {
-
final DetailAST statementsAst = methodDefAst.findFirstToken(TokenTypes.SLIST);
final String methodName = getIdentifier(methodDefAst);
final String setterFieldName = fieldPrefix
@@ -896,7 +888,6 @@ private static boolean isFieldUpdate(DetailAST statementsAst, String fieldName)
DetailAST currentStatement = statementsAst.getFirstChild();
while (currentStatement != null && currentStatement != statementsAst) {
-
String nameOfSetterField = null;
if (currentStatement.getType() == TokenTypes.ASSIGN) {
nameOfSetterField = getNameOfAssignedField(currentStatement);
@@ -938,7 +929,6 @@ private static String getNameOfAssignedField(DetailAST assignAst) {
if (assignAst.getChildCount() > 0
&& (assignAst.getLastChild().getType() == TokenTypes.IDENT
|| assignAst.getLastChild().getType() == TokenTypes.METHOD_CALL)) {
-
final DetailAST methodCallDot = assignAst.getFirstChild();
if (methodCallDot.getChildCount() == 2
&& "this".equals(methodCallDot.getFirstChild().getText())) {
@@ -1016,9 +1006,7 @@ private static String getNameOfGetterField(DetailAST expr) {
final DetailAST exprFirstChild = expr.getFirstChild();
if (exprFirstChild.getType() == TokenTypes.IDENT) {
-
nameOfGetterField = exprFirstChild.getText();
-
}
else if (exprFirstChild.getType() == TokenTypes.DOT
&& exprFirstChild.getChildCount() == 2
@@ -1177,6 +1165,7 @@ private static boolean hasChildToken(DetailAST ast, int tokenType) {
* Private class for members of class and their patterns.
*/
private static final class FormatMatcher {
+
/** The regexp to match against. */
private Pattern regExp;
/** The Member of Class. */
@@ -1260,12 +1249,14 @@ public boolean hasRule(String ruleCheck) {
public String toString() {
return rule;
}
+
}
/**
* Class to keep current position and collect getters, setters.
*/
private static class ClassDetail {
+
/**
* Current position in custom order declaration.
*/
@@ -1333,7 +1324,6 @@ public Map getWrongOrderedGettersSetters() {
*/
private static Map getWrongOrderedGettersSetters(
List allGettersSetters, int index) {
-
final DetailAST getterAst = allGettersSetters.get(index);
final String getterName = getIdentifier(getterAst);
String getterField = null;
@@ -1401,6 +1391,7 @@ private boolean containsSetter(String methodName) {
}
return result;
}
+
}
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/DiamondOperatorForVariableDefinitionCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/DiamondOperatorForVariableDefinitionCheck.java
index 585b9363da..2df9f67511 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/DiamondOperatorForVariableDefinitionCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/DiamondOperatorForVariableDefinitionCheck.java
@@ -64,16 +64,13 @@ public int[] getRequiredTokens() {
@Override
public void visitToken(DetailAST variableDefNode) {
-
final DetailAST assignNode = variableDefNode.findFirstToken(TokenTypes.ASSIGN);
if (assignNode != null) {
-
final DetailAST newNode = assignNode.getFirstChild().getFirstChild();
// we check only creation by NEW
if (newNode.getType() == TokenTypes.LITERAL_NEW) {
-
final DetailAST variableDefNodeType =
variableDefNode.findFirstToken(TokenTypes.TYPE);
final DetailAST varDefArguments = getFirstTypeArgumentsToken(variableDefNodeType);
@@ -83,7 +80,6 @@ public void visitToken(DetailAST variableDefNode) {
&& newNode.getLastChild().getType() != TokenTypes.OBJBLOCK
// arrays can not be generics
&& newNode.findFirstToken(TokenTypes.ARRAY_DECLARATOR) == null) {
-
final DetailAST typeArgs = getFirstTypeArgumentsToken(newNode);
if (varDefArguments.equalsTree(typeArgs)) {
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EitherLogOrThrowCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EitherLogOrThrowCheck.java
index aba3af25fa..9d6e559632 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EitherLogOrThrowCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EitherLogOrThrowCheck.java
@@ -116,6 +116,7 @@
* @author Baratali Izmailov
*/
public class EitherLogOrThrowCheck extends AbstractCheck {
+
/**
* Key for error message.
*/
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EmptyPublicCtorInClassCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EmptyPublicCtorInClassCheck.java
index 22f24eed61..fad29ea610 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EmptyPublicCtorInClassCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EmptyPublicCtorInClassCheck.java
@@ -96,6 +96,7 @@
* @author Zuy Alexey
*/
public class EmptyPublicCtorInClassCheck extends AbstractCheck {
+
/**
* Violation message key.
*/
@@ -186,7 +187,6 @@ public void beginTree(DetailAST aRootNode) {
@Override
public void visitToken(DetailAST node) {
switch (node.getType()) {
-
case TokenTypes.IMPORT:
final String packageMemberName = getIdentifierName(node);
@@ -537,4 +537,5 @@ private static String getIdentifierName(DetailAST identifierNode) {
return result;
}
+
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/FinalizeImplementationCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/FinalizeImplementationCheck.java
index 6aadd1d7dc..ec2f5bba23 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/FinalizeImplementationCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/FinalizeImplementationCheck.java
@@ -106,7 +106,6 @@ public int[] getRequiredTokens() {
@Override
public void visitToken(DetailAST methodDefToken) {
if (isFinalizeMethodSignature(methodDefToken)) {
-
final String warningMessage = validateFinalizeMethod(methodDefToken);
if (warningMessage != null) {
@@ -135,7 +134,6 @@ private static String validateFinalizeMethod(DetailAST finalizeMethodToken) {
else {
warningMessage = MSG_KEY_MISSED_TRY_FINALLY;
}
-
}
else {
final DetailAST literalFinally = literalTry
@@ -146,7 +144,6 @@ private static String validateFinalizeMethod(DetailAST finalizeMethodToken) {
warningMessage = MSG_KEY_MISSED_SUPER_FINALIZE_CALL;
}
}
-
}
else {
warningMessage = MSG_KEY_PUBLIC_FINALIZE;
@@ -229,4 +226,5 @@ private static boolean containsSuperFinalizeCall(DetailAST openingBrace) {
}
return result;
}
+
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidCCommentsInMethodsCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidCCommentsInMethodsCheck.java
index 28acd6535d..a62fe47501 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidCCommentsInMethodsCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidCCommentsInMethodsCheck.java
@@ -33,6 +33,7 @@
* @author Ilia Dubinin
*/
public class ForbidCCommentsInMethodsCheck extends AbstractCheck {
+
/**
* Warning message key.
*/
@@ -84,4 +85,5 @@ public void visitToken(DetailAST methodNode) {
}
}
}
+
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidInstantiationCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidInstantiationCheck.java
index 5491f35e0a..82f648c7bf 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidInstantiationCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidInstantiationCheck.java
@@ -112,7 +112,6 @@ public int[] getRequiredTokens() {
@Override
public void visitToken(DetailAST ast) {
switch (ast.getType()) {
-
case TokenTypes.IMPORT:
importsList.add(getText(ast));
break;
@@ -127,7 +126,6 @@ public void visitToken(DetailAST ast) {
final String instanceClassName = getClassName(instanceClass);
for (String forbiddenClass : forbiddenClasses) {
-
if (forbiddenClass.startsWith("java.lang.")
&& forbiddenClass.endsWith(instanceClassName)) {
log(ast, MSG_KEY, instanceClassName);
@@ -153,7 +151,6 @@ else if (addedUsingForbiddenImport(instanceClass,
Utils.reportInvalidToken(ast.getType());
break;
}
-
}
/**
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidReturnInFinallyBlockCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidReturnInFinallyBlockCheck.java
index 928ced933a..fefe16b89f 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidReturnInFinallyBlockCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidReturnInFinallyBlockCheck.java
@@ -38,6 +38,7 @@
*/
public class ForbidReturnInFinallyBlockCheck extends AbstractCheck {
+
/**
* A key is pointing to the warning message text in "messages.properties"
* file.
@@ -111,4 +112,5 @@ private static boolean isReturnInMethodDefinition(DetailAST returnNode) {
}
return result;
}
+
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidThrowAnonymousExceptionsCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidThrowAnonymousExceptionsCheck.java
index 45c5b6f4ef..ca17cecd80 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidThrowAnonymousExceptionsCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidThrowAnonymousExceptionsCheck.java
@@ -59,6 +59,7 @@
* @author Max Vetrenko
*/
public class ForbidThrowAnonymousExceptionsCheck extends AbstractCheck {
+
/**
* Warning message key.
*/
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/IllegalCatchExtendedCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/IllegalCatchExtendedCheck.java
index 7d1e656f71..71fe505863 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/IllegalCatchExtendedCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/IllegalCatchExtendedCheck.java
@@ -35,6 +35,7 @@
* @author Simon Harris
*/
public final class IllegalCatchExtendedCheck extends AbstractCheck {
+
/**
* Warning message key.
*/
@@ -151,7 +152,6 @@ public DetailAST getThrowAST(DetailAST parentAST) {
final DetailAST[] asts = getChilds(parentAST);
for (DetailAST currentNode : asts) {
-
if (currentNode.getType() != TokenTypes.PARAMETER_DEF
&& currentNode.getNumberOfChildren() > 0) {
result = getThrowAST(currentNode);
@@ -194,4 +194,5 @@ private static DetailAST[] getChilds(DetailAST node) {
protected boolean isIllegalClassName(final String ident) {
return illegalClassNames.contains(ident);
}
+
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/LogicConditionNeedOptimizationCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/LogicConditionNeedOptimizationCheck.java
index 4c89006a89..4a30f4e57e 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/LogicConditionNeedOptimizationCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/LogicConditionNeedOptimizationCheck.java
@@ -35,6 +35,7 @@
* @author Ilia Dubinin
*/
public class LogicConditionNeedOptimizationCheck extends AbstractCheck {
+
/**
* The key is pointing to the warning message text in "messages.properties"
* file.
@@ -93,4 +94,5 @@ private static DetailAST getSecondOperand(DetailAST logicNode) {
}
return child;
}
+
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MapIterationInForEachLoopCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MapIterationInForEachLoopCheck.java
index a3cba7a789..0fc1cfa518 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MapIterationInForEachLoopCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MapIterationInForEachLoopCheck.java
@@ -292,7 +292,6 @@ public void beginTree(DetailAST ast) {
@Override
public void visitToken(DetailAST ast) {
switch (ast.getType()) {
-
case TokenTypes.IMPORT:
final String qualifiedMapImportText = getMapImportQualifiedName(ast);
if (qualifiedMapImportText != null) {
@@ -502,7 +501,6 @@ private String checkForWrongKeySetUsage(DetailAST forEachOpeningBraceNode, Strin
}
if (mapIdentNode != null && GET_NODE_NAME.equals(identOrLiteralIfNode.getText())
&& mapName.equals(mapIdentNode.getText())) {
-
methodGetCallCount++;
}
@@ -530,7 +528,6 @@ private String checkForWrongKeySetUsage(DetailAST forEachOpeningBraceNode, Strin
}
if (methodGetCallCount != 0 && keyIdentCount != 0) {
-
if (proposeValuesUsage && methodGetCallCount == keyIdentCount) {
result = MSG_KEY_VALUES;
}
@@ -559,7 +556,6 @@ private String checkForWrongEntrySetUsage(DetailAST forEachOpeningBraceNode,
int methodGetKeyCallCount = 0;
int methodGetValueCallCount = 0;
for (DetailAST identNode : identNodesList) {
-
final DetailAST entryNode = identNode.getPreviousSibling();
if (entryNode != null && GET_KEY_NODE_NAME.equals(identNode.getText())
@@ -579,7 +575,6 @@ private String checkForWrongEntrySetUsage(DetailAST forEachOpeningBraceNode,
}
else if (methodGetKeyCallCount > 0 && methodGetValueCallCount == 0) {
result = MSG_KEY_KEYSET;
-
}
return result;
}
@@ -751,4 +746,5 @@ private static List getSubTreeNodesOfType(DetailAST rootNode,
}
return result;
}
+
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MoveVariableInsideIfCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MoveVariableInsideIfCheck.java
index ae45a279eb..fa733fd2e4 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MoveVariableInsideIfCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MoveVariableInsideIfCheck.java
@@ -114,6 +114,7 @@
* @author Richard Veach
*/
public class MoveVariableInsideIfCheck extends AbstractCheck {
+
/**
* A key is pointing to the warning message text in "messages.properties"
* file.
@@ -275,6 +276,7 @@ private static void validateOther(Holder holder, DetailAST child) {
* @author Richard Veach
*/
private static class Holder {
+
/** The name of the variable being examined. */
private String variableName;
/** Switch to trigger ending examining more nodes. */
@@ -357,5 +359,7 @@ public boolean hasIdent(DetailAST start, DetailAST end) {
return found;
}
+
}
+
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MultipleStringLiteralsExtendedCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MultipleStringLiteralsExtendedCheck.java
index aff08f8b1f..976d1bd9bc 100755
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MultipleStringLiteralsExtendedCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MultipleStringLiteralsExtendedCheck.java
@@ -38,6 +38,7 @@
* @author Daniel Grenner
*/
public class MultipleStringLiteralsExtendedCheck extends AbstractCheck {
+
/**
* A key is pointing to the warning message text in "messages.properties"
* file.
@@ -217,6 +218,7 @@ public void finishTree(DetailAST rootAST) {
* This class contains information about where a string was found.
*/
private static final class StringInfo {
+
/**
* Line of finding.
*/
@@ -256,6 +258,7 @@ private int getLine() {
private int getCol() {
return col;
}
+
}
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MultipleVariableDeclarationsExtendedCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MultipleVariableDeclarationsExtendedCheck.java
index b11bbce62a..54dcf30e19 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MultipleVariableDeclarationsExtendedCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MultipleVariableDeclarationsExtendedCheck.java
@@ -46,6 +46,7 @@
*/
public class MultipleVariableDeclarationsExtendedCheck extends AbstractCheck {
+
/**
* Warning message key.
*/
@@ -106,7 +107,6 @@ public int[] getRequiredTokens() {
* uses to get the parent or previous sibling token.
*/
public void work(DetailAST ast) {
-
DetailAST nextNode = ast.getNextSibling();
if (nextNode != null) {
@@ -139,7 +139,6 @@ public void work(DetailAST ast) {
@Override
public void visitToken(DetailAST ast) {
-
final DetailAST token = ast;
final boolean inFor = ast.getParent().getType() == TokenTypes.FOR_INIT;
final boolean inClass = ast.getParent().getParent().getType() == TokenTypes.CLASS_DEF;
@@ -154,7 +153,6 @@ else if (!ignoreCycles && inFor) {
else if (!ignoreMethods && !inFor) {
work(token);
}
-
}
/**
@@ -180,4 +178,5 @@ private static DetailAST getLastNode(final DetailAST node) {
return currentNode;
}
+
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NameConventionForJunit4TestClassesCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NameConventionForJunit4TestClassesCheck.java
index 693d05396c..3e7828d238 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NameConventionForJunit4TestClassesCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NameConventionForJunit4TestClassesCheck.java
@@ -107,6 +107,7 @@
* @author Zuy Alexey
*/
public class NameConventionForJunit4TestClassesCheck extends AbstractCheck {
+
/**
* Violation message key.
*/
@@ -352,4 +353,5 @@ private static boolean isMatchesRegex(Pattern regexPattern, String str) {
}
return result;
}
+
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NoNullForCollectionReturnCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NoNullForCollectionReturnCheck.java
index d7e7f535e7..5d1a174397 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NoNullForCollectionReturnCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NoNullForCollectionReturnCheck.java
@@ -51,6 +51,7 @@
* @author Ilja Dubinin
*/
public class NoNullForCollectionReturnCheck extends AbstractCheck {
+
/**
* Warning message key.
*/
@@ -383,4 +384,5 @@ private static DetailAST getBlockBody(DetailAST blockDef) {
}
return blockBody;
}
+
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NumericLiteralNeedsUnderscoreCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NumericLiteralNeedsUnderscoreCheck.java
index bbbdbdd17c..dfb4a518e2 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NumericLiteralNeedsUnderscoreCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NumericLiteralNeedsUnderscoreCheck.java
@@ -151,6 +151,7 @@ public class NumericLiteralNeedsUnderscoreCheck extends AbstractCheck {
* Type of numeric literal.
*/
protected enum NumericType {
+
/**
* Denotes a decimal literal. For example, 1.2f
*/
@@ -165,6 +166,7 @@ protected enum NumericType {
* Denotes a binary literal. For example, 0b0011
*/
BINARY;
+
}
/**
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/OverridableMethodInConstructorCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/OverridableMethodInConstructorCheck.java
index 966add5012..097496efcb 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/OverridableMethodInConstructorCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/OverridableMethodInConstructorCheck.java
@@ -270,13 +270,10 @@ public void beginTree(DetailAST rootAST) {
@Override
public void visitToken(final DetailAST detailAST) {
-
final DetailAST classDef = getClassDef(detailAST);
if (classDef != null && !hasModifier(classDef, TokenTypes.FINAL)) {
-
switch (detailAST.getType()) {
-
case TokenTypes.CTOR_DEF:
logWarnings(detailAST, KEY_CTOR);
break;
@@ -317,7 +314,6 @@ && realizesAnInterface(classDef, Serializable.class.getSimpleName())) {
* "messages.properties" file.
*/
private void logWarnings(final DetailAST detailAST, final String key) {
-
final List methodCallsToWarnList =
getOverridables(detailAST);
@@ -348,7 +344,6 @@ private void logWarnings(final DetailAST detailAST, final String key) {
* constructor body.
*/
private List getOverridables(final DetailAST parentAST) {
-
final List result =
new LinkedList<>();
final List methodCallsList = getMethodCallsList(parentAST);
@@ -377,7 +372,6 @@ && isOverridableMethodCall(curNode)) {
* overridable method call and false otherwise.
*/
private boolean isOverridableMethodCall(final DetailAST methodCallAST) {
-
boolean result = false;
visitedMethodCalls.add(methodCallAST);
@@ -419,7 +413,6 @@ && isOverridableMethodCall(curNode)) {
* current parent node.
*/
private List getMethodCallsList(final DetailAST parentAST) {
-
final List result = new LinkedList<>();
for (DetailAST curNode : getChildren(parentAST)) {
@@ -443,7 +436,6 @@ private List getMethodCallsList(final DetailAST parentAST) {
* @return The method name is related to the current METHOD_CALL DetailAST.
*/
private String getMethodName(final DetailAST methodCallAST) {
-
String result = null;
final DetailAST ident = methodCallAST.findFirstToken(TokenTypes.IDENT);
@@ -455,7 +447,6 @@ private String getMethodName(final DetailAST methodCallAST) {
final DetailAST childAST = methodCallAST.getFirstChild();
if (childAST != null && childAST.getType() == TokenTypes.DOT) {
-
final DetailAST firstChild = childAST.getFirstChild();
final DetailAST lastChild = childAST.getLastChild();
@@ -489,7 +480,6 @@ else if (firstChild.getType() == TokenTypes.IDENT
* node.
*/
private DetailAST getMethodDef(final DetailAST methodCallAST) {
-
DetailAST result = null;
curMethodDef = null;
@@ -497,7 +487,6 @@ private DetailAST getMethodDef(final DetailAST methodCallAST) {
final String methodName = getMethodName(methodCallAST);
if (methodName != null) {
-
final DetailAST curClassAST = getClassDef(methodCallAST);
final DetailAST callsChild = methodCallAST.getFirstChild();
final String variableTypeName;
@@ -510,7 +499,6 @@ private DetailAST getMethodDef(final DetailAST methodCallAST) {
}
if (curMethodDefCount == 0) {
-
final List baseClasses = getBaseClasses(curClassAST);
for (DetailAST curBaseClass : baseClasses) {
@@ -566,7 +554,6 @@ private List getMethodDef(final DetailAST parentAST,
List definitionsList = new LinkedList<>();
for (DetailAST curNode : getChildren(parentAST)) {
-
if (curNode.getNumberOfChildren() > 0) {
if (curNode.getType() == TokenTypes.METHOD_DEF) {
final String curMethodName = curNode.findFirstToken(
@@ -614,7 +601,6 @@ else if (dotChild.getType() == TokenTypes.DOT) {
typeName = dotChild.getFirstChild().getText()
+ PATH_SEPARATOR + dotChild.getLastChild().getText();
}
-
}
return typeName;
}
@@ -669,7 +655,6 @@ else if (dotChild.getType() == TokenTypes.DOT) {
* @return the count of parameters for current method.
*/
private static int getMethodParamsCount(DetailAST methodDefOrCallAST) {
-
int result = 0;
DetailAST paramsParentAST = null;
@@ -707,7 +692,6 @@ else if (methodDefOrCallAST.getType() == TokenTypes.METHOD_DEF) {
*/
private static boolean hasModifier(final DetailAST methodOrClassDefAST,
int modifierType) {
-
boolean result = false;
final DetailAST modifiers = methodOrClassDefAST
.findFirstToken(TokenTypes.MODIFIERS);
@@ -733,7 +717,6 @@ private static boolean hasModifier(final DetailAST methodOrClassDefAST,
* node named aMethodNode.
* */
private static DetailAST getClassDef(final DetailAST methodNode) {
-
DetailAST curNode = methodNode;
while (curNode != null && curNode.getType() != TokenTypes.CLASS_DEF) {
@@ -754,7 +737,6 @@ private static DetailAST getClassDef(final DetailAST methodNode) {
* named "aClassName".
*/
private static DetailAST getClassDef(DetailAST rootNode, String className) {
-
DetailAST curNode = rootNode;
while (curNode != null) {
@@ -792,7 +774,6 @@ private static DetailAST getClassDef(DetailAST rootNode, String className) {
*/
private boolean realizesAnInterface(final DetailAST classDefNode,
final String interfaceName) {
-
boolean result = false;
final List classWithBaseClasses =
getBaseClasses(classDefNode);
@@ -821,7 +802,6 @@ private boolean realizesAnInterface(final DetailAST classDefNode,
*/
private static boolean implementsAnInterface(final DetailAST classDefAST,
final String interfaceName) {
-
boolean result = false;
final DetailAST implClause = classDefAST
.findFirstToken(TokenTypes.IMPLEMENTS_CLAUSE);
@@ -848,7 +828,6 @@ private static boolean implementsAnInterface(final DetailAST classDefAST,
* processed and all it`s base classes.
*/
private List getBaseClasses(final DetailAST classDefNode) {
-
final List result = new LinkedList<>();
String baseClassName = getBaseClassName(classDefNode);
@@ -876,7 +855,6 @@ private List getBaseClasses(final DetailAST classDefNode) {
* @return The name of a base class for current class.
*/
private static String getBaseClassName(final DetailAST classDefNode) {
-
String result = null;
final DetailAST extendsClause = classDefNode
.findFirstToken(TokenTypes.EXTENDS_CLAUSE);
@@ -919,6 +897,7 @@ private static List getChildren(final DetailAST node) {
* overridable method.
*/
private final class OverridableMetCall {
+
/**
* DetailAST node is related to the method call that leads to
* call of the overridable method.
@@ -942,6 +921,7 @@ private OverridableMetCall(DetailAST methodCallAST,
this.metCallAST = methodCallAST;
this.overridableMetName = overridableMetName;
}
+
}
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/RedundantReturnCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/RedundantReturnCheck.java
index 467b754d13..46ab508033 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/RedundantReturnCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/RedundantReturnCheck.java
@@ -118,7 +118,6 @@ public int[] getRequiredTokens() {
@Override
public void visitToken(DetailAST ast) {
-
final DetailAST blockAst = ast.getLastChild();
switch (ast.getType()) {
@@ -149,7 +148,6 @@ public void visitToken(DetailAST ast) {
* @return true if the block can be ignored.
*/
private boolean ignoreLonelyReturn(DetailAST objectBlockAst) {
-
return allowReturnInEmptyMethodsAndConstructors
&& objectBlockAst.getFirstChild().getType()
== TokenTypes.LITERAL_RETURN;
@@ -170,7 +168,6 @@ private static boolean hasNonEmptyBody(DetailAST defAst) {
* @return true if void method has non-empty body.
*/
private static boolean isVoidMethodWithNonEmptyBody(DetailAST methodDefAst) {
-
return methodDefAst.getLastChild().getType() == TokenTypes.SLIST
&& methodDefAst.findFirstToken(TokenTypes.TYPE)
.findFirstToken(TokenTypes.LITERAL_VOID) != null
@@ -196,25 +193,21 @@ private void log(List redundantReturnsAst) {
* @return list of redundant returns or empty list if none were found
*/
private static List getRedundantReturns(DetailAST objectBlockAst) {
-
final List redundantReturns = new ArrayList<>();
final int placeForRedundantReturn = objectBlockAst
.getLastChild().getPreviousSibling().getType();
if (placeForRedundantReturn == TokenTypes.LITERAL_RETURN) {
-
final DetailAST lastChildAst = objectBlockAst.getLastChild();
final DetailAST redundantReturnAst = lastChildAst.getPreviousSibling();
redundantReturns.add(redundantReturnAst);
-
}
else if (placeForRedundantReturn == TokenTypes.LITERAL_TRY
&& !getRedundantReturnsInTryCatchBlock(objectBlockAst
.findFirstToken(TokenTypes.LITERAL_TRY)).isEmpty()) {
-
final List redundantsAst = getRedundantReturnsInTryCatchBlock(objectBlockAst
.findFirstToken(TokenTypes.LITERAL_TRY));
@@ -231,7 +224,6 @@ else if (placeForRedundantReturn == TokenTypes.LITERAL_TRY
* @return list of redundant returns or empty list if none were found
*/
private static List getRedundantReturnsInTryCatchBlock(DetailAST tryAst) {
-
final List redundantReturns = new ArrayList<>();
DetailAST tryBlockAst = null;
@@ -272,7 +264,6 @@ private static List getRedundantReturnsInTryCatchBlock(DetailAST tryA
// if redundant return is in finally block
if (blockAst.getNextSibling() != null) {
-
final DetailAST afterCatchBlockAst = blockAst.getNextSibling().getLastChild()
.getLastChild();
@@ -295,7 +286,6 @@ private static DetailAST getNextCatchBlock(DetailAST blockAst) {
DetailAST catchBlockAst = null;
if (blockAst.getNextSibling() != null
&& blockAst.getNextSibling().getType() == TokenTypes.LITERAL_CATCH) {
-
catchBlockAst = blockAst.getNextSibling();
}
return catchBlockAst;
@@ -308,11 +298,9 @@ private static DetailAST getNextCatchBlock(DetailAST blockAst) {
* @return redundant literal return if found, else null.
*/
private static DetailAST getRedundantReturnInBlock(DetailAST statementAst) {
-
DetailAST redundantReturnAst = null;
if (statementAst != null) {
-
if (statementAst.getType() == TokenTypes.LITERAL_RETURN) {
redundantReturnAst = statementAst;
}
@@ -341,7 +329,6 @@ private static DetailAST findRedundantReturnInCatch(DetailAST lastStatementInCat
DetailAST toVisitAst = currentNodeAst;
DetailAST returnAst = null;
while (toVisitAst != null) {
-
toVisitAst = Utils.getNextSubTreeNode(toVisitAst, currentNodeAst);
if (toVisitAst != null
@@ -350,12 +337,10 @@ private static DetailAST findRedundantReturnInCatch(DetailAST lastStatementInCat
== TokenTypes.RCURLY)
&& toVisitAst.getType() == TokenTypes.LITERAL_RETURN
&& toVisitAst.getParent().getNextSibling() == null) {
-
returnAst = toVisitAst;
while (toVisitAst != null
&& toVisitAst.getParent() != currentNodeAst.getLastChild()) {
-
toVisitAst = toVisitAst.getParent();
}
@@ -370,4 +355,5 @@ private static DetailAST findRedundantReturnInCatch(DetailAST lastStatementInCat
currentNodeAst = Utils.getNextSubTreeNode(currentNodeAst, lastStatementInCatchBlockAst);
return redundantReturnAst;
}
+
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/RequireFailForTryCatchInJunitCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/RequireFailForTryCatchInJunitCheck.java
index b09257198d..dc429416d9 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/RequireFailForTryCatchInJunitCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/RequireFailForTryCatchInJunitCheck.java
@@ -67,6 +67,7 @@
* @author Richard Veach
*/
public class RequireFailForTryCatchInJunitCheck extends AbstractCheck {
+
/**
* Violation message key.
*/
@@ -243,4 +244,5 @@ private static String getImportText(DetailAST ast) {
}
return imp.getText();
}
+
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ReturnBooleanFromTernaryCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ReturnBooleanFromTernaryCheck.java
index a47a32df46..0ecfba8d01 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ReturnBooleanFromTernaryCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ReturnBooleanFromTernaryCheck.java
@@ -72,4 +72,5 @@ public void visitToken(DetailAST ast) {
log(ast, MSG_KEY);
}
}
+
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ReturnCountExtendedCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ReturnCountExtendedCheck.java
index 9036df3fc8..c7e1dfcaef 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ReturnCountExtendedCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ReturnCountExtendedCheck.java
@@ -256,7 +256,6 @@ public void visitToken(final DetailAST node) {
}
if (curMethodLinesCount >= ignoreMethodLinesCount) {
-
final int mCurReturnCount = getReturnCount(node,
openingBrace);
@@ -317,7 +316,6 @@ private int getReturnCount(final DetailAST methodDefNode,
// stop at closing brace
while (curNode.getType() != TokenTypes.RCURLY
|| curNode.getParent() != methodOpeningBrace) {
-
if (curNode.getType() == TokenTypes.LITERAL_RETURN
&& getDepth(methodDefNode, curNode) < minIgnoreReturnDepth
&& shouldEmptyReturnStatementBeCounted(curNode)
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ReturnNullInsteadOfBooleanCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ReturnNullInsteadOfBooleanCheck.java
index 2458256003..6b5a3ee1ad 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ReturnNullInsteadOfBooleanCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ReturnNullInsteadOfBooleanCheck.java
@@ -110,4 +110,5 @@ public void leaveToken(DetailAST ast) {
break;
}
}
+
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/SimpleAccessorNameNotationCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/SimpleAccessorNameNotationCheck.java
index 24966ae362..718f1dbd5f 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/SimpleAccessorNameNotationCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/SimpleAccessorNameNotationCheck.java
@@ -49,6 +49,7 @@
* @author Ilja Dubinin
*/
public class SimpleAccessorNameNotationCheck extends AbstractCheck {
+
/**
* A key is pointing to the warning message text in "messages.properties"
* file.
@@ -138,16 +139,13 @@ private boolean isSetterCorrect(DetailAST methodDef, String methodName) {
final DetailAST methodType = methodDef.findFirstToken(TokenTypes.TYPE);
boolean result = true;
if (methodType.branchContains(TokenTypes.LITERAL_VOID)) {
-
DetailAST currentVerifiedTop = methodDef.findFirstToken(TokenTypes.SLIST);
if (containsOnlyExpression(currentVerifiedTop)) {
-
currentVerifiedTop = currentVerifiedTop.getFirstChild();
final boolean containsOnlyOneAssignment = currentVerifiedTop.getFirstChild()
.getType() == TokenTypes.ASSIGN;
if (containsOnlyOneAssignment) {
-
currentVerifiedTop = currentVerifiedTop.getFirstChild();
final DetailAST parameters =
methodDef.findFirstToken(TokenTypes.PARAMETERS);
@@ -157,7 +155,6 @@ private boolean isSetterCorrect(DetailAST methodDef, String methodName) {
if (nameOfSettingField != null
&& verifyFieldAndMethodName(nameOfSettingField,
methodName)) {
-
result = false;
}
}
@@ -181,22 +178,18 @@ private boolean isGetterCorrect(DetailAST methodDef, String methodName) {
final DetailAST parameters = methodDef.findFirstToken(TokenTypes.PARAMETERS);
boolean result = true;
if (parameters.getChildCount() == 0) {
-
DetailAST currentVerifiedTop =
methodDef.findFirstToken(TokenTypes.SLIST);
if (containsOnlyReturn(currentVerifiedTop)) {
-
currentVerifiedTop = currentVerifiedTop.getFirstChild();
if (isCorrectReturn(currentVerifiedTop)) {
-
currentVerifiedTop = currentVerifiedTop.getFirstChild();
final String nameOfGettingField = getNameOfGettingField(currentVerifiedTop);
if (nameOfGettingField != null
&& verifyFieldAndMethodName(nameOfGettingField,
methodName)) {
-
result = false;
}
}
@@ -239,23 +232,18 @@ private static String getNameOfSettingField(DetailAST assign,
final DetailAST assigningFirstChild = assign.getFirstChild();
if (assigningFirstChild.getType() == TokenTypes.IDENT) {
-
nameOfSettingField = assigningFirstChild.getText();
if (checkNameOfParameters(parameters, nameOfSettingField)) {
nameOfSettingField = null;
}
-
}
else {
if (assigningFirstChild.getType() == TokenTypes.DOT) {
-
if ("this".equals(assigningFirstChild.getFirstChild().getText())) {
-
nameOfSettingField = assigningFirstChild.getLastChild()
.getText();
}
-
}
}
}
@@ -321,15 +309,12 @@ private static String getNameOfGettingField(DetailAST expr) {
final DetailAST exprFirstChild = expr.getFirstChild();
if (exprFirstChild.getType() == TokenTypes.IDENT) {
-
nameOfGettingField = exprFirstChild.getText();
-
}
else {
if (exprFirstChild.getType() == TokenTypes.DOT
&& exprFirstChild.getChildCount() == 2
&& exprFirstChild.getFirstChild().getType() == TokenTypes.LITERAL_THIS) {
-
nameOfGettingField = exprFirstChild.getLastChild().getText();
}
}
@@ -351,7 +336,6 @@ private static String getNameOfGettingField(DetailAST expr) {
*/
private static boolean checkNameOfParameters(DetailAST paramrters,
String fieldName) {
-
boolean isNameOfParameter = false;
final int parametersChildCount = paramrters.getChildCount();
@@ -359,10 +343,8 @@ private static boolean checkNameOfParameters(DetailAST paramrters,
.findFirstToken(TokenTypes.PARAMETER_DEF);
for (int i = 0; i < parametersChildCount && !isNameOfParameter; i++) {
-
isNameOfParameter = parameterDef.findFirstToken(TokenTypes.IDENT).getText()
.equals(fieldName);
-
}
return isNameOfParameter;
@@ -392,4 +374,5 @@ private static boolean hasBody(DetailAST methodDef) {
final DetailAST body = methodDef.findFirstToken(TokenTypes.SLIST);
return body != null;
}
+
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/SingleBreakOrContinueCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/SingleBreakOrContinueCheck.java
index 098388c50f..00cd3d710a 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/SingleBreakOrContinueCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/SingleBreakOrContinueCheck.java
@@ -181,4 +181,5 @@ private static boolean shouldIgnore(DetailAST node) {
|| TokenTypes.LITERAL_WHILE == node.getType()
|| TokenTypes.LITERAL_DO == node.getType();
}
+
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/TernaryPerExpressionCountCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/TernaryPerExpressionCountCheck.java
index 156a279817..ab2eaa0b52 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/TernaryPerExpressionCountCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/TernaryPerExpressionCountCheck.java
@@ -153,7 +153,6 @@ public void setIgnoreIsolatedTernaryOnLine(boolean ignoreIsolatedTernaryOnLine)
@Override
public void visitToken(DetailAST expressionNode) {
-
final List questionNodes = getQuestionNodes(expressionNode);
if (questionNodes.size() > maxTernaryPerExpressionCount) {
@@ -170,7 +169,6 @@ public void visitToken(DetailAST expressionNode) {
* List of question nodes
*/
private List getQuestionNodes(DetailAST expressionNode) {
-
final List questionNodes = new LinkedList<>();
DetailAST currentNode = expressionNode;
@@ -182,7 +180,6 @@ private List getQuestionNodes(DetailAST expressionNode) {
&& !isSkipTernaryOperator(currentNode)) {
questionNodes.add(currentNode);
}
-
} while (currentNode != null);
return questionNodes;
@@ -269,4 +266,5 @@ private static DetailAST getNextNode(DetailAST expressionNode,
return toVisit;
}
+
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UnnecessaryParenthesesExtendedCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UnnecessaryParenthesesExtendedCheck.java
index 0b1619c3a3..d7d7e4bc1c 100755
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UnnecessaryParenthesesExtendedCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UnnecessaryParenthesesExtendedCheck.java
@@ -52,6 +52,7 @@
* @author Antonenko Dmitriy
*/
public class UnnecessaryParenthesesExtendedCheck extends AbstractCheck {
+
/**Warning message key.*/
public static final String MSG_KEY_ASSIGN = "unnecessary.paren.assign";
/**Warning message key.*/
@@ -206,7 +207,6 @@ public void visitToken(DetailAST ast) {
subtreeType, EQUALS)) {
log(ast, MSG_KEY_ASSIGN);
}
-
}
}
}
@@ -221,7 +221,6 @@ public void leaveToken(DetailAST ast) {
|| (parent.getType() != TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR)) {
// An expression is surrounded by parentheses.
if (type == TokenTypes.EXPR) {
-
// If 'mParentToSkip' == 'aAST', then we've already logged a
// warning about an immediate child node in visitToken, so we don't
// need to log another one here.
@@ -385,4 +384,5 @@ public final void setIgnoreCalculationOfBooleanVariablesWithAssert(
this.ignoreCalculationOfBooleanVariablesWithAssert =
ignoreCalculationOfBooleanVariablesWithAssert;
}
+
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UselessSingleCatchCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UselessSingleCatchCheck.java
index 9895d11061..c71b076bbf 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UselessSingleCatchCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UselessSingleCatchCheck.java
@@ -39,6 +39,7 @@
* @author Zuy Alexey
*/
public class UselessSingleCatchCheck extends AbstractCheck {
+
/**
* A key is pointing to the warning message text in "messages.properties"
* file.
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UselessSuperCtorCallCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UselessSuperCtorCallCheck.java
index 4f2ff5f3e9..59ed45c2a6 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UselessSuperCtorCallCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UselessSuperCtorCallCheck.java
@@ -138,6 +138,7 @@
* @author Zuy Alexey
*/
public class UselessSuperCtorCallCheck extends AbstractCheck {
+
/**
* Violation message key.
*/
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/WhitespaceBeforeArrayInitializerCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/WhitespaceBeforeArrayInitializerCheck.java
index 0b1d75ef24..66356f2c04 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/WhitespaceBeforeArrayInitializerCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/WhitespaceBeforeArrayInitializerCheck.java
@@ -130,4 +130,5 @@ private static DetailAST getPreviousAst(DetailAST ast) {
}
return previousAst;
}
+
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/AvoidConditionInversionCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/AvoidConditionInversionCheck.java
index 15c25f22e7..5b3c839cf9 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/AvoidConditionInversionCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/AvoidConditionInversionCheck.java
@@ -127,7 +127,6 @@ public class AvoidConditionInversionCheck extends AbstractCheck {
* @param applyOnlyToRelationalOperands The new value for the field.
*/
public void setApplyOnlyToRelationalOperands(boolean applyOnlyToRelationalOperands) {
-
this.applyOnlyToRelationalOperands = applyOnlyToRelationalOperands;
}
@@ -154,15 +153,11 @@ public int[] getRequiredTokens() {
@Override
public void visitToken(DetailAST ast) {
-
final DetailAST expressionAst = ast.findFirstToken(TokenTypes.EXPR);
switch (ast.getType()) {
-
case TokenTypes.LITERAL_RETURN:
-
if (!isEmptyReturn(ast)) {
-
final DetailAST inversionAst = getInversion(expressionAst);
if (isAvoidableInversion(inversionAst)) {
@@ -170,29 +165,26 @@ public void visitToken(DetailAST ast) {
}
}
break;
+
case TokenTypes.LITERAL_WHILE:
case TokenTypes.LITERAL_DO:
case TokenTypes.LITERAL_IF:
-
final DetailAST invertedAst = getInversion(expressionAst);
-
if (isAvoidableInversion(invertedAst)) {
-
log(invertedAst);
}
break;
- case TokenTypes.FOR_CONDITION:
+ case TokenTypes.FOR_CONDITION:
if (!isEmptyForCondition(ast)) {
-
final DetailAST inversionAst = getInversion(expressionAst);
if (isAvoidableInversion(inversionAst)) {
-
log(inversionAst);
}
}
break;
+
default:
Utils.reportInvalidToken(ast.getType());
break;
@@ -207,7 +199,6 @@ public void visitToken(DetailAST ast) {
* @return true if the return is empty.
*/
private static boolean isEmptyReturn(DetailAST returnAst) {
-
return returnAst.findFirstToken(TokenTypes.EXPR) == null;
}
@@ -218,7 +209,6 @@ private static boolean isEmptyReturn(DetailAST returnAst) {
* @return true if the for condition is empty.
*/
private static boolean isEmptyForCondition(DetailAST forConditionAst) {
-
return forConditionAst.getFirstChild() == null;
}
@@ -230,7 +220,6 @@ private static boolean isEmptyForCondition(DetailAST forConditionAst) {
* if exists, else - null
*/
private static DetailAST getInversion(DetailAST expressionAst) {
-
return expressionAst.findFirstToken(TokenTypes.LNOT);
}
@@ -241,7 +230,6 @@ private static DetailAST getInversion(DetailAST expressionAst) {
* @return true if the inversion is avoidable.
*/
private boolean isAvoidableInversion(DetailAST inversionAst) {
-
return inversionAst != null && !isSkipCondition(inversionAst);
}
@@ -255,7 +243,6 @@ private boolean isAvoidableInversion(DetailAST inversionAst) {
* @return true if token can be skipped.
*/
private boolean isSkipCondition(DetailAST inversionConditionAst) {
-
return (applyOnlyToRelationalOperands
&& !containsRelationalOperandsOnly(inversionConditionAst))
|| !containsConditionalOrRelationalOperands(inversionConditionAst);
@@ -270,23 +257,18 @@ private boolean isSkipCondition(DetailAST inversionConditionAst) {
* @return true if the node contains only relation operands.
*/
private static boolean containsRelationalOperandsOnly(DetailAST inversionConditionAst) {
-
boolean result = true;
final DetailAST operatorInInversionAst = inversionConditionAst.getFirstChild()
.getNextSibling();
if (operatorInInversionAst != null) {
-
if (!RELATIONAL_OPERATORS_SET.contains(operatorInInversionAst.getType())) {
-
DetailAST currentNode = operatorInInversionAst.getFirstChild();
while (currentNode != null) {
-
if ((currentNode.getType() == TokenTypes.IDENT)
|| (!isRelationalOperand(currentNode))) {
-
result = false;
}
@@ -307,7 +289,6 @@ private static boolean containsRelationalOperandsOnly(DetailAST inversionConditi
* @return true if the operand is relational.
*/
private static boolean isRelationalOperand(DetailAST operandAst) {
-
return operandAst.getFirstChild() == null
|| RELATIONAL_OPERATORS_SET.contains(operandAst.getType());
}
@@ -321,15 +302,12 @@ private static boolean isRelationalOperand(DetailAST operandAst) {
* @return true if the node contains conditional or relational operands.
*/
private static boolean containsConditionalOrRelationalOperands(DetailAST inversionAst) {
-
boolean result = false;
DetailAST currentNodeAst = inversionAst.getFirstChild();
while (currentNodeAst != null) {
-
if (RELATIONAL_AND_CONDITIONAL_OPERATORS_SET.contains(currentNodeAst.getType())) {
-
result = true;
}
@@ -345,7 +323,6 @@ private static boolean containsConditionalOrRelationalOperands(DetailAST inversi
* Node of type {@link com.puppycrawl.tools.checkstyle.api.TokenTypes#LNOT}
*/
private void log(DetailAST inversionAst) {
-
log(inversionAst.getLineNo(), MSG_KEY);
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/CauseParameterInExceptionCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/CauseParameterInExceptionCheck.java
index 0e7a33c6c7..a923aa9baf 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/CauseParameterInExceptionCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/CauseParameterInExceptionCheck.java
@@ -48,6 +48,7 @@
* Yaroslavtsev
*/
public class CauseParameterInExceptionCheck extends AbstractCheck {
+
/**
* A key is pointing to the warning message text in "messages.properties"
* file.
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/CheckstyleTestMakeupCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/CheckstyleTestMakeupCheck.java
index 2cc0fc7b3e..2d5d72feae 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/CheckstyleTestMakeupCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/CheckstyleTestMakeupCheck.java
@@ -69,6 +69,7 @@
* @author Richard Veach
*/
public class CheckstyleTestMakeupCheck extends AbstractCheck {
+
/** Violations message. */
public static final String MSG_KEY_CONFIG_NOT_ASSIGNED = "tester.config.not.assigned";
/** Violations message. */
@@ -423,4 +424,5 @@ private void resetInternalFields() {
foundVerify = false;
violations.clear();
}
+
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ChildBlockLengthCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ChildBlockLengthCheck.java
index 4603fdf9d3..49795422ac 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ChildBlockLengthCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ChildBlockLengthCheck.java
@@ -147,13 +147,11 @@ public void visitToken(DetailAST ast) {
// if the block has braces at all
if (aOpeningBrace != null) {
-
final DetailAST aClosingBrace = closingBrace(ast);
final int parentBlockSize =
linesCount(aOpeningBrace, aClosingBrace);
if (parentBlockSize > ignoreBlockLinesCount) {
-
final List childBlocks = getChildBlocks(
aOpeningBrace, aClosingBrace);
@@ -167,7 +165,6 @@ public void visitToken(DetailAST ast) {
}
else {
for (DetailAST badBlock : badChildBlocks) {
-
final int blockSize = linesCount(badBlock);
final double allowedBlockSize = (int) (parentBlockSize
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ConstructorWithoutParamsCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ConstructorWithoutParamsCheck.java
index 48924a86c2..a43f9d9799 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ConstructorWithoutParamsCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ConstructorWithoutParamsCheck.java
@@ -159,15 +159,14 @@ public void visitToken(DetailAST ast) {
if (regexp.matcher(className).find()
&& !ignoredRegexp.matcher(className).find()
&& !ast.branchContains(TokenTypes.ARRAY_DECLARATOR)) {
-
final DetailAST parameterListAST = ast.findFirstToken(TokenTypes.ELIST);
final int numberOfParameters = parameterListAST.getChildCount();
if (numberOfParameters == 0) {
log(ast, MSG_KEY, className);
}
-
}
}
}
+
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ForbidWildcardAsReturnTypeCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ForbidWildcardAsReturnTypeCheck.java
index e15a91de18..db477b994a 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ForbidWildcardAsReturnTypeCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ForbidWildcardAsReturnTypeCheck.java
@@ -48,6 +48,7 @@
* @author Baratali Izmailov
*/
public class ForbidWildcardAsReturnTypeCheck extends AbstractCheck {
+
/**
* Key for error message.
*/
@@ -439,4 +440,5 @@ private static boolean hasBoundedWildcardAsReturnType(
}
return result;
}
+
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/HideUtilityClassConstructorCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/HideUtilityClassConstructorCheck.java
index c5b6f4df14..2ebf2efa58 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/HideUtilityClassConstructorCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/HideUtilityClassConstructorCheck.java
@@ -35,6 +35,7 @@
* @version $Revision: 1.12 $
*/
public class HideUtilityClassConstructorCheck extends AbstractCheck {
+
/**
* Warning message key.
*/
@@ -99,7 +100,6 @@ public void visitToken(DetailAST ast) {
// for the purpose of this Check
hasPublicCtor = true;
}
-
}
child = child.getNextSibling();
}
@@ -147,4 +147,5 @@ private static boolean isStatic(DetailAST ast) {
return staticAST != null;
}
+
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/InnerClassCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/InnerClassCheck.java
index 3236dfbe52..53d027fe04 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/InnerClassCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/InnerClassCheck.java
@@ -32,6 +32,7 @@
* @author Ruslan Dyachenko
*/
public class InnerClassCheck extends AbstractCheck {
+
/**
* Warning message key.
*/
@@ -83,4 +84,5 @@ public void leaveToken(DetailAST ast) {
rootClass = true;
}
}
+
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/NestedSwitchCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/NestedSwitchCheck.java
index d25a17419e..46f49aa6ff 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/NestedSwitchCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/NestedSwitchCheck.java
@@ -49,6 +49,7 @@
* @author Damian Szczepanik (damianszczepanik@github)
*/
public class NestedSwitchCheck extends AbstractCheck {
+
/**
* A key is pointing to the warning message text in "messages.properties"
* file.
@@ -102,4 +103,5 @@ public void visitToken(DetailAST aAST) {
public void leaveToken(DetailAST aAST) {
--depth;
}
+
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/NoMainMethodInAbstractClassCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/NoMainMethodInAbstractClassCheck.java
index e4a9f955e5..2d0e7637e2 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/NoMainMethodInAbstractClassCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/NoMainMethodInAbstractClassCheck.java
@@ -32,6 +32,7 @@
* @author Baratali Izmailov email
*/
public class NoMainMethodInAbstractClassCheck extends AbstractCheck {
+
/**
* Key for error message.
*/
@@ -270,4 +271,5 @@ private static boolean hasOnlyStringEllipsisParameter(final DetailAST parameters
private static boolean hasChildToken(DetailAST ast, int tokenType) {
return ast.findFirstToken(tokenType) != null;
}
+
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/PublicReferenceToPrivateTypeCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/PublicReferenceToPrivateTypeCheck.java
index 5e959e6cd8..b553ef74f0 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/PublicReferenceToPrivateTypeCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/PublicReferenceToPrivateTypeCheck.java
@@ -73,6 +73,7 @@
* @author Aleksey Nesterenko
*/
public class PublicReferenceToPrivateTypeCheck extends AbstractCheck {
+
/**
* Check message key for private types.
*/
@@ -203,7 +204,6 @@ private void addExternallyAccessibleFieldTypes(DetailAST fieldDefAst) {
*/
private static List
getMethodOrFieldReferencedTypes(DetailAST typeAst) {
-
DetailAST returnedType = null;
final List returnedTypes = new ArrayList<>();
DetailAST currentNode = typeAst;
@@ -242,11 +242,9 @@ private void addExternallyAccessibleFieldTypes(DetailAST fieldDefAst) {
parameterTypes.add(parameterType);
}
}
-
}
currentNode = Utils.getNextSubTreeNode(currentNode, parametersDefAst);
}
-
}
return parameterTypes;
@@ -294,7 +292,6 @@ private boolean isExtendsOrImplementsSmth(DetailAST classOrInterfaceDefAst) {
.add(implementingOrExtendingAst.getText());
}
}
-
}
currentNode = Utils.getNextSubTreeNode(currentNode, classOrInterfaceDefAst);
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/StaticMethodCandidateCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/StaticMethodCandidateCheck.java
index 28240d9af7..0698849063 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/StaticMethodCandidateCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/StaticMethodCandidateCheck.java
@@ -695,6 +695,7 @@ private static boolean checkFieldLocation(DetailAST field, DetailAST objCalledOn
* Contains information about the frame.
*/
private static class Frame {
+
/** Name of the class, enum or method. */
private String frameName;
@@ -835,5 +836,7 @@ public boolean apply(DetailAST enumConstant) {
};
return Iterables.tryFind(enumConstants, predicate);
}
+
}
+
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/naming/EnumValueNameCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/naming/EnumValueNameCheck.java
index 32a9e5bfa8..b8764ae333 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/naming/EnumValueNameCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/naming/EnumValueNameCheck.java
@@ -49,6 +49,7 @@
* @author Pavel Baranchikov
*/
public class EnumValueNameCheck extends AbstractNameCheck {
+
/**
* Default pattern for Values Enumeration names.
*/
@@ -81,4 +82,5 @@ public int[] getRequiredTokens() {
protected boolean mustCheckName(DetailAST ast) {
return true;
}
+
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/naming/InterfaceTypeParameterNameCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/naming/InterfaceTypeParameterNameCheck.java
index 92c66d2649..6b9ee1f6aa 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/naming/InterfaceTypeParameterNameCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/naming/InterfaceTypeParameterNameCheck.java
@@ -80,4 +80,5 @@ protected final boolean mustCheckName(DetailAST ast) {
return location.getType() == TokenTypes.INTERFACE_DEF;
}
+
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/naming/UniformEnumConstantNameCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/naming/UniformEnumConstantNameCheck.java
index 815646012f..07d36cad54 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/naming/UniformEnumConstantNameCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/naming/UniformEnumConstantNameCheck.java
@@ -76,6 +76,7 @@
* @author Pavel Baranchikov
*/
public class UniformEnumConstantNameCheck extends AbstractCheck {
+
/**
* Message code for format violations. Used, when more than one format
* violated.
@@ -226,4 +227,5 @@ private BitSet match(String name, BitSet conformedPatterns) {
}
return result;
}
+
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/sizes/LineLengthExtendedCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/sizes/LineLengthExtendedCheck.java
index f9a072c118..09e5bedbe8 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/sizes/LineLengthExtendedCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/sizes/LineLengthExtendedCheck.java
@@ -88,6 +88,7 @@
* @author Ruslan Dyachenko
*/
public class LineLengthExtendedCheck extends AbstractCheck {
+
/** Warning message key. */
public static final String MSG_KEY = "maxLineLen";
@@ -231,7 +232,6 @@ public void beginTree(DetailAST rootAST) {
@Override
public void finishTree(DetailAST rootAST) {
for (int i = 0; i < lines.length; i++) {
-
if (lines[i] == null) {
continue;
}
@@ -271,4 +271,5 @@ public final void setIgnorePattern(String format) {
throw new IllegalArgumentException("unable to parse " + format, ex);
}
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/BaseCheckTestSupport.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/BaseCheckTestSupport.java
index aeae518cf2..7e1da5b8a1 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/BaseCheckTestSupport.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/BaseCheckTestSupport.java
@@ -45,6 +45,7 @@
import com.puppycrawl.tools.checkstyle.api.Configuration;
public abstract class BaseCheckTestSupport {
+
private final ByteArrayOutputStream baos = new ByteArrayOutputStream();
private final PrintStream printStream = new PrintStream(baos);
@@ -182,5 +183,7 @@ public void fileFinished(AuditEvent evt) {
@Override
public void fileStarted(AuditEvent evt) {
}
+
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/UtilsTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/UtilsTest.java
index 4f4dda14f0..1853c07608 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/UtilsTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/UtilsTest.java
@@ -28,6 +28,7 @@
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
public class UtilsTest {
+
@Test
public void testIsProperUtilsClass() throws ReflectiveOperationException {
assertUtilsClassHasPrivateConstructor(Utils.class);
@@ -43,4 +44,5 @@ public void testReportInvalidToken() {
Assert.assertEquals("Found unsupported token: CLASS_DEF", ex.getMessage());
}
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationCheckTest.java
index f777449589..0b0bb459b4 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationCheckTest.java
@@ -166,4 +166,5 @@ public void testEnumIsForbidden() throws Exception {
verify(checkConfig, getPath("InputForbidAnnotationCheck.java"), expected7);
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationElementValueCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationElementValueCheckTest.java
index b46813dc90..c0359932f0 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationElementValueCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationElementValueCheckTest.java
@@ -27,6 +27,7 @@
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
public class ForbidAnnotationElementValueCheckTest extends BaseCheckTestSupport {
+
@Test
public void testAnnotationWithStringParameter() throws Exception {
final DefaultConfiguration checkConfig =
@@ -212,4 +213,5 @@ public void testFullAnnotationClasspath() throws Exception {
verify(checkConfig, getPath("InputForbidAnnotationElementValueCheck2.java"), expected);
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidConstantAsFirstOperandInConditionCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidConstantAsFirstOperandInConditionCheckTest.java
index 0b0decb64a..3bd58f84ec 100755
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidConstantAsFirstOperandInConditionCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidConstantAsFirstOperandInConditionCheckTest.java
@@ -78,7 +78,6 @@ public void testAttributes() throws Exception {
};
verify(checkConfig, getPath("InputAvoidConstantAsFirstOperandInConditionCheck.java"),
expected);
-
}
@Test
@@ -122,4 +121,5 @@ public void testNullProperties() throws Exception {
verify(checkConfig, getPath("InputAvoidConstantAsFirstOperandInConditionCheck.java"),
expected);
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidDefaultSerializableInInnerClassesCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidDefaultSerializableInInnerClassesCheckTest.java
index 0be959ba9a..657aa93dec 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidDefaultSerializableInInnerClassesCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidDefaultSerializableInInnerClassesCheckTest.java
@@ -28,6 +28,7 @@
public class AvoidDefaultSerializableInInnerClassesCheckTest extends
BaseCheckTestSupport {
+
private final String warningMessage = getCheckMessage(MSG_KEY);
@Test
@@ -106,4 +107,5 @@ public void testWithAllowPartiaTrue()
verify(checkConfig, getPath("InputAvoidDefaultSerializableInInnerClassesCheck1.java"),
expected);
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidModifiersForTypesCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidModifiersForTypesCheckTest.java
index d056b6c878..69ec3caf0b 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidModifiersForTypesCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidModifiersForTypesCheckTest.java
@@ -318,4 +318,5 @@ public void testUnsupportedModifier() {
Assert.assertEquals("Found unsupported token: LITERAL_SYNCHRONIZED", ex.getMessage());
}
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidNotShortCircuitOperatorsForBooleanCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidNotShortCircuitOperatorsForBooleanCheckTest.java
index d42825b769..5d0460da06 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidNotShortCircuitOperatorsForBooleanCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidNotShortCircuitOperatorsForBooleanCheckTest.java
@@ -63,4 +63,5 @@ public final void testNonClasses() throws Exception {
getPath("InputAvoidNotShortCircuitOperatorsForBooleanCheckNonClasses.java"),
CommonUtils.EMPTY_STRING_ARRAY);
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ConfusingConditionCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ConfusingConditionCheckTest.java
index fb0a8b4b65..f6491b37ac 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ConfusingConditionCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ConfusingConditionCheckTest.java
@@ -137,4 +137,5 @@ public void testExceptions() throws Exception {
verify(checkConfig, getPath("InputConfusingConditionCheck2.java"),
expected);
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheckTest.java
index 88799991bb..8be87b87c5 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheckTest.java
@@ -183,4 +183,5 @@ public void mainMethod()
checkConfig.addAttribute("caseSensitive", "false");
verify(checkConfig, getPath("InputCustomDeclarationOrderCheckMainMethod.java"), expected);
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/DiamondOperatorForVariableDefinitionCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/DiamondOperatorForVariableDefinitionCheckTest.java
index 4086f7007d..f68069e789 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/DiamondOperatorForVariableDefinitionCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/DiamondOperatorForVariableDefinitionCheckTest.java
@@ -27,6 +27,7 @@
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
public class DiamondOperatorForVariableDefinitionCheckTest extends BaseCheckTestSupport {
+
@Test
public void testDefault() throws Exception {
final DefaultConfiguration checkConfig =
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/EitherLogOrThrowCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/EitherLogOrThrowCheckTest.java
index 294fd1a33d..d7e4a6bd48 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/EitherLogOrThrowCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/EitherLogOrThrowCheckTest.java
@@ -31,6 +31,7 @@
* @author Baratali Izmailov
*/
public class EitherLogOrThrowCheckTest extends BaseCheckTestSupport {
+
private final String warningMessage = getCheckMessage(MSG_KEY);
@Test
@@ -59,4 +60,5 @@ public void test() throws Exception {
verify(checkConfig, getPath("InputEitherLogOrThrowCheck.java"),
expected);
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/EmptyPublicCtorInClassCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/EmptyPublicCtorInClassCheckTest.java
index e284b446e2..523a60328d 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/EmptyPublicCtorInClassCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/EmptyPublicCtorInClassCheckTest.java
@@ -31,6 +31,7 @@
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
public class EmptyPublicCtorInClassCheckTest extends BaseCheckTestSupport {
+
private final String message = getCheckMessage(MSG_KEY);
@Test
@@ -183,4 +184,5 @@ public void testUnsupportedNode() {
Assert.assertEquals("Found unsupported token: LITERAL_SYNCHRONIZED", ex.getMessage());
}
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/FinalizeImplementationCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/FinalizeImplementationCheckTest.java
index 3d1862e759..fbff450cd5 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/FinalizeImplementationCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/FinalizeImplementationCheckTest.java
@@ -59,4 +59,5 @@ public final void testSpecialFinalize() throws Exception {
verify(checkConfig, getPath("InputFinalizeImplementationCheckSpecial.java"),
expected);
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidCCommentsInMethodsCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidCCommentsInMethodsCheckTest.java
index 595b8c5ad2..34e52cda37 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidCCommentsInMethodsCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidCCommentsInMethodsCheckTest.java
@@ -28,12 +28,12 @@
public class ForbidCCommentsInMethodsCheckTest extends
BaseCheckTestSupport {
+
private final String warningMessage = getCheckMessage(MSG_KEY);
@Test
public void defaultTest()
throws Exception {
-
final DefaultConfiguration checkConfig =
createModuleConfig(ForbidCCommentsInMethodsCheck.class);
final String[] expected = {
@@ -66,4 +66,5 @@ public void testInterface()
final String[] expected = {};
verify(checkConfig, getPath("InputForbidCCommentsInMethodsCheck3.java"), expected);
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidCertainImportsCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidCertainImportsCheckTest.java
index eed5a0f07c..f480cd395e 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidCertainImportsCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidCertainImportsCheckTest.java
@@ -35,9 +35,9 @@
* Yaroslavtsev
*/
public class ForbidCertainImportsCheckTest extends BaseCheckTestSupport {
+
@Test
public void testNormalWork() throws Exception {
-
final DefaultConfiguration checkConfig =
createModuleConfig(ForbidCertainImportsCheck.class);
checkConfig.addAttribute("packageNameRegexp", ".+\\.sevntu\\..+");
@@ -208,4 +208,5 @@ public void testUnsupportedNode() {
Assert.assertEquals("Found unsupported token: LITERAL_SYNCHRONIZED", ex.getMessage());
}
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidInstantiationCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidInstantiationCheckTest.java
index 9a20f8b9a8..e0073c34ac 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidInstantiationCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidInstantiationCheckTest.java
@@ -35,6 +35,7 @@
* Yaroslavtsev
*/
public class ForbidInstantiationCheckTest extends BaseCheckTestSupport {
+
@Test
public void testNullProperties() throws Exception {
final DefaultConfiguration checkConfig =
@@ -133,4 +134,5 @@ public void testUnsupportedNode() {
Assert.assertEquals("Found unsupported token: LITERAL_SYNCHRONIZED", ex.getMessage());
}
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidReturnInFinallyBlockCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidReturnInFinallyBlockCheckTest.java
index de58133712..8b99dbcf42 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidReturnInFinallyBlockCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidReturnInFinallyBlockCheckTest.java
@@ -28,6 +28,7 @@
public class ForbidReturnInFinallyBlockCheckTest
extends BaseCheckTestSupport {
+
/**
* An error message for current check.
*/
@@ -48,4 +49,5 @@ public void testDefault()
verify(checkConfig, getPath("InputForbidReturnInFinallyBlockCheck.java"),
expected);
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/IllegalCatchExtendedCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/IllegalCatchExtendedCheckTest.java
index 27a329340e..a80b469fc1 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/IllegalCatchExtendedCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/IllegalCatchExtendedCheckTest.java
@@ -100,4 +100,5 @@ public void testIllegalClassNames() throws Exception {
verify(checkConfig, getPath("InputIllegalCatchExtendedCheckNew.java"), expected);
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/LogicConditionNeedOptimizationCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/LogicConditionNeedOptimizationCheckTest.java
index fc9d69d732..0463a3e05a 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/LogicConditionNeedOptimizationCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/LogicConditionNeedOptimizationCheckTest.java
@@ -53,4 +53,5 @@ public void test() throws Exception {
};
verify(checkConfig, getPath("InputLogicConditionNeedOptimizationCheck.java"), expected);
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MoveVariableInsideIfCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MoveVariableInsideIfCheckTest.java
index 22c1359836..a407af37c9 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MoveVariableInsideIfCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MoveVariableInsideIfCheckTest.java
@@ -28,6 +28,7 @@
import com.puppycrawl.tools.checkstyle.utils.CommonUtils;
public class MoveVariableInsideIfCheckTest extends BaseCheckTestSupport {
+
@Test
public final void testNoViolations() throws Exception {
final DefaultConfiguration checkConfig =
@@ -62,4 +63,5 @@ public final void testFalsePositives() throws Exception {
verify(checkConfig, getPath("InputMoveVariableInsideIfCheckFalsePositives.java"),
expected);
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MultipleStringLiteralsExtendedCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MultipleStringLiteralsExtendedCheckTest.java
index b073457321..d7168db7af 100755
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MultipleStringLiteralsExtendedCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MultipleStringLiteralsExtendedCheckTest.java
@@ -27,6 +27,7 @@
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
public class MultipleStringLiteralsExtendedCheckTest extends BaseCheckTestSupport {
+
@Test
public void testIt() throws Exception {
final DefaultConfiguration checkConfig =
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MultipleVariableDeclarationsExtendedCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MultipleVariableDeclarationsExtendedCheckTest.java
index 2f62a3494d..0d457e9a5a 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MultipleVariableDeclarationsExtendedCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MultipleVariableDeclarationsExtendedCheckTest.java
@@ -29,6 +29,7 @@
/** Test class. */
public class MultipleVariableDeclarationsExtendedCheckTest extends BaseCheckTestSupport {
+
private final String msgVarDeclarationsComa = getCheckMessage(MSG_VAR_DECLARATIONS_COMMA);
private final String msgVarDeclarations = getCheckMessage(MSG_VAR_DECLARATIONS);
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NameConventionForJunit4TestClassesCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NameConventionForJunit4TestClassesCheckTest.java
index 1e225176dd..b28df81151 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NameConventionForJunit4TestClassesCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NameConventionForJunit4TestClassesCheckTest.java
@@ -31,6 +31,7 @@
* @author Zuy Alexey
*/
public class NameConventionForJunit4TestClassesCheckTest extends BaseCheckTestSupport {
+
private final String msgFormat =
getCheckMessage(NameConventionForJunit4TestClassesCheck.MSG_KEY);
@@ -215,4 +216,5 @@ public void testEmptyProperties()
private String buildMesssage(String lineNumber, String arguments) {
return lineNumber + MessageFormat.format(msgFormat, arguments);
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NoNullForCollectionReturnCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NoNullForCollectionReturnCheckTest.java
index 8c687ff1dc..e908399056 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NoNullForCollectionReturnCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NoNullForCollectionReturnCheckTest.java
@@ -176,4 +176,5 @@ public void testConstructor()
verify(checkConfig, getPath("InputNoNullForCollectionReturnCheckConstructor.java"),
expected);
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/OverridableMethodInConstructorCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/OverridableMethodInConstructorCheckTest.java
index dbe1539515..32f40aa959 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/OverridableMethodInConstructorCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/OverridableMethodInConstructorCheckTest.java
@@ -447,4 +447,5 @@ public final void testFinalClass() throws Exception {
verify(checkConfig, getPath("InputOverridableMethodInConstructorCheck25.java"), expected);
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/RedundantReturnCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/RedundantReturnCheckTest.java
index 7d5e2348a2..c4deb0980d 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/RedundantReturnCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/RedundantReturnCheckTest.java
@@ -31,6 +31,7 @@
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
public class RedundantReturnCheckTest extends BaseCheckTestSupport {
+
@Test
public void testInputWithIgnoreEmptyConstructorsTrue()
throws Exception {
@@ -84,7 +85,6 @@ public void testInputWithIgnoreEmptyConstructorsFalse()
};
verify(checkConfig, getPath("InputRedundantReturnCheck.java"), expected);
-
}
@Test
@@ -96,7 +96,6 @@ public void testForNullPointerExceptionsPresence()
verify(checkConfig, "src/test/resources-noncompilable/com/github/sevntu/checkstyle/checks/"
+ "coding/InputRedundantReturnCheckTestNPE.java", expected);
-
}
@Test
@@ -107,7 +106,6 @@ public void testForNullPointerExceptionsInInterface()
final String[] expected = {};
verify(checkConfig, getPath("InputRedundantReturnCheckMethodInInterface.java"), expected);
-
}
@Test
@@ -118,7 +116,6 @@ public void testSomeFalsePositiveCase()
final String[] expected = {};
verify(checkConfig, getPath("InputRedundantReturnCheckFalsePositive.java"), expected);
-
}
@Test
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/RequireFailForTryCatchInJunitCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/RequireFailForTryCatchInJunitCheckTest.java
index f6cf7a19cd..f3c7ac0322 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/RequireFailForTryCatchInJunitCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/RequireFailForTryCatchInJunitCheckTest.java
@@ -32,6 +32,7 @@
import com.puppycrawl.tools.checkstyle.utils.CommonUtils;
public class RequireFailForTryCatchInJunitCheckTest extends BaseCheckTestSupport {
+
@Test
public void testIndifferent1() throws Exception {
final DefaultConfiguration checkConfig =
@@ -105,4 +106,5 @@ public void testUnsupportedNode() {
Assert.assertEquals("Found unsupported token: LITERAL_SYNCHRONIZED", ex.getMessage());
}
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnBooleanFromTernaryCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnBooleanFromTernaryCheckTest.java
index b79aa35bd0..a0d1941597 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnBooleanFromTernaryCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnBooleanFromTernaryCheckTest.java
@@ -45,4 +45,5 @@ public void testDefault() throws Exception {
};
verify(checkConfig, getPath("InputReturnBooleanFromTernaryCheck.java"), expected);
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnCountExtendedCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnCountExtendedCheckTest.java
index b64561fe1a..e29d138c96 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnCountExtendedCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnCountExtendedCheckTest.java
@@ -296,4 +296,5 @@ public void testLambda() throws Exception {
verify(checkConfig, getPath("InputReturnCountExtendedCheckLambdas.java"), expected);
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnNullInsteadOfBooleanCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnNullInsteadOfBooleanCheckTest.java
index 8b8d278516..482bd93976 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnNullInsteadOfBooleanCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnNullInsteadOfBooleanCheckTest.java
@@ -76,4 +76,5 @@ public void testUnsupportedNodeLeave() {
Assert.assertEquals("Found unsupported token: LITERAL_SYNCHRONIZED", ex.getMessage());
}
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/SimpleAccessorNameNotationCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/SimpleAccessorNameNotationCheckTest.java
index 404c55be15..94f363e1f5 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/SimpleAccessorNameNotationCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/SimpleAccessorNameNotationCheckTest.java
@@ -175,4 +175,5 @@ public void testInterface() throws Exception {
final String[] expected = {};
verify(checkConfig, getPath("InputSimpleAccessorNameNotationCheck7.java"), expected);
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UnnecessaryParenthesesExtendedCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UnnecessaryParenthesesExtendedCheckTest.java
index 821c82766f..6ac73cd102 100755
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UnnecessaryParenthesesExtendedCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UnnecessaryParenthesesExtendedCheckTest.java
@@ -38,6 +38,7 @@
* @author Antonenko Dmitriy
*/
public class UnnecessaryParenthesesExtendedCheckTest extends BaseCheckTestSupport {
+
@Test
public void testDefault() throws Exception {
final DefaultConfiguration checkConfig =
@@ -165,4 +166,5 @@ public void testUbv() throws Exception {
checkConfig.addAttribute("ignoreCalculationOfBooleanVariablesWithAssert", "true");
verify(checkConfig, getPath("InputUnnecessaryParenthesesExtendedCheckUbv.java"), expected);
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UselessSingleCatchCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UselessSingleCatchCheckTest.java
index 0245160c9a..c38f092df3 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UselessSingleCatchCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UselessSingleCatchCheckTest.java
@@ -27,6 +27,7 @@
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
public class UselessSingleCatchCheckTest extends BaseCheckTestSupport {
+
private final String warningMessage = getCheckMessage(MSG_KEY);
@Test
@@ -70,4 +71,5 @@ public void testUselessCatch() throws Exception {
verify(config, getPath("InputUselessSingleCatchCheck5.java"), expected);
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UselessSuperCtorCallCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UselessSuperCtorCallCheckTest.java
index 8c40b7c6b9..e9613de632 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UselessSuperCtorCallCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UselessSuperCtorCallCheckTest.java
@@ -28,6 +28,7 @@
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
public class UselessSuperCtorCallCheckTest extends BaseCheckTestSupport {
+
@Test
public void testSingleCtorWithSuperWithinNotDerivedClass()
throws Exception {
@@ -112,4 +113,5 @@ public void testOptionAllowCallToNoArgsSuperCtorIfMultiplePublicCtor()
verify(checkConfig, getPath("InputUselessSuperCtorCallCheck7.java"), expected);
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/WhitespaceBeforeArrayInitializerCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/WhitespaceBeforeArrayInitializerCheckTest.java
index 906bb45df2..c689b9fed3 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/WhitespaceBeforeArrayInitializerCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/WhitespaceBeforeArrayInitializerCheckTest.java
@@ -27,6 +27,7 @@
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
public class WhitespaceBeforeArrayInitializerCheckTest extends BaseCheckTestSupport {
+
@Test
public void testWhitespaceBeforeArrayInitializer() throws Exception {
final DefaultConfiguration mDefaultConfig =
@@ -41,4 +42,5 @@ public void testWhitespaceBeforeArrayInitializer() throws Exception {
verify(mDefaultConfig, getPath("InputWhitespaceBeforeArrayInitializerCheck.java"),
expected);
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/AvoidConditionInversionCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/AvoidConditionInversionCheckTest.java
index 820fa303b3..35ffaa72e3 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/AvoidConditionInversionCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/AvoidConditionInversionCheckTest.java
@@ -36,6 +36,7 @@
*
*/
public class AvoidConditionInversionCheckTest extends BaseCheckTestSupport {
+
@Test
public void defaultTest() throws Exception {
final DefaultConfiguration checkConfig =
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/CauseParameterInExceptionCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/CauseParameterInExceptionCheckTest.java
index 8bf4b20793..5f9d173a8c 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/CauseParameterInExceptionCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/CauseParameterInExceptionCheckTest.java
@@ -35,6 +35,7 @@
* Yaroslavtsev
*/
public class CauseParameterInExceptionCheckTest extends BaseCheckTestSupport {
+
@Test
public void testNormalWork() throws Exception {
final DefaultConfiguration checkConfig =
@@ -167,4 +168,5 @@ public void testUnsupportedNode() {
Assert.assertEquals("Found unsupported token: LITERAL_SYNCHRONIZED", ex.getMessage());
}
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/CheckstyleTestMakeupCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/CheckstyleTestMakeupCheckTest.java
index 07eb96291d..38f3c1900a 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/CheckstyleTestMakeupCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/CheckstyleTestMakeupCheckTest.java
@@ -35,6 +35,7 @@
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
public class CheckstyleTestMakeupCheckTest extends BaseCheckTestSupport {
+
@Test
public void testMiscFile() throws Exception {
final DefaultConfiguration checkConfig =
@@ -119,4 +120,5 @@ public void testInvalidToken() {
Assert.assertEquals("Found unsupported token: OBJBLOCK", ex.getMessage());
}
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ChildBlockLengthCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ChildBlockLengthCheckTest.java
index e4473add1f..76f1913b93 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ChildBlockLengthCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ChildBlockLengthCheckTest.java
@@ -31,6 +31,7 @@
* Yaroslavtsev
*/
public class ChildBlockLengthCheckTest extends BaseCheckTestSupport {
+
@Test
public void testNpeOnAllBlockTypes() throws Exception {
final DefaultConfiguration checkConfig = createModuleConfig(ChildBlockLengthCheck.class);
@@ -147,4 +148,5 @@ public void testNestedClass() throws Exception {
verify(checkConfig, getPath("InputChildBlockLengthCheckNestedClass.java"), expected);
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ForbidWildcardAsReturnTypeCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ForbidWildcardAsReturnTypeCheckTest.java
index 47032700d6..23fe22f37f 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ForbidWildcardAsReturnTypeCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ForbidWildcardAsReturnTypeCheckTest.java
@@ -36,6 +36,7 @@
* @author Baratali Izmailov
*/
public class ForbidWildcardAsReturnTypeCheckTest extends BaseCheckTestSupport {
+
/**
* Line numbers with methods which have wildcard in return type.
*/
@@ -454,4 +455,5 @@ private String[] createExpectedMessages(SortedSet aLines) {
}
return expected;
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/HideUtilityClassConstructorCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/HideUtilityClassConstructorCheckTest.java
index 37f137af67..b11c478187 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/HideUtilityClassConstructorCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/HideUtilityClassConstructorCheckTest.java
@@ -28,6 +28,7 @@
public class HideUtilityClassConstructorCheckTest
extends BaseCheckTestSupport {
+
/** Only static methods and no constructor - default ctor is visible */
@Test
public void testUtilClass() throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/InnerClassCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/InnerClassCheckTest.java
index f44e52cb66..36244582d9 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/InnerClassCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/InnerClassCheckTest.java
@@ -49,4 +49,5 @@ public void testMembersBeforeInner() throws Exception {
};
verify(checkConfig, getPath("InputInnerClassCheck.java"), expected);
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/NestedSwitchCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/NestedSwitchCheckTest.java
index 6c9b4e334f..2ffff2dce9 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/NestedSwitchCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/NestedSwitchCheckTest.java
@@ -31,6 +31,7 @@
* @author Damian Szczepanik (damianszczepanik@github)
*/
public class NestedSwitchCheckTest extends BaseCheckTestSupport {
+
@Test
public void testSimple() throws Exception {
final DefaultConfiguration checkConfig = createModuleConfig(NestedSwitchCheck.class);
@@ -59,4 +60,5 @@ public void testMax() throws Exception {
verify(checkConfig, getPath("InputNestedSwitchCheck.java"),
expected);
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/NoMainMethodInAbstractClassCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/NoMainMethodInAbstractClassCheckTest.java
index 505bca66de..7ebc76865c 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/NoMainMethodInAbstractClassCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/NoMainMethodInAbstractClassCheckTest.java
@@ -31,6 +31,7 @@
* @author Baratali Izmailov
*/
public class NoMainMethodInAbstractClassCheckTest extends BaseCheckTestSupport {
+
/**
* Name of file with messages.
*/
@@ -80,4 +81,5 @@ public final void testDefault()
getPath("InputNoMainMethodInAbstractClassCheck.java"),
expected);
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/PublicReferenceToPrivateTypeCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/PublicReferenceToPrivateTypeCheckTest.java
index 31c60596cb..42cfa1b5db 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/PublicReferenceToPrivateTypeCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/PublicReferenceToPrivateTypeCheckTest.java
@@ -35,6 +35,7 @@
*/
public class PublicReferenceToPrivateTypeCheckTest extends
BaseCheckTestSupport {
+
/**
* Test file without method return instance of private class.
* @throws Exception
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/StaticMethodCandidateCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/StaticMethodCandidateCheckTest.java
index 17e3e3bee1..0e149b0cc3 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/StaticMethodCandidateCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/StaticMethodCandidateCheckTest.java
@@ -145,4 +145,5 @@ public void testInterface() throws Exception {
+ "sevntu/checkstyle/checks/design/InputStaticMethodCandidateCheckInterfaceMethod.java")
.getCanonicalPath(), expected);
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/EnumValueNameCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/EnumValueNameCheckTest.java
index 64cd91177d..5731cc7e4f 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/EnumValueNameCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/EnumValueNameCheckTest.java
@@ -28,6 +28,7 @@
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
public class EnumValueNameCheckTest extends BaseCheckTestSupport {
+
@Test
public void testDefault()
throws Exception {
@@ -61,4 +62,5 @@ public void testCustomFormat()
};
verify(checkConfig, getPath("InputEnumValueNameCheck.java"), expected);
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/InterfaceTypeParameterNameCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/InterfaceTypeParameterNameCheckTest.java
index 59cdeb8d99..efa20e65da 100755
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/InterfaceTypeParameterNameCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/InterfaceTypeParameterNameCheckTest.java
@@ -26,6 +26,7 @@
public class InterfaceTypeParameterNameCheckTest
extends BaseCheckTestSupport {
+
/** Warning message key. */
private static final String MSG_KEY = "name.invalidPattern";
@@ -58,4 +59,5 @@ public void testInterfaceFooName()
};
verify(checkConfig, getPath("InputInterfaceTypeParameterNameCheck.java"), expected);
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/UniformEnumConstantNameCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/UniformEnumConstantNameCheckTest.java
index 633489f827..018510e27a 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/UniformEnumConstantNameCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/UniformEnumConstantNameCheckTest.java
@@ -36,6 +36,7 @@
* @author Pavel Baranchikov
*/
public class UniformEnumConstantNameCheckTest extends BaseCheckTestSupport {
+
private final String inputFile;
public UniformEnumConstantNameCheckTest() {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/sizes/LineLengthExtendedCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/sizes/LineLengthExtendedCheckTest.java
index 7cd823a9f2..2ef5a611fc 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/sizes/LineLengthExtendedCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/sizes/LineLengthExtendedCheckTest.java
@@ -30,6 +30,7 @@
import com.puppycrawl.tools.checkstyle.api.CheckstyleException;
public class LineLengthExtendedCheckTest extends BaseCheckTestSupport {
+
@Test
public void testSimple()
throws Exception {
@@ -95,4 +96,5 @@ public void testProperty() throws Exception {
+ "Cannot set property 'ignorePattern' to '[' in module "));
}
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/AllChecksTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/AllChecksTest.java
index 0d38664f93..421c807901 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/AllChecksTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/AllChecksTest.java
@@ -329,4 +329,5 @@ private static boolean isSubset(int[] array, int... arrayToCheckIn) {
}
return result;
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckUtil.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckUtil.java
index c2164ad6bb..9c0da79a5f 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckUtil.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckUtil.java
@@ -44,6 +44,7 @@
import com.puppycrawl.tools.checkstyle.api.Filter;
public final class CheckUtil {
+
private CheckUtil() {
}
@@ -294,4 +295,5 @@ public static String getCheckMessage(Class> module, String messageKey,
}
return result;
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/ChecksTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/ChecksTest.java
index 43d0b746cb..4dd0960cc8 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/ChecksTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/ChecksTest.java
@@ -46,6 +46,7 @@
import com.puppycrawl.tools.checkstyle.checks.javadoc.AbstractJavadocCheck;
public final class ChecksTest {
+
private static final Set CHECK_PROPERTIES = getProperties(AbstractCheck.class);
private static final Set JAVADOC_CHECK_PROPERTIES =
getProperties(AbstractJavadocCheck.class);
@@ -426,4 +427,5 @@ private static String getSonarPath(String filename) throws IOException {
"../sevntu-checkstyle-sonar-plugin/src/main/resources/com/github/sevntu/"
+ "checkstyle/sonar/" + filename).getCanonicalPath();
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckstyleRegressionTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckstyleRegressionTest.java
index a0452218bd..4cedcc87ce 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckstyleRegressionTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckstyleRegressionTest.java
@@ -33,6 +33,7 @@
import org.junit.Test;
public class CheckstyleRegressionTest {
+
/** List of checks to suppress if we dynamically add it to the configuration. */
private static final List ADD_CHECK_SUPPRESSIONS = Arrays
.asList("ReturnCountExtendedCheck");
@@ -175,4 +176,5 @@ private static int findCheck(Collection> checks, String findCheck) {
return -1;
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CommitValidationTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CommitValidationTest.java
index d4e8400dca..e6b2852802 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CommitValidationTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CommitValidationTest.java
@@ -290,10 +290,13 @@ private static String getInvalidCommitMessageFormattingError(String commitId,
}
private enum CommitsResolutionMode {
+
BY_COUNTER, BY_LAST_COMMIT_AUTHOR
+
}
private static class RevCommitsPair {
+
private final Iterator first;
private final Iterator second;
@@ -314,6 +317,7 @@ public Iterator getFirst() {
public Iterator getSecond() {
return second;
}
+
}
private static class OmitMergeCommitsIterator implements Iterator {
@@ -342,5 +346,7 @@ public RevCommit next() {
public void remove() {
throw new UnsupportedOperationException("remove");
}
+
}
+
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/XmlUtil.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/XmlUtil.java
index 9ac557a17a..2f84ab4fc9 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/XmlUtil.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/XmlUtil.java
@@ -36,6 +36,7 @@
import org.xml.sax.SAXException;
public final class XmlUtil {
+
private XmlUtil() {
}
@@ -95,4 +96,5 @@ public static Set findElementsByTag(Set nodes, String tag) {
return result;
}
+
}
diff --git a/sevntu-checkstyle-sonar-plugin/src/main/java/com/github/sevntu/checkstyle/sonar/CheckstyleExtensionPlugin.java b/sevntu-checkstyle-sonar-plugin/src/main/java/com/github/sevntu/checkstyle/sonar/CheckstyleExtensionPlugin.java
index 49704a952d..9965a53c1a 100644
--- a/sevntu-checkstyle-sonar-plugin/src/main/java/com/github/sevntu/checkstyle/sonar/CheckstyleExtensionPlugin.java
+++ b/sevntu-checkstyle-sonar-plugin/src/main/java/com/github/sevntu/checkstyle/sonar/CheckstyleExtensionPlugin.java
@@ -34,4 +34,5 @@ public final class CheckstyleExtensionPlugin extends SonarPlugin {
public List> getExtensions() {
return Arrays.asList(CheckstyleExtensionRepository.class);
}
+
}
diff --git a/sevntu-checkstyle-sonar-plugin/src/main/java/com/github/sevntu/checkstyle/sonar/CheckstyleExtensionRepository.java b/sevntu-checkstyle-sonar-plugin/src/main/java/com/github/sevntu/checkstyle/sonar/CheckstyleExtensionRepository.java
index 2a6da1aba9..561d954c60 100644
--- a/sevntu-checkstyle-sonar-plugin/src/main/java/com/github/sevntu/checkstyle/sonar/CheckstyleExtensionRepository.java
+++ b/sevntu-checkstyle-sonar-plugin/src/main/java/com/github/sevntu/checkstyle/sonar/CheckstyleExtensionRepository.java
@@ -79,4 +79,5 @@ public List createRules() {
IOUtils.closeQuietly(input);
}
}
+
}
From 52df1b79fcb39d351f99befe69a35a2a2a6341a5 Mon Sep 17 00:00:00 2001
From: Timur Tibeyev
Date: Tue, 26 Dec 2017 15:48:42 +0600
Subject: [PATCH 137/208] minor: add property, the path to future
xpath-suppressions config file
---
sevntu-checks/checkstyle.properties | 1 +
1 file changed, 1 insertion(+)
diff --git a/sevntu-checks/checkstyle.properties b/sevntu-checks/checkstyle.properties
index 53c8f47cd9..b33a3850a5 100644
--- a/sevntu-checks/checkstyle.properties
+++ b/sevntu-checks/checkstyle.properties
@@ -1,4 +1,5 @@
checkstyle.suppressions.file=suppressions.xml
+checkstyle.suppressions-xpath.file=suppressions.xml
checkstyle.header.file=https://raw.githubusercontent.com/checkstyle/checkstyle/master/config/java.header
checkstyle.regexp.header.file=https://raw.githubusercontent.com/checkstyle/checkstyle/master/config/java_regexp.header
checkstyle.importcontrol.file=import-control.xml
From 697ce423968df4199e29b8ea9d78ee4dcba35d5a Mon Sep 17 00:00:00 2001
From: Roman Ivanov
Date: Sat, 30 Dec 2017 11:51:51 -0800
Subject: [PATCH 138/208] config: bump checkstyle version
---
sevntu-checks/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml
index 1a1381ea27..958e92eb4f 100644
--- a/sevntu-checks/pom.xml
+++ b/sevntu-checks/pom.xml
@@ -16,7 +16,7 @@
iso-8859-1
- 8.5
+ 8.6https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.version}/config/checkstyle_checks.xml7.6
From 2165d18f511a952e5e159134c35a0ef7270ac7f0 Mon Sep 17 00:00:00 2001
From: Roman Ivanov
Date: Mon, 1 Jan 2018 10:43:38 -0800
Subject: [PATCH 139/208] config: bump checkstyle version
---
sevntu-checks/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml
index 958e92eb4f..abdd552e28 100644
--- a/sevntu-checks/pom.xml
+++ b/sevntu-checks/pom.xml
@@ -16,7 +16,7 @@
iso-8859-1
- 8.6
+ 8.7https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.version}/config/checkstyle_checks.xml7.6
From bc5795b2efd666976e8034cca71efefc76dca071 Mon Sep 17 00:00:00 2001
From: Roman Ivanov
Date: Mon, 1 Jan 2018 11:42:56 -0800
Subject: [PATCH 140/208] Issue #602: upgrade to eclipse-cs of 8.5.1
---
.travis.yml | 2 +-
eclipsecs-sevntu-plugin/pom.xml | 2 +-
sevntu-checks/pom.xml | 2 +-
.../com/github/sevntu/checkstyle/BaseCheckTestSupport.java | 2 +-
.../test/java/com/github/sevntu/checkstyle/UtilsTest.java | 5 +++--
sevntu-checkstyle-sonar-plugin/pom.xml | 2 +-
6 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index c96613deda..e9d626f41c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -21,7 +21,7 @@ matrix:
- DESC="eclipse-cs"
- CMD_="cd sevntu-checks && mvn clean install -Dmaven.test.skip=true -Dcheckstyle.skip=true -Dcobertura.skip=true && cd .. "
- CMD0="git clone git://git.code.sf.net/p/eclipse-cs/git eclipse-cs-git"
- - CMD1="&& cd eclipse-cs-git/ && git checkout 7.6.0"
+ - CMD1="&& cd eclipse-cs-git/ && git checkout 8.5.1"
- CMD2="&& cd net.sf.eclipsecs.parent/ && mvn install"
- CMD3="&& cd ../../"
- CMD4="&& cd eclipsecs-sevntu-plugin && mvn verify && mvn javadoc:javadoc"
diff --git a/eclipsecs-sevntu-plugin/pom.xml b/eclipsecs-sevntu-plugin/pom.xml
index c9f5af6c00..56acabb47c 100644
--- a/eclipsecs-sevntu-plugin/pom.xml
+++ b/eclipsecs-sevntu-plugin/pom.xml
@@ -26,7 +26,7 @@
- 7.6.0-SNAPSHOT
+ 8.5.1-SNAPSHOT
diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml
index abdd552e28..ccb35aa44d 100644
--- a/sevntu-checks/pom.xml
+++ b/sevntu-checks/pom.xml
@@ -19,7 +19,7 @@
8.7https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.version}/config/checkstyle_checks.xml
- 7.6
+ 8.52.17RELEASE
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/BaseCheckTestSupport.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/BaseCheckTestSupport.java
index 7e1da5b8a1..d8f1433fd7 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/BaseCheckTestSupport.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/BaseCheckTestSupport.java
@@ -36,13 +36,13 @@
import java.util.Properties;
import com.google.common.collect.Lists;
-import com.puppycrawl.tools.checkstyle.AuditEventUtFormatter;
import com.puppycrawl.tools.checkstyle.Checker;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.DefaultLogger;
import com.puppycrawl.tools.checkstyle.TreeWalker;
import com.puppycrawl.tools.checkstyle.api.AuditEvent;
import com.puppycrawl.tools.checkstyle.api.Configuration;
+import com.puppycrawl.tools.checkstyle.internal.utils.AuditEventUtFormatter;
public abstract class BaseCheckTestSupport {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/UtilsTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/UtilsTest.java
index 1853c07608..06cf9622bf 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/UtilsTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/UtilsTest.java
@@ -19,7 +19,7 @@
package com.github.sevntu.checkstyle;
-import static com.puppycrawl.tools.checkstyle.internal.TestUtils.assertUtilsClassHasPrivateConstructor;
+import static com.puppycrawl.tools.checkstyle.internal.utils.TestUtil.isUtilsClassHasPrivateConstructor;
import static org.junit.Assert.fail;
import org.junit.Assert;
@@ -31,7 +31,8 @@ public class UtilsTest {
@Test
public void testIsProperUtilsClass() throws ReflectiveOperationException {
- assertUtilsClassHasPrivateConstructor(Utils.class);
+ Assert.assertTrue("Constructor is not private",
+ isUtilsClassHasPrivateConstructor(Utils.class, true));
}
@Test
diff --git a/sevntu-checkstyle-sonar-plugin/pom.xml b/sevntu-checkstyle-sonar-plugin/pom.xml
index ab1a7c91c7..11fba39928 100644
--- a/sevntu-checkstyle-sonar-plugin/pom.xml
+++ b/sevntu-checkstyle-sonar-plugin/pom.xml
@@ -26,7 +26,7 @@
UTF-8
- 7.2
+ 8.52.17
From 10d1068858bb85bac1d1d201afcbcd9f087a2eb5 Mon Sep 17 00:00:00 2001
From: Roman Ivanov
Date: Mon, 1 Jan 2018 12:11:15 -0800
Subject: [PATCH 141/208] config: version bump to 1.26.0 and fix for build
---
eclipse-pom.xml | 2 +-
eclipsecs-sevntu-plugin-feature/feature.xml | 4 ++--
eclipsecs-sevntu-plugin-feature/pom.xml | 2 +-
eclipsecs-sevntu-plugin/META-INF/MANIFEST.MF | 2 +-
eclipsecs-sevntu-plugin/pom.xml | 2 +-
sevntu-checks/pom.xml | 2 +-
sevntu-checkstyle-idea-extension/pom.xml | 2 +-
sevntu-checkstyle-maven-plugin/pom.xml | 4 ++--
sevntu-checkstyle-sonar-plugin/checkstyle.properties | 1 +
sevntu-checkstyle-sonar-plugin/import-control-test.xml | 10 ++++++++++
sevntu-checkstyle-sonar-plugin/pom.xml | 2 +-
update-site/pom.xml | 2 +-
12 files changed, 23 insertions(+), 12 deletions(-)
create mode 100644 sevntu-checkstyle-sonar-plugin/import-control-test.xml
diff --git a/eclipse-pom.xml b/eclipse-pom.xml
index 0f26d1af7a..de06604337 100644
--- a/eclipse-pom.xml
+++ b/eclipse-pom.xml
@@ -5,7 +5,7 @@
com.github.sevntu-checkstyleparent
- 1.25.0
+ 1.26.0pom
diff --git a/eclipsecs-sevntu-plugin-feature/feature.xml b/eclipsecs-sevntu-plugin-feature/feature.xml
index ad8cb451f0..b0e518823b 100644
--- a/eclipsecs-sevntu-plugin-feature/feature.xml
+++ b/eclipsecs-sevntu-plugin-feature/feature.xml
@@ -1,5 +1,5 @@
-
+
http://sevntu-checkstyle.github.io/sevntu.checkstyle/
@@ -20,6 +20,6 @@ Eclipse Public License - Version 1.0
-
+
diff --git a/eclipsecs-sevntu-plugin-feature/pom.xml b/eclipsecs-sevntu-plugin-feature/pom.xml
index b9cb9d05ba..6f5897e584 100644
--- a/eclipsecs-sevntu-plugin-feature/pom.xml
+++ b/eclipsecs-sevntu-plugin-feature/pom.xml
@@ -7,7 +7,7 @@
../eclipse-pom.xmlcom.github.sevntu-checkstyleparent
- 1.25.0
+ 1.26.0com.github.sevntu-checkstyle
diff --git a/eclipsecs-sevntu-plugin/META-INF/MANIFEST.MF b/eclipsecs-sevntu-plugin/META-INF/MANIFEST.MF
index 6221a0eb58..071d93abcd 100644
--- a/eclipsecs-sevntu-plugin/META-INF/MANIFEST.MF
+++ b/eclipsecs-sevntu-plugin/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Sevntu eclipse-cs Extension Plugin
Bundle-SymbolicName: eclipsecs-sevntu-plugin;singleton:=true
-Bundle-Version: 1.25.0
+Bundle-Version: 1.26.0
Require-Bundle: net.sf.eclipsecs.checkstyle,
net.sf.eclipsecs.core,
net.sf.eclipsecs.ui
diff --git a/eclipsecs-sevntu-plugin/pom.xml b/eclipsecs-sevntu-plugin/pom.xml
index 56acabb47c..1b1a226daa 100644
--- a/eclipsecs-sevntu-plugin/pom.xml
+++ b/eclipsecs-sevntu-plugin/pom.xml
@@ -9,7 +9,7 @@
../eclipse-pom.xmlcom.github.sevntu-checkstyleparent
- 1.25.0
+ 1.26.0com.github.sevntu-checkstyle
diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml
index ccb35aa44d..52e72a301c 100644
--- a/sevntu-checks/pom.xml
+++ b/sevntu-checks/pom.xml
@@ -11,7 +11,7 @@
com.github.sevntu-checkstylesevntu-checks
- 1.25.0
+ 1.26.0iso-8859-1
diff --git a/sevntu-checkstyle-idea-extension/pom.xml b/sevntu-checkstyle-idea-extension/pom.xml
index 94ee500246..47203f6a5a 100644
--- a/sevntu-checkstyle-idea-extension/pom.xml
+++ b/sevntu-checkstyle-idea-extension/pom.xml
@@ -11,7 +11,7 @@
com.github.sevntu-checkstylesevntu-checkstyle-idea-extension
- 1.25.0
+ 1.26.0jarSevntu Checkstyle Idea extension
diff --git a/sevntu-checkstyle-maven-plugin/pom.xml b/sevntu-checkstyle-maven-plugin/pom.xml
index 0109386f96..20f2af394e 100644
--- a/sevntu-checkstyle-maven-plugin/pom.xml
+++ b/sevntu-checkstyle-maven-plugin/pom.xml
@@ -12,7 +12,7 @@
com.github.sevntu-checkstylesevntu-checkstyle-maven-pluginSevntu Checkstyle Maven Plugin
- 1.25.0
+ 1.26.0
@@ -25,7 +25,7 @@
com.github.sevntu-checkstylesevntu-checks
- 1.25.0
+ 1.26.0org.apache.maven.plugins
diff --git a/sevntu-checkstyle-sonar-plugin/checkstyle.properties b/sevntu-checkstyle-sonar-plugin/checkstyle.properties
index 6b8f3fc973..53c8f47cd9 100644
--- a/sevntu-checkstyle-sonar-plugin/checkstyle.properties
+++ b/sevntu-checkstyle-sonar-plugin/checkstyle.properties
@@ -2,3 +2,4 @@ checkstyle.suppressions.file=suppressions.xml
checkstyle.header.file=https://raw.githubusercontent.com/checkstyle/checkstyle/master/config/java.header
checkstyle.regexp.header.file=https://raw.githubusercontent.com/checkstyle/checkstyle/master/config/java_regexp.header
checkstyle.importcontrol.file=import-control.xml
+checkstyle.importcontroltest.file=import-control-test.xml
diff --git a/sevntu-checkstyle-sonar-plugin/import-control-test.xml b/sevntu-checkstyle-sonar-plugin/import-control-test.xml
new file mode 100644
index 0000000000..051a6bec66
--- /dev/null
+++ b/sevntu-checkstyle-sonar-plugin/import-control-test.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
diff --git a/sevntu-checkstyle-sonar-plugin/pom.xml b/sevntu-checkstyle-sonar-plugin/pom.xml
index 11fba39928..57b763a2a7 100644
--- a/sevntu-checkstyle-sonar-plugin/pom.xml
+++ b/sevntu-checkstyle-sonar-plugin/pom.xml
@@ -11,7 +11,7 @@
com.github.sevntu-checkstylesevntu-checkstyle-sonar-plugin
- 1.25.0
+ 1.26.0sonar-pluginSevNTU Checkstyle Sonar Extension Plugin
diff --git a/update-site/pom.xml b/update-site/pom.xml
index 30d41bdb7a..69da2f6d57 100644
--- a/update-site/pom.xml
+++ b/update-site/pom.xml
@@ -7,7 +7,7 @@
../eclipse-pom.xmlcom.github.sevntu-checkstyleparent
- 1.25.0
+ 1.26.0com.github.sevntu.checkstyle.p2updatesite
From c01f9f2105009c222901470c9e4a44639e5ee936 Mon Sep 17 00:00:00 2001
From: rnveach
Date: Sun, 31 Dec 2017 10:33:35 -0500
Subject: [PATCH 142/208] minor: add '-e' to all mvn executions
---
.travis.yml | 34 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index e9d626f41c..891363a3a2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -19,12 +19,12 @@ matrix:
- jdk: oraclejdk8
env:
- DESC="eclipse-cs"
- - CMD_="cd sevntu-checks && mvn clean install -Dmaven.test.skip=true -Dcheckstyle.skip=true -Dcobertura.skip=true && cd .. "
+ - CMD_="cd sevntu-checks && mvn -e clean install -Dmaven.test.skip=true -Dcheckstyle.skip=true -Dcobertura.skip=true && cd .. "
- CMD0="git clone git://git.code.sf.net/p/eclipse-cs/git eclipse-cs-git"
- CMD1="&& cd eclipse-cs-git/ && git checkout 8.5.1"
- - CMD2="&& cd net.sf.eclipsecs.parent/ && mvn install"
+ - CMD2="&& cd net.sf.eclipsecs.parent/ && mvn -e install"
- CMD3="&& cd ../../"
- - CMD4="&& cd eclipsecs-sevntu-plugin && mvn verify && mvn javadoc:javadoc"
+ - CMD4="&& cd eclipsecs-sevntu-plugin && mvn -e verify && mvn -e javadoc:javadoc"
- CMD=$CMD_" && "$CMD0$CMD1$CMD2$CMD3$CMD4
- PREINSTALL="true"
@@ -32,31 +32,31 @@ matrix:
- jdk: oraclejdk8
env:
- DESC="maven-plugin"
- - CMD0="cd sevntu-checks && mvn clean install -Dmaven.test.skip=true -Dcheckstyle.skip=true -Dcobertura.skip=true && cd .. "
- - CMD=$CMD0" && ""cd sevntu-checkstyle-maven-plugin && mvn verify && mvn javadoc:javadoc"
+ - CMD0="cd sevntu-checks && mvn -e clean install -Dmaven.test.skip=true -Dcheckstyle.skip=true -Dcobertura.skip=true && cd .. "
+ - CMD=$CMD0" && ""cd sevntu-checkstyle-maven-plugin && mvn -e verify && mvn -e javadoc:javadoc"
# idea-extension
- jdk: oraclejdk8
env:
- DESC="idea-extension"
- - CMD0="cd sevntu-checks && mvn clean install -Dmaven.test.skip=true -Dcheckstyle.skip=true -Dcobertura.skip=true && cd .. "
- - CMD=$CMD0" && ""cd sevntu-checkstyle-idea-extension && mvn verify && mvn javadoc:javadoc"
+ - CMD0="cd sevntu-checks && mvn -e clean install -Dmaven.test.skip=true -Dcheckstyle.skip=true -Dcobertura.skip=true && cd .. "
+ - CMD=$CMD0" && ""cd sevntu-checkstyle-idea-extension && mvn -e verify && mvn -e javadoc:javadoc"
# sonar-plugin
- jdk: oraclejdk8
env:
- DESC="sonar-plugin"
- - CMD0="cd sevntu-checks && mvn clean install -Dmaven.test.skip=true -Dcheckstyle.skip=true -Dcobertura.skip=true && cd .. "
- - CMD=$CMD0" && ""cd sevntu-checkstyle-sonar-plugin && mvn verify && mvn javadoc:javadoc"
+ - CMD0="cd sevntu-checks && mvn -e clean install -Dmaven.test.skip=true -Dcheckstyle.skip=true -Dcobertura.skip=true && cd .. "
+ - CMD=$CMD0" && ""cd sevntu-checkstyle-sonar-plugin && mvn -e verify && mvn -e javadoc:javadoc"
# checks
- jdk: oraclejdk8
env:
- DESC="checks"
- - CMD0="cd sevntu-checks && mvn install"
- - CMD1="&& mvn verify -Pselftesting"
- - CMD2="&& mvn javadoc:javadoc"
- - CMD3="&& mvn jacoco:report coveralls:jacoco"
+ - CMD0="cd sevntu-checks && mvn -e install"
+ - CMD1="&& mvn -e verify -Pselftesting"
+ - CMD2="&& mvn -e javadoc:javadoc"
+ - CMD3="&& mvn -e jacoco:report coveralls:jacoco"
- CMD=$CMD0$CMD1$CMD2$CMD3
# regression on checkstyle
@@ -64,16 +64,16 @@ matrix:
env:
- DESC="checkstyle regression"
- CMD0="git clone https://github.com/checkstyle/checkstyle "
- - CMD1=" && cd sevntu-checks && mvn install -DskipTests -Dcheckstyle.skip=true -Dcobertura.skip=true"
- - CMD2=" && mvn test -Dtest=CheckstyleRegressionTest#setupFiles -Dregression-path=../"
- - CMD3=" && cd ../ && cd checkstyle && mvn clean verify -e -DskipTests -DskipITs -Dpmd.skip=true -Dfindbugs.skip=true -Dcobertura.skip=true"
+ - CMD1=" && cd sevntu-checks && mvn -e install -DskipTests -Dcheckstyle.skip=true -Dcobertura.skip=true"
+ - CMD2=" && mvn -e test -Dtest=CheckstyleRegressionTest#setupFiles -Dregression-path=../"
+ - CMD3=" && cd ../ && cd checkstyle && mvn -e clean verify -e -DskipTests -DskipITs -Dpmd.skip=true -Dfindbugs.skip=true -Dcobertura.skip=true"
- CMD=$CMD0$CMD1$CMD2$CMD3
# eclipse static analysis
- jdk: oraclejdk8
env:
- DESC="eclipse static analysis
- - CMD="cd sevntu-checks && mvn clean compile exec:exec -Peclipse-compiler"
+ - CMD="cd sevntu-checks && mvn -e clean compile exec:exec -Peclipse-compiler"
# testing of PR format
- env:
From 632c22729770c635075a6e543d48c4b7d300bbd8 Mon Sep 17 00:00:00 2001
From: rnveach
Date: Tue, 2 Jan 2018 19:57:31 -0500
Subject: [PATCH 143/208] minor: sevntu must always use eclipse-cs version
---
sevntu-checks/pom.xml | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml
index 52e72a301c..559f7d51ee 100644
--- a/sevntu-checks/pom.xml
+++ b/sevntu-checks/pom.xml
@@ -15,11 +15,9 @@
iso-8859-1
-
- 8.7
- https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.version}/config/checkstyle_checks.xml8.5
+ https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.eclipse-cs.version}/config/checkstyle_checks.xml2.17RELEASE
@@ -172,7 +170,7 @@
com.puppycrawl.toolscheckstyle
- ${checkstyle.version}
+ ${checkstyle.eclipse-cs.version}
@@ -290,7 +288,7 @@
test
- ${checkstyle.version}
+ ${checkstyle.eclipse-cs.version}
@@ -335,7 +333,7 @@
com.puppycrawl.toolscheckstyle
- ${checkstyle.version}
+ ${checkstyle.eclipse-cs.version}
From 49711abf3e24d7556779f1b98f08c1c826f4ee74 Mon Sep 17 00:00:00 2001
From: rnveach
Date: Wed, 3 Jan 2018 09:56:18 -0500
Subject: [PATCH 144/208] minor: year bump at header to 2018
---
.../src/main/java/com/github/sevntu/checkstyle/Utils.java | 2 +-
.../checkstyle/checks/annotation/ForbidAnnotationCheck.java | 2 +-
.../checks/annotation/ForbidAnnotationElementValueCheck.java | 2 +-
.../checks/annotation/RequiredParameterForAnnotationCheck.java | 2 +-
.../sevntu/checkstyle/checks/annotation/package-info.java | 2 +-
.../coding/AvoidConstantAsFirstOperandInConditionCheck.java | 2 +-
.../coding/AvoidDefaultSerializableInInnerClassesCheck.java | 2 +-
.../checks/coding/AvoidHidingCauseExceptionCheck.java | 2 +-
.../checkstyle/checks/coding/AvoidModifiersForTypesCheck.java | 2 +-
.../coding/AvoidNotShortCircuitOperatorsForBooleanCheck.java | 2 +-
.../checkstyle/checks/coding/ConfusingConditionCheck.java | 2 +-
.../checkstyle/checks/coding/CustomDeclarationOrderCheck.java | 2 +-
.../coding/DiamondOperatorForVariableDefinitionCheck.java | 2 +-
.../sevntu/checkstyle/checks/coding/EitherLogOrThrowCheck.java | 2 +-
.../checkstyle/checks/coding/EmptyPublicCtorInClassCheck.java | 2 +-
.../checkstyle/checks/coding/FinalizeImplementationCheck.java | 2 +-
.../checkstyle/checks/coding/ForbidCCommentsInMethodsCheck.java | 2 +-
.../checkstyle/checks/coding/ForbidCertainImportsCheck.java | 2 +-
.../checkstyle/checks/coding/ForbidInstantiationCheck.java | 2 +-
.../checks/coding/ForbidReturnInFinallyBlockCheck.java | 2 +-
.../checks/coding/ForbidThrowAnonymousExceptionsCheck.java | 2 +-
.../checkstyle/checks/coding/IllegalCatchExtendedCheck.java | 2 +-
.../checks/coding/LogicConditionNeedOptimizationCheck.java | 2 +-
.../checks/coding/MapIterationInForEachLoopCheck.java | 2 +-
.../checkstyle/checks/coding/MoveVariableInsideIfCheck.java | 2 +-
.../checks/coding/MultipleStringLiteralsExtendedCheck.java | 2 +-
.../coding/MultipleVariableDeclarationsExtendedCheck.java | 2 +-
.../checks/coding/NameConventionForJunit4TestClassesCheck.java | 2 +-
.../checks/coding/NoNullForCollectionReturnCheck.java | 2 +-
.../checks/coding/NumericLiteralNeedsUnderscoreCheck.java | 2 +-
.../checks/coding/OverridableMethodInConstructorCheck.java | 2 +-
.../sevntu/checkstyle/checks/coding/RedundantReturnCheck.java | 2 +-
.../checks/coding/RequireFailForTryCatchInJunitCheck.java | 2 +-
.../checkstyle/checks/coding/ReturnBooleanFromTernaryCheck.java | 2 +-
.../checkstyle/checks/coding/ReturnCountExtendedCheck.java | 2 +-
.../checks/coding/ReturnNullInsteadOfBooleanCheck.java | 2 +-
.../checks/coding/SimpleAccessorNameNotationCheck.java | 2 +-
.../checkstyle/checks/coding/SingleBreakOrContinueCheck.java | 2 +-
.../checks/coding/TernaryPerExpressionCountCheck.java | 2 +-
.../checks/coding/UnnecessaryParenthesesExtendedCheck.java | 2 +-
.../checkstyle/checks/coding/UselessSingleCatchCheck.java | 2 +-
.../checkstyle/checks/coding/UselessSuperCtorCallCheck.java | 2 +-
.../checks/coding/WhitespaceBeforeArrayInitializerCheck.java | 2 +-
.../github/sevntu/checkstyle/checks/coding/package-info.java | 2 +-
.../checkstyle/checks/design/AvoidConditionInversionCheck.java | 2 +-
.../checks/design/CauseParameterInExceptionCheck.java | 2 +-
.../checkstyle/checks/design/CheckstyleTestMakeupCheck.java | 2 +-
.../sevntu/checkstyle/checks/design/ChildBlockLengthCheck.java | 2 +-
.../checkstyle/checks/design/ConstructorWithoutParamsCheck.java | 2 +-
.../checks/design/ForbidWildcardAsReturnTypeCheck.java | 2 +-
.../checks/design/HideUtilityClassConstructorCheck.java | 2 +-
.../github/sevntu/checkstyle/checks/design/InnerClassCheck.java | 2 +-
.../sevntu/checkstyle/checks/design/NestedSwitchCheck.java | 2 +-
.../checks/design/NoMainMethodInAbstractClassCheck.java | 2 +-
.../checks/design/PublicReferenceToPrivateTypeCheck.java | 2 +-
.../checkstyle/checks/design/StaticMethodCandidateCheck.java | 2 +-
.../github/sevntu/checkstyle/checks/design/package-info.java | 2 +-
.../sevntu/checkstyle/checks/naming/EnumValueNameCheck.java | 2 +-
.../checks/naming/InterfaceTypeParameterNameCheck.java | 2 +-
.../checkstyle/checks/naming/UniformEnumConstantNameCheck.java | 2 +-
.../github/sevntu/checkstyle/checks/naming/package-info.java | 2 +-
.../sevntu/checkstyle/checks/sizes/LineLengthExtendedCheck.java | 2 +-
.../com/github/sevntu/checkstyle/checks/sizes/package-info.java | 2 +-
.../main/java/com/github/sevntu/checkstyle/package-info.java | 2 +-
.../java/com/github/sevntu/checkstyle/BaseCheckTestSupport.java | 2 +-
.../src/test/java/com/github/sevntu/checkstyle/UtilsTest.java | 2 +-
.../checkstyle/checks/annotation/ForbidAnnotationCheckTest.java | 2 +-
.../annotation/ForbidAnnotationElementValueCheckTest.java | 2 +-
.../annotation/RequiredParameterForAnnotationCheckTest.java | 2 +-
.../coding/AvoidConstantAsFirstOperandInConditionCheckTest.java | 2 +-
.../coding/AvoidDefaultSerializableInInnerClassesCheckTest.java | 2 +-
.../checks/coding/AvoidHidingCauseExceptionCheckTest.java | 2 +-
.../checks/coding/AvoidModifiersForTypesCheckTest.java | 2 +-
.../AvoidNotShortCircuitOperatorsForBooleanCheckTest.java | 2 +-
.../checkstyle/checks/coding/ConfusingConditionCheckTest.java | 2 +-
.../checks/coding/CustomDeclarationOrderCheckTest.java | 2 +-
.../coding/DiamondOperatorForVariableDefinitionCheckTest.java | 2 +-
.../checkstyle/checks/coding/EitherLogOrThrowCheckTest.java | 2 +-
.../checks/coding/EmptyPublicCtorInClassCheckTest.java | 2 +-
.../checks/coding/FinalizeImplementationCheckTest.java | 2 +-
.../checks/coding/ForbidCCommentsInMethodsCheckTest.java | 2 +-
.../checkstyle/checks/coding/ForbidCertainImportsCheckTest.java | 2 +-
.../checkstyle/checks/coding/ForbidInstantiationCheckTest.java | 2 +-
.../checks/coding/ForbidReturnInFinallyBlockCheckTest.java | 2 +-
.../checks/coding/ForbidThrowAnonymousExceptionsCheckTest.java | 2 +-
.../checkstyle/checks/coding/IllegalCatchExtendedCheckTest.java | 2 +-
.../checks/coding/LogicConditionNeedOptimizationCheckTest.java | 2 +-
.../checks/coding/MapIterationInForEachLoopCheckTest.java | 2 +-
.../checkstyle/checks/coding/MoveVariableInsideIfCheckTest.java | 2 +-
.../checks/coding/MultipleStringLiteralsExtendedCheckTest.java | 2 +-
.../coding/MultipleVariableDeclarationsExtendedCheckTest.java | 2 +-
.../coding/NameConventionForJunit4TestClassesCheckTest.java | 2 +-
.../checks/coding/NoNullForCollectionReturnCheckTest.java | 2 +-
.../checks/coding/NumericLiteralNeedsUnderscoreCheckTest.java | 2 +-
.../checks/coding/OverridableMethodInConstructorCheckTest.java | 2 +-
.../checkstyle/checks/coding/RedundantReturnCheckTest.java | 2 +-
.../checks/coding/RequireFailForTryCatchInJunitCheckTest.java | 2 +-
.../checks/coding/ReturnBooleanFromTernaryCheckTest.java | 2 +-
.../checkstyle/checks/coding/ReturnCountExtendedCheckTest.java | 2 +-
.../checks/coding/ReturnNullInsteadOfBooleanCheckTest.java | 2 +-
.../checks/coding/SimpleAccessorNameNotationCheckTest.java | 2 +-
.../checks/coding/SingleBreakOrContinueCheckTest.java | 2 +-
.../checks/coding/TernaryPerExpressionCountCheckTest.java | 2 +-
.../checks/coding/UnnecessaryParenthesesExtendedCheckTest.java | 2 +-
.../checkstyle/checks/coding/UselessSingleCatchCheckTest.java | 2 +-
.../checkstyle/checks/coding/UselessSuperCtorCallCheckTest.java | 2 +-
.../coding/WhitespaceBeforeArrayInitializerCheckTest.java | 2 +-
.../checks/design/AvoidConditionInversionCheckTest.java | 2 +-
.../checks/design/CauseParameterInExceptionCheckTest.java | 2 +-
.../checkstyle/checks/design/CheckstyleTestMakeupCheckTest.java | 2 +-
.../checkstyle/checks/design/ChildBlockLengthCheckTest.java | 2 +-
.../checks/design/ConstructorWithoutParamsCheckTest.java | 2 +-
.../checks/design/ForbidWildcardAsReturnTypeCheckTest.java | 2 +-
.../checks/design/HideUtilityClassConstructorCheckTest.java | 2 +-
.../sevntu/checkstyle/checks/design/InnerClassCheckTest.java | 2 +-
.../sevntu/checkstyle/checks/design/NestedSwitchCheckTest.java | 2 +-
.../checks/design/NoMainMethodInAbstractClassCheckTest.java | 2 +-
.../checks/design/PublicReferenceToPrivateTypeCheckTest.java | 2 +-
.../checks/design/StaticMethodCandidateCheckTest.java | 2 +-
.../sevntu/checkstyle/checks/naming/EnumValueNameCheckTest.java | 2 +-
.../checks/naming/InterfaceTypeParameterNameCheckTest.java | 2 +-
.../checks/naming/UniformEnumConstantNameCheckTest.java | 2 +-
.../checkstyle/checks/sizes/LineLengthExtendedCheckTest.java | 2 +-
.../com/github/sevntu/checkstyle/internal/AllChecksTest.java | 2 +-
.../java/com/github/sevntu/checkstyle/internal/CheckUtil.java | 2 +-
.../java/com/github/sevntu/checkstyle/internal/ChecksTest.java | 2 +-
.../sevntu/checkstyle/internal/CheckstyleRegressionTest.java | 2 +-
.../github/sevntu/checkstyle/internal/CommitValidationTest.java | 2 +-
.../java/com/github/sevntu/checkstyle/internal/XmlUtil.java | 2 +-
.../checks/design/InputChildBlockLengthCheckCheckNPE.java | 2 +-
.../checks/design/InputConstructorWithoutParamsCheck.java | 2 +-
.../checkstyle/checks/naming/InputEnumValueNameCheck.java | 2 +-
.../checks/naming/InputUniformEnumConstantNameCheck.java | 2 +-
133 files changed, 133 insertions(+), 133 deletions(-)
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/Utils.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/Utils.java
index c45bf977dc..8d7726c4ac 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/Utils.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/Utils.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationCheck.java
index 76a94d8f02..036e0cb0b2 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationElementValueCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationElementValueCheck.java
index 71e5a69efd..81d40a7944 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationElementValueCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationElementValueCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/annotation/RequiredParameterForAnnotationCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/annotation/RequiredParameterForAnnotationCheck.java
index b1aa57fbf8..622038ff5f 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/annotation/RequiredParameterForAnnotationCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/annotation/RequiredParameterForAnnotationCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/annotation/package-info.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/annotation/package-info.java
index d27f315296..b1e3918c31 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/annotation/package-info.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/annotation/package-info.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidConstantAsFirstOperandInConditionCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidConstantAsFirstOperandInConditionCheck.java
index daccc13790..b48ae43500 100755
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidConstantAsFirstOperandInConditionCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidConstantAsFirstOperandInConditionCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidDefaultSerializableInInnerClassesCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidDefaultSerializableInInnerClassesCheck.java
index 434a0aef05..763bfab221 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidDefaultSerializableInInnerClassesCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidDefaultSerializableInInnerClassesCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidHidingCauseExceptionCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidHidingCauseExceptionCheck.java
index 172ea1fa5d..5e7b526996 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidHidingCauseExceptionCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidHidingCauseExceptionCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidModifiersForTypesCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidModifiersForTypesCheck.java
index f8ba8a5f2d..c705f44442 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidModifiersForTypesCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidModifiersForTypesCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidNotShortCircuitOperatorsForBooleanCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidNotShortCircuitOperatorsForBooleanCheck.java
index 13c20a1c4c..c37286699b 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidNotShortCircuitOperatorsForBooleanCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidNotShortCircuitOperatorsForBooleanCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ConfusingConditionCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ConfusingConditionCheck.java
index b412837252..556f151f44 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ConfusingConditionCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ConfusingConditionCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheck.java
index 1ce9f95ae1..727a75d50f 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/DiamondOperatorForVariableDefinitionCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/DiamondOperatorForVariableDefinitionCheck.java
index 2df9f67511..b9c2adfb84 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/DiamondOperatorForVariableDefinitionCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/DiamondOperatorForVariableDefinitionCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EitherLogOrThrowCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EitherLogOrThrowCheck.java
index 9d6e559632..0f5f62adba 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EitherLogOrThrowCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EitherLogOrThrowCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EmptyPublicCtorInClassCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EmptyPublicCtorInClassCheck.java
index fad29ea610..cc75c89f1a 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EmptyPublicCtorInClassCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EmptyPublicCtorInClassCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/FinalizeImplementationCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/FinalizeImplementationCheck.java
index ec2f5bba23..2b5fbe55ad 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/FinalizeImplementationCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/FinalizeImplementationCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidCCommentsInMethodsCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidCCommentsInMethodsCheck.java
index a62fe47501..5acabd16b5 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidCCommentsInMethodsCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidCCommentsInMethodsCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidCertainImportsCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidCertainImportsCheck.java
index 35ffa80da9..d1be90e5aa 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidCertainImportsCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidCertainImportsCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidInstantiationCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidInstantiationCheck.java
index 82f648c7bf..cb15d33d10 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidInstantiationCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidInstantiationCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidReturnInFinallyBlockCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidReturnInFinallyBlockCheck.java
index fefe16b89f..46bab15389 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidReturnInFinallyBlockCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidReturnInFinallyBlockCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidThrowAnonymousExceptionsCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidThrowAnonymousExceptionsCheck.java
index ca17cecd80..74eace682f 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidThrowAnonymousExceptionsCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidThrowAnonymousExceptionsCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/IllegalCatchExtendedCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/IllegalCatchExtendedCheck.java
index 71fe505863..0a66a1efa6 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/IllegalCatchExtendedCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/IllegalCatchExtendedCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/LogicConditionNeedOptimizationCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/LogicConditionNeedOptimizationCheck.java
index 4a30f4e57e..b70e16819a 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/LogicConditionNeedOptimizationCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/LogicConditionNeedOptimizationCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MapIterationInForEachLoopCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MapIterationInForEachLoopCheck.java
index 0fc1cfa518..1a397d35c3 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MapIterationInForEachLoopCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MapIterationInForEachLoopCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MoveVariableInsideIfCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MoveVariableInsideIfCheck.java
index fa733fd2e4..11c07e1541 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MoveVariableInsideIfCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MoveVariableInsideIfCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MultipleStringLiteralsExtendedCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MultipleStringLiteralsExtendedCheck.java
index 976d1bd9bc..cb3583f799 100755
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MultipleStringLiteralsExtendedCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MultipleStringLiteralsExtendedCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MultipleVariableDeclarationsExtendedCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MultipleVariableDeclarationsExtendedCheck.java
index 54dcf30e19..357c44fcec 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MultipleVariableDeclarationsExtendedCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MultipleVariableDeclarationsExtendedCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NameConventionForJunit4TestClassesCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NameConventionForJunit4TestClassesCheck.java
index 3e7828d238..1a17b47ed6 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NameConventionForJunit4TestClassesCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NameConventionForJunit4TestClassesCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NoNullForCollectionReturnCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NoNullForCollectionReturnCheck.java
index 5d1a174397..f8a527dc21 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NoNullForCollectionReturnCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NoNullForCollectionReturnCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NumericLiteralNeedsUnderscoreCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NumericLiteralNeedsUnderscoreCheck.java
index dfb4a518e2..961ff250ab 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NumericLiteralNeedsUnderscoreCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NumericLiteralNeedsUnderscoreCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/OverridableMethodInConstructorCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/OverridableMethodInConstructorCheck.java
index 097496efcb..eea1e72ede 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/OverridableMethodInConstructorCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/OverridableMethodInConstructorCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/RedundantReturnCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/RedundantReturnCheck.java
index 46ab508033..b05ad5ed64 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/RedundantReturnCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/RedundantReturnCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/RequireFailForTryCatchInJunitCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/RequireFailForTryCatchInJunitCheck.java
index dc429416d9..817330ae07 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/RequireFailForTryCatchInJunitCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/RequireFailForTryCatchInJunitCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ReturnBooleanFromTernaryCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ReturnBooleanFromTernaryCheck.java
index 0ecfba8d01..a6de1e86e0 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ReturnBooleanFromTernaryCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ReturnBooleanFromTernaryCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ReturnCountExtendedCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ReturnCountExtendedCheck.java
index c7e1dfcaef..f8ed75d1c3 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ReturnCountExtendedCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ReturnCountExtendedCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ReturnNullInsteadOfBooleanCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ReturnNullInsteadOfBooleanCheck.java
index 6b5a3ee1ad..0fc2707897 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ReturnNullInsteadOfBooleanCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ReturnNullInsteadOfBooleanCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/SimpleAccessorNameNotationCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/SimpleAccessorNameNotationCheck.java
index 718f1dbd5f..960e3b8e5a 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/SimpleAccessorNameNotationCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/SimpleAccessorNameNotationCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/SingleBreakOrContinueCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/SingleBreakOrContinueCheck.java
index 00cd3d710a..8debb6132e 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/SingleBreakOrContinueCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/SingleBreakOrContinueCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/TernaryPerExpressionCountCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/TernaryPerExpressionCountCheck.java
index ab2eaa0b52..9daf80f195 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/TernaryPerExpressionCountCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/TernaryPerExpressionCountCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UnnecessaryParenthesesExtendedCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UnnecessaryParenthesesExtendedCheck.java
index d7d7e4bc1c..9f3cfc7dea 100755
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UnnecessaryParenthesesExtendedCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UnnecessaryParenthesesExtendedCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UselessSingleCatchCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UselessSingleCatchCheck.java
index c71b076bbf..8771f39b71 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UselessSingleCatchCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UselessSingleCatchCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UselessSuperCtorCallCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UselessSuperCtorCallCheck.java
index 59ed45c2a6..039ce5f64f 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UselessSuperCtorCallCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UselessSuperCtorCallCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/WhitespaceBeforeArrayInitializerCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/WhitespaceBeforeArrayInitializerCheck.java
index 66356f2c04..f518157671 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/WhitespaceBeforeArrayInitializerCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/WhitespaceBeforeArrayInitializerCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/package-info.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/package-info.java
index 29fea50baf..4f344ef7d3 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/package-info.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/package-info.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/AvoidConditionInversionCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/AvoidConditionInversionCheck.java
index 5b3c839cf9..3d2942b6d4 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/AvoidConditionInversionCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/AvoidConditionInversionCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/CauseParameterInExceptionCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/CauseParameterInExceptionCheck.java
index a923aa9baf..6e22bd41c9 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/CauseParameterInExceptionCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/CauseParameterInExceptionCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/CheckstyleTestMakeupCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/CheckstyleTestMakeupCheck.java
index 2d5d72feae..8f8bff487e 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/CheckstyleTestMakeupCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/CheckstyleTestMakeupCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ChildBlockLengthCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ChildBlockLengthCheck.java
index 49795422ac..e28d2d6cdb 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ChildBlockLengthCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ChildBlockLengthCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ConstructorWithoutParamsCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ConstructorWithoutParamsCheck.java
index a43f9d9799..63d78d7f37 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ConstructorWithoutParamsCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ConstructorWithoutParamsCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ForbidWildcardAsReturnTypeCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ForbidWildcardAsReturnTypeCheck.java
index db477b994a..cd882f3361 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ForbidWildcardAsReturnTypeCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ForbidWildcardAsReturnTypeCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/HideUtilityClassConstructorCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/HideUtilityClassConstructorCheck.java
index 2ebf2efa58..489e8f6f5b 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/HideUtilityClassConstructorCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/HideUtilityClassConstructorCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/InnerClassCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/InnerClassCheck.java
index 53d027fe04..53e83693a2 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/InnerClassCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/InnerClassCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/NestedSwitchCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/NestedSwitchCheck.java
index 46f49aa6ff..ae79ff00d2 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/NestedSwitchCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/NestedSwitchCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/NoMainMethodInAbstractClassCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/NoMainMethodInAbstractClassCheck.java
index 2d0e7637e2..0916e7ee36 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/NoMainMethodInAbstractClassCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/NoMainMethodInAbstractClassCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/PublicReferenceToPrivateTypeCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/PublicReferenceToPrivateTypeCheck.java
index b553ef74f0..558c3f21d3 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/PublicReferenceToPrivateTypeCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/PublicReferenceToPrivateTypeCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/StaticMethodCandidateCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/StaticMethodCandidateCheck.java
index 0698849063..bd66f68488 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/StaticMethodCandidateCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/StaticMethodCandidateCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/package-info.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/package-info.java
index 84e6e5b994..71f558e538 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/package-info.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/package-info.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/naming/EnumValueNameCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/naming/EnumValueNameCheck.java
index b8764ae333..5dc2dfea87 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/naming/EnumValueNameCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/naming/EnumValueNameCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/naming/InterfaceTypeParameterNameCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/naming/InterfaceTypeParameterNameCheck.java
index 6b9ee1f6aa..d769331a58 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/naming/InterfaceTypeParameterNameCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/naming/InterfaceTypeParameterNameCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/naming/UniformEnumConstantNameCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/naming/UniformEnumConstantNameCheck.java
index 07d36cad54..d3f9587a0d 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/naming/UniformEnumConstantNameCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/naming/UniformEnumConstantNameCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/naming/package-info.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/naming/package-info.java
index 0984104852..49d366bfea 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/naming/package-info.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/naming/package-info.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/sizes/LineLengthExtendedCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/sizes/LineLengthExtendedCheck.java
index 09e5bedbe8..affc08fad2 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/sizes/LineLengthExtendedCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/sizes/LineLengthExtendedCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/sizes/package-info.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/sizes/package-info.java
index 7053240875..39638f5dda 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/sizes/package-info.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/sizes/package-info.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/package-info.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/package-info.java
index 9dc6a0f74b..aaf7c26f65 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/package-info.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/package-info.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/BaseCheckTestSupport.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/BaseCheckTestSupport.java
index d8f1433fd7..ff266a0020 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/BaseCheckTestSupport.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/BaseCheckTestSupport.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/UtilsTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/UtilsTest.java
index 06cf9622bf..da1142cb05 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/UtilsTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/UtilsTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationCheckTest.java
index 0b0bb459b4..01e7cd6e70 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationElementValueCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationElementValueCheckTest.java
index c0359932f0..4b0b3e035b 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationElementValueCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationElementValueCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/RequiredParameterForAnnotationCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/RequiredParameterForAnnotationCheckTest.java
index 02c2b70d3d..84d49e6a6e 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/RequiredParameterForAnnotationCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/RequiredParameterForAnnotationCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidConstantAsFirstOperandInConditionCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidConstantAsFirstOperandInConditionCheckTest.java
index 3bd58f84ec..19bbfefbd3 100755
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidConstantAsFirstOperandInConditionCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidConstantAsFirstOperandInConditionCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidDefaultSerializableInInnerClassesCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidDefaultSerializableInInnerClassesCheckTest.java
index 657aa93dec..d784591dcd 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidDefaultSerializableInInnerClassesCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidDefaultSerializableInInnerClassesCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidHidingCauseExceptionCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidHidingCauseExceptionCheckTest.java
index 904c13ea8c..8f75ea773b 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidHidingCauseExceptionCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidHidingCauseExceptionCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidModifiersForTypesCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidModifiersForTypesCheckTest.java
index 69ec3caf0b..601198f36a 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidModifiersForTypesCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidModifiersForTypesCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidNotShortCircuitOperatorsForBooleanCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidNotShortCircuitOperatorsForBooleanCheckTest.java
index 5d0460da06..53b23140f6 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidNotShortCircuitOperatorsForBooleanCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidNotShortCircuitOperatorsForBooleanCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ConfusingConditionCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ConfusingConditionCheckTest.java
index f6491b37ac..1ad9eb2adf 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ConfusingConditionCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ConfusingConditionCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheckTest.java
index 8be87b87c5..e317a0a4fb 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/DiamondOperatorForVariableDefinitionCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/DiamondOperatorForVariableDefinitionCheckTest.java
index f68069e789..ddee381c88 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/DiamondOperatorForVariableDefinitionCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/DiamondOperatorForVariableDefinitionCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/EitherLogOrThrowCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/EitherLogOrThrowCheckTest.java
index d7e4a6bd48..f846798999 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/EitherLogOrThrowCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/EitherLogOrThrowCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/EmptyPublicCtorInClassCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/EmptyPublicCtorInClassCheckTest.java
index 523a60328d..4b3fea1f16 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/EmptyPublicCtorInClassCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/EmptyPublicCtorInClassCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/FinalizeImplementationCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/FinalizeImplementationCheckTest.java
index fbff450cd5..ccf9878411 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/FinalizeImplementationCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/FinalizeImplementationCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidCCommentsInMethodsCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidCCommentsInMethodsCheckTest.java
index 34e52cda37..6d23afaf03 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidCCommentsInMethodsCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidCCommentsInMethodsCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidCertainImportsCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidCertainImportsCheckTest.java
index f480cd395e..da24246371 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidCertainImportsCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidCertainImportsCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidInstantiationCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidInstantiationCheckTest.java
index e0073c34ac..c78697d9e9 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidInstantiationCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidInstantiationCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidReturnInFinallyBlockCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidReturnInFinallyBlockCheckTest.java
index 8b99dbcf42..7d8fddc73e 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidReturnInFinallyBlockCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidReturnInFinallyBlockCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidThrowAnonymousExceptionsCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidThrowAnonymousExceptionsCheckTest.java
index 9c06819f90..2ce3d16c94 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidThrowAnonymousExceptionsCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidThrowAnonymousExceptionsCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/IllegalCatchExtendedCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/IllegalCatchExtendedCheckTest.java
index a80b469fc1..740e7370d9 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/IllegalCatchExtendedCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/IllegalCatchExtendedCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/LogicConditionNeedOptimizationCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/LogicConditionNeedOptimizationCheckTest.java
index 0463a3e05a..7d4d80d290 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/LogicConditionNeedOptimizationCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/LogicConditionNeedOptimizationCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MapIterationInForEachLoopCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MapIterationInForEachLoopCheckTest.java
index 0854436fd0..097c8b0f15 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MapIterationInForEachLoopCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MapIterationInForEachLoopCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MoveVariableInsideIfCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MoveVariableInsideIfCheckTest.java
index a407af37c9..62bccfe085 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MoveVariableInsideIfCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MoveVariableInsideIfCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MultipleStringLiteralsExtendedCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MultipleStringLiteralsExtendedCheckTest.java
index d7168db7af..9ea90f9eb7 100755
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MultipleStringLiteralsExtendedCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MultipleStringLiteralsExtendedCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MultipleVariableDeclarationsExtendedCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MultipleVariableDeclarationsExtendedCheckTest.java
index 0d457e9a5a..c1aae6459f 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MultipleVariableDeclarationsExtendedCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MultipleVariableDeclarationsExtendedCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NameConventionForJunit4TestClassesCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NameConventionForJunit4TestClassesCheckTest.java
index b28df81151..7a66a6937f 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NameConventionForJunit4TestClassesCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NameConventionForJunit4TestClassesCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NoNullForCollectionReturnCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NoNullForCollectionReturnCheckTest.java
index e908399056..d3adbc6f53 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NoNullForCollectionReturnCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NoNullForCollectionReturnCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NumericLiteralNeedsUnderscoreCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NumericLiteralNeedsUnderscoreCheckTest.java
index 0cd959d943..cb2cb7e512 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NumericLiteralNeedsUnderscoreCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NumericLiteralNeedsUnderscoreCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/OverridableMethodInConstructorCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/OverridableMethodInConstructorCheckTest.java
index 32f40aa959..07e700d5bd 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/OverridableMethodInConstructorCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/OverridableMethodInConstructorCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/RedundantReturnCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/RedundantReturnCheckTest.java
index c4deb0980d..1972434835 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/RedundantReturnCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/RedundantReturnCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/RequireFailForTryCatchInJunitCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/RequireFailForTryCatchInJunitCheckTest.java
index f3c7ac0322..6424fc1540 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/RequireFailForTryCatchInJunitCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/RequireFailForTryCatchInJunitCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnBooleanFromTernaryCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnBooleanFromTernaryCheckTest.java
index a0d1941597..2c672ad7c8 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnBooleanFromTernaryCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnBooleanFromTernaryCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnCountExtendedCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnCountExtendedCheckTest.java
index e29d138c96..596b513420 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnCountExtendedCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnCountExtendedCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnNullInsteadOfBooleanCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnNullInsteadOfBooleanCheckTest.java
index 482bd93976..47b2037289 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnNullInsteadOfBooleanCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnNullInsteadOfBooleanCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/SimpleAccessorNameNotationCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/SimpleAccessorNameNotationCheckTest.java
index 94f363e1f5..0ef5c8c861 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/SimpleAccessorNameNotationCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/SimpleAccessorNameNotationCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/SingleBreakOrContinueCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/SingleBreakOrContinueCheckTest.java
index 3ee69687b1..013dc1f86b 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/SingleBreakOrContinueCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/SingleBreakOrContinueCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/TernaryPerExpressionCountCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/TernaryPerExpressionCountCheckTest.java
index 79d60ea128..92a4530bd7 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/TernaryPerExpressionCountCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/TernaryPerExpressionCountCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UnnecessaryParenthesesExtendedCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UnnecessaryParenthesesExtendedCheckTest.java
index 6ac73cd102..6b6778c4b2 100755
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UnnecessaryParenthesesExtendedCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UnnecessaryParenthesesExtendedCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UselessSingleCatchCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UselessSingleCatchCheckTest.java
index c38f092df3..b965617c30 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UselessSingleCatchCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UselessSingleCatchCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UselessSuperCtorCallCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UselessSuperCtorCallCheckTest.java
index e9613de632..73d3dc1179 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UselessSuperCtorCallCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UselessSuperCtorCallCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/WhitespaceBeforeArrayInitializerCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/WhitespaceBeforeArrayInitializerCheckTest.java
index c689b9fed3..2a6a998dcf 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/WhitespaceBeforeArrayInitializerCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/WhitespaceBeforeArrayInitializerCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/AvoidConditionInversionCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/AvoidConditionInversionCheckTest.java
index 35ffaa72e3..980f0d9ad9 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/AvoidConditionInversionCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/AvoidConditionInversionCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/CauseParameterInExceptionCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/CauseParameterInExceptionCheckTest.java
index 5f9d173a8c..6751649f82 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/CauseParameterInExceptionCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/CauseParameterInExceptionCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/CheckstyleTestMakeupCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/CheckstyleTestMakeupCheckTest.java
index 38f3c1900a..fbe7e144ad 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/CheckstyleTestMakeupCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/CheckstyleTestMakeupCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ChildBlockLengthCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ChildBlockLengthCheckTest.java
index 76f1913b93..708abca914 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ChildBlockLengthCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ChildBlockLengthCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ConstructorWithoutParamsCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ConstructorWithoutParamsCheckTest.java
index a6de14b7b4..14d068a708 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ConstructorWithoutParamsCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ConstructorWithoutParamsCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ForbidWildcardAsReturnTypeCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ForbidWildcardAsReturnTypeCheckTest.java
index 23fe22f37f..887d67bc4e 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ForbidWildcardAsReturnTypeCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ForbidWildcardAsReturnTypeCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/HideUtilityClassConstructorCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/HideUtilityClassConstructorCheckTest.java
index b11c478187..e3d057652f 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/HideUtilityClassConstructorCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/HideUtilityClassConstructorCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/InnerClassCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/InnerClassCheckTest.java
index 36244582d9..d26831343e 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/InnerClassCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/InnerClassCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/NestedSwitchCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/NestedSwitchCheckTest.java
index 2ffff2dce9..00aa04353d 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/NestedSwitchCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/NestedSwitchCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/NoMainMethodInAbstractClassCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/NoMainMethodInAbstractClassCheckTest.java
index 7ebc76865c..f24854341a 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/NoMainMethodInAbstractClassCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/NoMainMethodInAbstractClassCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/PublicReferenceToPrivateTypeCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/PublicReferenceToPrivateTypeCheckTest.java
index 42cfa1b5db..4d99cd944a 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/PublicReferenceToPrivateTypeCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/PublicReferenceToPrivateTypeCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/StaticMethodCandidateCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/StaticMethodCandidateCheckTest.java
index 0e149b0cc3..fbbec8da48 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/StaticMethodCandidateCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/StaticMethodCandidateCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/EnumValueNameCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/EnumValueNameCheckTest.java
index 5731cc7e4f..b11ebd2643 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/EnumValueNameCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/EnumValueNameCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/InterfaceTypeParameterNameCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/InterfaceTypeParameterNameCheckTest.java
index efa20e65da..4c704a1c43 100755
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/InterfaceTypeParameterNameCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/InterfaceTypeParameterNameCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/UniformEnumConstantNameCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/UniformEnumConstantNameCheckTest.java
index 018510e27a..c22111446e 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/UniformEnumConstantNameCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/UniformEnumConstantNameCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/sizes/LineLengthExtendedCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/sizes/LineLengthExtendedCheckTest.java
index 2ef5a611fc..4838a92a37 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/sizes/LineLengthExtendedCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/sizes/LineLengthExtendedCheckTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/AllChecksTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/AllChecksTest.java
index 421c807901..8269f28363 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/AllChecksTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/AllChecksTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckUtil.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckUtil.java
index 9c0da79a5f..9c04044157 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckUtil.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckUtil.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/ChecksTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/ChecksTest.java
index 4dd0960cc8..69530047e3 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/ChecksTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/ChecksTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckstyleRegressionTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckstyleRegressionTest.java
index 4cedcc87ce..f4d25eeef8 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckstyleRegressionTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckstyleRegressionTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CommitValidationTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CommitValidationTest.java
index e6b2852802..38221cadb9 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CommitValidationTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CommitValidationTest.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/XmlUtil.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/XmlUtil.java
index 2f84ab4fc9..0b0fc08b7f 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/XmlUtil.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/XmlUtil.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputChildBlockLengthCheckCheckNPE.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputChildBlockLengthCheckCheckNPE.java
index 006df3b8e2..5f4dba87c1 100644
--- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputChildBlockLengthCheckCheckNPE.java
+++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputChildBlockLengthCheckCheckNPE.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputConstructorWithoutParamsCheck.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputConstructorWithoutParamsCheck.java
index 27801d1a57..7b82cfe8c1 100644
--- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputConstructorWithoutParamsCheck.java
+++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputConstructorWithoutParamsCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/naming/InputEnumValueNameCheck.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/naming/InputEnumValueNameCheck.java
index e2c86f8ca9..5daa51214f 100644
--- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/naming/InputEnumValueNameCheck.java
+++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/naming/InputEnumValueNameCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/naming/InputUniformEnumConstantNameCheck.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/naming/InputUniformEnumConstantNameCheck.java
index 4089c31946..faa2a31c3e 100644
--- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/naming/InputUniformEnumConstantNameCheck.java
+++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/naming/InputUniformEnumConstantNameCheck.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
From 641cf801064712c919bc4b33dd422a5e525b30f3 Mon Sep 17 00:00:00 2001
From: rnveach
Date: Wed, 3 Jan 2018 10:15:54 -0500
Subject: [PATCH 145/208] minor: removed deprecated constructor in
DefaultLogger
---
.../com/github/sevntu/checkstyle/BaseCheckTestSupport.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/BaseCheckTestSupport.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/BaseCheckTestSupport.java
index ff266a0020..b3ba059ac0 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/BaseCheckTestSupport.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/BaseCheckTestSupport.java
@@ -169,7 +169,8 @@ public String getCheckMessage(String messageKey, Object... arguments) {
protected static class BriefLogger extends DefaultLogger {
public BriefLogger(OutputStream out) {
- super(out, true, out, false, new AuditEventUtFormatter());
+ super(out, OutputStreamOptions.CLOSE, out, OutputStreamOptions.NONE,
+ new AuditEventUtFormatter());
}
@Override
From 6199923837482ed9b7844bdc06ee432fd53a5930 Mon Sep 17 00:00:00 2001
From: rnveach
Date: Wed, 3 Jan 2018 10:34:22 -0500
Subject: [PATCH 146/208] minor: disabled checkstyle regression temporarily
---
.travis.yml | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 891363a3a2..b76a3d8382 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -60,14 +60,15 @@ matrix:
- CMD=$CMD0$CMD1$CMD2$CMD3
# regression on checkstyle
- - jdk: oraclejdk8
- env:
- - DESC="checkstyle regression"
- - CMD0="git clone https://github.com/checkstyle/checkstyle "
- - CMD1=" && cd sevntu-checks && mvn -e install -DskipTests -Dcheckstyle.skip=true -Dcobertura.skip=true"
- - CMD2=" && mvn -e test -Dtest=CheckstyleRegressionTest#setupFiles -Dregression-path=../"
- - CMD3=" && cd ../ && cd checkstyle && mvn -e clean verify -e -DskipTests -DskipITs -Dpmd.skip=true -Dfindbugs.skip=true -Dcobertura.skip=true"
- - CMD=$CMD0$CMD1$CMD2$CMD3
+ # disabled until https://github.com/sevntu-checkstyle/sevntu.checkstyle/issues/629
+ #- jdk: oraclejdk8
+ # env:
+ # - DESC="checkstyle regression"
+ # - CMD0="git clone https://github.com/checkstyle/checkstyle "
+ # - CMD1=" && cd sevntu-checks && mvn -e install -DskipTests -Dcheckstyle.skip=true -Dcobertura.skip=true"
+ # - CMD2=" && mvn -e test -Dtest=CheckstyleRegressionTest#setupFiles -Dregression-path=../"
+ # - CMD3=" && cd ../ && cd checkstyle && mvn -e clean verify -e -DskipTests -DskipITs -Dpmd.skip=true -Dfindbugs.skip=true -Dcobertura.skip=true"
+ # - CMD=$CMD0$CMD1$CMD2$CMD3
# eclipse static analysis
- jdk: oraclejdk8
From 4bc206ed0b2964d9a55778a5b74832a2cc1f7ec3 Mon Sep 17 00:00:00 2001
From: rnveach
Date: Wed, 3 Jan 2018 13:15:28 -0500
Subject: [PATCH 147/208] Issue #630: use AbstractModuleTestSupport directly
from checkstyle
---
.../checkstyle/BaseCheckTestSupport.java | 190 ------------------
.../annotation/ForbidAnnotationCheckTest.java | 9 +-
...ForbidAnnotationElementValueCheckTest.java | 9 +-
...quiredParameterForAnnotationCheckTest.java | 9 +-
...antAsFirstOperandInConditionCheckTest.java | 9 +-
...ltSerializableInInnerClassesCheckTest.java | 10 +-
.../AvoidHidingCauseExceptionCheckTest.java | 9 +-
.../AvoidModifiersForTypesCheckTest.java | 9 +-
...rtCircuitOperatorsForBooleanCheckTest.java | 9 +-
.../coding/ConfusingConditionCheckTest.java | 9 +-
.../CustomDeclarationOrderCheckTest.java | 9 +-
...peratorForVariableDefinitionCheckTest.java | 9 +-
.../coding/EitherLogOrThrowCheckTest.java | 9 +-
.../EmptyPublicCtorInClassCheckTest.java | 9 +-
.../FinalizeImplementationCheckTest.java | 9 +-
.../ForbidCCommentsInMethodsCheckTest.java | 10 +-
.../coding/ForbidCertainImportsCheckTest.java | 9 +-
.../coding/ForbidInstantiationCheckTest.java | 9 +-
.../ForbidReturnInFinallyBlockCheckTest.java | 10 +-
...rbidThrowAnonymousExceptionsCheckTest.java | 9 +-
.../coding/IllegalCatchExtendedCheckTest.java | 9 +-
...gicConditionNeedOptimizationCheckTest.java | 9 +-
.../MapIterationInForEachLoopCheckTest.java | 9 +-
.../coding/MoveVariableInsideIfCheckTest.java | 9 +-
...ltipleStringLiteralsExtendedCheckTest.java | 9 +-
...VariableDeclarationsExtendedCheckTest.java | 9 +-
...nventionForJunit4TestClassesCheckTest.java | 31 ++-
.../NoNullForCollectionReturnCheckTest.java | 9 +-
...umericLiteralNeedsUnderscoreCheckTest.java | 9 +-
...erridableMethodInConstructorCheckTest.java | 9 +-
.../coding/RedundantReturnCheckTest.java | 9 +-
...equireFailForTryCatchInJunitCheckTest.java | 9 +-
.../ReturnBooleanFromTernaryCheckTest.java | 9 +-
.../coding/ReturnCountExtendedCheckTest.java | 9 +-
.../ReturnNullInsteadOfBooleanCheckTest.java | 9 +-
.../SimpleAccessorNameNotationCheckTest.java | 9 +-
.../SingleBreakOrContinueCheckTest.java | 9 +-
.../TernaryPerExpressionCountCheckTest.java | 9 +-
...necessaryParenthesesExtendedCheckTest.java | 9 +-
.../coding/UselessSingleCatchCheckTest.java | 9 +-
.../coding/UselessSuperCtorCallCheckTest.java | 9 +-
...espaceBeforeArrayInitializerCheckTest.java | 9 +-
.../AvoidConditionInversionCheckTest.java | 9 +-
.../CauseParameterInExceptionCheckTest.java | 9 +-
.../design/CheckstyleTestMakeupCheckTest.java | 9 +-
.../design/ChildBlockLengthCheckTest.java | 9 +-
.../ConstructorWithoutParamsCheckTest.java | 9 +-
.../ForbidWildcardAsReturnTypeCheckTest.java | 9 +-
.../HideUtilityClassConstructorCheckTest.java | 10 +-
.../checks/design/InnerClassCheckTest.java | 9 +-
.../checks/design/NestedSwitchCheckTest.java | 9 +-
.../NoMainMethodInAbstractClassCheckTest.java | 9 +-
...PublicReferenceToPrivateTypeCheckTest.java | 10 +-
.../StaticMethodCandidateCheckTest.java | 9 +-
.../checks/naming/EnumValueNameCheckTest.java | 9 +-
.../InterfaceTypeParameterNameCheckTest.java | 10 +-
.../UniformEnumConstantNameCheckTest.java | 21 +-
.../sizes/LineLengthExtendedCheckTest.java | 9 +-
.../InputAvoidModifiersForTypesCheck2.java | 21 +-
sevntu-checks/suppressions.xml | 1 -
60 files changed, 426 insertions(+), 339 deletions(-)
delete mode 100644 sevntu-checks/src/test/java/com/github/sevntu/checkstyle/BaseCheckTestSupport.java
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/BaseCheckTestSupport.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/BaseCheckTestSupport.java
deleted file mode 100644
index b3ba059ac0..0000000000
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/BaseCheckTestSupport.java
+++ /dev/null
@@ -1,190 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2018 the original author or authors.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-////////////////////////////////////////////////////////////////////////////////
-
-package com.github.sevntu.checkstyle;
-
-import static java.text.MessageFormat.format;
-import static org.junit.Assert.assertEquals;
-
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.PrintStream;
-import java.net.URL;
-import java.util.List;
-import java.util.Locale;
-import java.util.Properties;
-
-import com.google.common.collect.Lists;
-import com.puppycrawl.tools.checkstyle.Checker;
-import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
-import com.puppycrawl.tools.checkstyle.DefaultLogger;
-import com.puppycrawl.tools.checkstyle.TreeWalker;
-import com.puppycrawl.tools.checkstyle.api.AuditEvent;
-import com.puppycrawl.tools.checkstyle.api.Configuration;
-import com.puppycrawl.tools.checkstyle.internal.utils.AuditEventUtFormatter;
-
-public abstract class BaseCheckTestSupport {
-
- private final ByteArrayOutputStream baos = new ByteArrayOutputStream();
- private final PrintStream printStream = new PrintStream(baos);
-
- public static DefaultConfiguration createModuleConfig(Class> clazz) {
- return new DefaultConfiguration(clazz.getName());
- }
-
- protected void verify(Configuration config, String fileName, String[] expected)
- throws Exception {
- verify(createChecker(config), fileName, fileName, expected);
- }
-
- protected void verify(Checker checker, String fileName, String[] expected) throws Exception {
- verify(checker, fileName, fileName, expected);
- }
-
- protected void verify(Checker checker, String processedFilename, String messageFileName,
- String[] aExpected) throws Exception {
- verify(checker, new File[] {new File(processedFilename)}, messageFileName, aExpected);
- }
-
- protected void verify(Checker checker, File[] processedFiles, String messageFileName,
- String[] expected) throws Exception {
- printStream.flush();
- final List testInputFiles = Lists.newArrayList(processedFiles);
- final int foundErrorsCount = checker.process(testInputFiles);
-
- // Process each output line
- final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
- final BufferedReader br = new BufferedReader(new InputStreamReader(bais));
-
- try {
- for (int i = 0; i < expected.length; i++) {
- final String expectedResult = messageFileName + ":" + expected[i];
- final String actual = br.readLine();
- assertEquals("error message " + i, expectedResult, actual);
- }
-
- assertEquals("Check generated unexpected warning: " + br.readLine(), expected.length,
- foundErrorsCount);
- checker.destroy();
- }
- finally {
- br.close();
- bais.close();
- }
- }
-
- protected Checker createChecker(Configuration checkConfig) throws Exception {
- final Checker checker = new Checker();
- // make sure the tests always run with english error messages
- // so the tests don't fail in supported locales like german
- final Locale locale = Locale.ENGLISH;
- checker.setLocaleCountry(locale.getCountry());
- checker.setLocaleLanguage(locale.getLanguage());
- checker.setModuleClassLoader(Thread.currentThread().getContextClassLoader());
-
- final DefaultConfiguration defaultConfig = createCheckerConfig(checkConfig);
- checker.configure(defaultConfig);
-
- checker.addListener(new BriefLogger(printStream));
- return checker;
- }
-
- protected DefaultConfiguration createCheckerConfig(Configuration config) {
- final DefaultConfiguration result = new DefaultConfiguration("configuration");
- final DefaultConfiguration treeWalkerConfig = createModuleConfig(TreeWalker.class);
- // make sure that the tests always run with this charset
- result.addAttribute("charset", "iso-8859-1");
- result.addChild(treeWalkerConfig);
- treeWalkerConfig.addChild(config);
- return result;
- }
-
- protected String getPath(String filename) {
- String result = null;
- try {
- final URL resource = getClass().getResource(filename);
- if (resource == null) {
- throw new RuntimeException(String.format("Resource '%s' can NOT be found "
- + "(does not exist or just not visible for current classloader)",
- filename));
- }
- else {
- result = new File(resource.getPath()).getCanonicalPath();
- }
- }
- catch (IOException ex) {
- throw new RuntimeException("Error while getting path for resource: " + filename, ex);
- }
- return result;
- }
-
- /**
- * Gets the check message 'as is' from appropriate 'messages.properties' file.
- * @param messageKey the key of message in 'messages.properties' file.
- */
- public String getCheckMessage(String messageKey) {
- String result;
- final Properties pr = new Properties();
- try {
- pr.load(getClass().getResourceAsStream("messages.properties"));
- result = pr.getProperty(messageKey);
- }
- catch (IOException ex) {
- result = null;
- }
- return result;
- }
-
- /**
- * Gets the check message 'as is' from appropriate 'messages.properties' file.
- * @param messageKey the key of message in 'messages.properties' file.
- * @param arguments the arguments of message in 'messages.properties' file.
- */
- public String getCheckMessage(String messageKey, Object... arguments) {
- return format(getCheckMessage(messageKey), arguments);
- }
-
- /** A brief logger that only display errors */
- protected static class BriefLogger extends DefaultLogger {
-
- public BriefLogger(OutputStream out) {
- super(out, OutputStreamOptions.CLOSE, out, OutputStreamOptions.NONE,
- new AuditEventUtFormatter());
- }
-
- @Override
- public void auditStarted(AuditEvent evt) {
- }
-
- @Override
- public void fileFinished(AuditEvent evt) {
- }
-
- @Override
- public void fileStarted(AuditEvent evt) {
- }
-
- }
-
-}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationCheckTest.java
index 01e7cd6e70..fe13c014b4 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationCheckTest.java
@@ -23,7 +23,7 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
/**
@@ -32,7 +32,12 @@
* @author Hidoyatov Victor
*
*/
-public class ForbidAnnotationCheckTest extends BaseCheckTestSupport {
+public class ForbidAnnotationCheckTest extends AbstractModuleTestSupport {
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/annotation";
+ }
@Test
public void testDefaultCheck() throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationElementValueCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationElementValueCheckTest.java
index 4b0b3e035b..5cad4dbb82 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationElementValueCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationElementValueCheckTest.java
@@ -23,10 +23,15 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
-public class ForbidAnnotationElementValueCheckTest extends BaseCheckTestSupport {
+public class ForbidAnnotationElementValueCheckTest extends AbstractModuleTestSupport {
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/annotation";
+ }
@Test
public void testAnnotationWithStringParameter() throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/RequiredParameterForAnnotationCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/RequiredParameterForAnnotationCheckTest.java
index 84d49e6a6e..000ba85d3c 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/RequiredParameterForAnnotationCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/RequiredParameterForAnnotationCheckTest.java
@@ -24,10 +24,15 @@
import org.junit.Assert;
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
-public class RequiredParameterForAnnotationCheckTest extends BaseCheckTestSupport {
+public class RequiredParameterForAnnotationCheckTest extends AbstractModuleTestSupport {
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/annotation";
+ }
@Test
public void testValidateRequiredParameter()
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidConstantAsFirstOperandInConditionCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidConstantAsFirstOperandInConditionCheckTest.java
index 19bbfefbd3..5e582afb52 100755
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidConstantAsFirstOperandInConditionCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidConstantAsFirstOperandInConditionCheckTest.java
@@ -23,10 +23,15 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
-public class AvoidConstantAsFirstOperandInConditionCheckTest extends BaseCheckTestSupport {
+public class AvoidConstantAsFirstOperandInConditionCheckTest extends AbstractModuleTestSupport {
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
@Test
public void testAll() throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidDefaultSerializableInInnerClassesCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidDefaultSerializableInInnerClassesCheckTest.java
index d784591dcd..b92781f5bf 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidDefaultSerializableInInnerClassesCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidDefaultSerializableInInnerClassesCheckTest.java
@@ -23,14 +23,18 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
-public class AvoidDefaultSerializableInInnerClassesCheckTest extends
- BaseCheckTestSupport {
+public class AvoidDefaultSerializableInInnerClassesCheckTest extends AbstractModuleTestSupport {
private final String warningMessage = getCheckMessage(MSG_KEY);
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
+
@Test
public void testWithAllowPartiaFalse()
throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidHidingCauseExceptionCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidHidingCauseExceptionCheckTest.java
index 8f75ea773b..e53606524d 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidHidingCauseExceptionCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidHidingCauseExceptionCheckTest.java
@@ -23,11 +23,16 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.utils.CommonUtils;
-public class AvoidHidingCauseExceptionCheckTest extends BaseCheckTestSupport {
+public class AvoidHidingCauseExceptionCheckTest extends AbstractModuleTestSupport {
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
@Test
public final void issue52Test() throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidModifiersForTypesCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidModifiersForTypesCheckTest.java
index 601198f36a..b48891a06f 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidModifiersForTypesCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidModifiersForTypesCheckTest.java
@@ -25,7 +25,7 @@
import org.junit.Assert;
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
@@ -36,7 +36,12 @@
* @author Yasser Aziza
*
*/
-public class AvoidModifiersForTypesCheckTest extends BaseCheckTestSupport {
+public class AvoidModifiersForTypesCheckTest extends AbstractModuleTestSupport {
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
@Test
public void testFinal() throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidNotShortCircuitOperatorsForBooleanCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidNotShortCircuitOperatorsForBooleanCheckTest.java
index 53b23140f6..ccfa4464ac 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidNotShortCircuitOperatorsForBooleanCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidNotShortCircuitOperatorsForBooleanCheckTest.java
@@ -23,11 +23,16 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.utils.CommonUtils;
-public class AvoidNotShortCircuitOperatorsForBooleanCheckTest extends BaseCheckTestSupport {
+public class AvoidNotShortCircuitOperatorsForBooleanCheckTest extends AbstractModuleTestSupport {
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
@Test
public final void testAll() throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ConfusingConditionCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ConfusingConditionCheckTest.java
index 1ad9eb2adf..1a89a56333 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ConfusingConditionCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ConfusingConditionCheckTest.java
@@ -23,16 +23,21 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
/**
* @author Vadim Panasiuk
*/
-public class ConfusingConditionCheckTest extends BaseCheckTestSupport {
+public class ConfusingConditionCheckTest extends AbstractModuleTestSupport {
private final String warningMessage = getCheckMessage(MSG_KEY);
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
+
@Test
public void testDefault() throws Exception {
final DefaultConfiguration checkConfig = createModuleConfig(ConfusingConditionCheck.class);
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheckTest.java
index e317a0a4fb..b5c38c0f2c 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheckTest.java
@@ -28,10 +28,15 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
-public class CustomDeclarationOrderCheckTest extends BaseCheckTestSupport {
+public class CustomDeclarationOrderCheckTest extends AbstractModuleTestSupport {
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
@Test
public void testCustomDecrationOrder() throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/DiamondOperatorForVariableDefinitionCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/DiamondOperatorForVariableDefinitionCheckTest.java
index ddee381c88..3dfdc15dae 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/DiamondOperatorForVariableDefinitionCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/DiamondOperatorForVariableDefinitionCheckTest.java
@@ -23,10 +23,15 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
-public class DiamondOperatorForVariableDefinitionCheckTest extends BaseCheckTestSupport {
+public class DiamondOperatorForVariableDefinitionCheckTest extends AbstractModuleTestSupport {
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
@Test
public void testDefault() throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/EitherLogOrThrowCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/EitherLogOrThrowCheckTest.java
index f846798999..de18fd02a1 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/EitherLogOrThrowCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/EitherLogOrThrowCheckTest.java
@@ -23,17 +23,22 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
/**
* Test for EitherLogOrThrowCheck.
* @author Baratali Izmailov
*/
-public class EitherLogOrThrowCheckTest extends BaseCheckTestSupport {
+public class EitherLogOrThrowCheckTest extends AbstractModuleTestSupport {
private final String warningMessage = getCheckMessage(MSG_KEY);
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
+
@Test
public void test() throws Exception {
final DefaultConfiguration checkConfig = createModuleConfig(EitherLogOrThrowCheck.class);
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/EmptyPublicCtorInClassCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/EmptyPublicCtorInClassCheckTest.java
index 4b3fea1f16..251ac16369 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/EmptyPublicCtorInClassCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/EmptyPublicCtorInClassCheckTest.java
@@ -25,15 +25,20 @@
import org.junit.Assert;
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
-public class EmptyPublicCtorInClassCheckTest extends BaseCheckTestSupport {
+public class EmptyPublicCtorInClassCheckTest extends AbstractModuleTestSupport {
private final String message = getCheckMessage(MSG_KEY);
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
+
@Test
public void testEmptyPublicCtor()
throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/FinalizeImplementationCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/FinalizeImplementationCheckTest.java
index ccf9878411..c6d6cd988d 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/FinalizeImplementationCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/FinalizeImplementationCheckTest.java
@@ -26,10 +26,15 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
-public class FinalizeImplementationCheckTest extends BaseCheckTestSupport {
+public class FinalizeImplementationCheckTest extends AbstractModuleTestSupport {
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
@Test
public final void basicTest() throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidCCommentsInMethodsCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidCCommentsInMethodsCheckTest.java
index 6d23afaf03..ee6e7d5a47 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidCCommentsInMethodsCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidCCommentsInMethodsCheckTest.java
@@ -23,14 +23,18 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
-public class ForbidCCommentsInMethodsCheckTest extends
- BaseCheckTestSupport {
+public class ForbidCCommentsInMethodsCheckTest extends AbstractModuleTestSupport {
private final String warningMessage = getCheckMessage(MSG_KEY);
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
+
@Test
public void defaultTest()
throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidCertainImportsCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidCertainImportsCheckTest.java
index da24246371..9843057e21 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidCertainImportsCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidCertainImportsCheckTest.java
@@ -25,7 +25,7 @@
import org.junit.Assert;
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
@@ -34,7 +34,12 @@
* @author Daniil
* Yaroslavtsev
*/
-public class ForbidCertainImportsCheckTest extends BaseCheckTestSupport {
+public class ForbidCertainImportsCheckTest extends AbstractModuleTestSupport {
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
@Test
public void testNormalWork() throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidInstantiationCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidInstantiationCheckTest.java
index c78697d9e9..1eca4183ba 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidInstantiationCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidInstantiationCheckTest.java
@@ -25,7 +25,7 @@
import org.junit.Assert;
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
@@ -34,7 +34,12 @@
* @author Daniil
* Yaroslavtsev
*/
-public class ForbidInstantiationCheckTest extends BaseCheckTestSupport {
+public class ForbidInstantiationCheckTest extends AbstractModuleTestSupport {
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
@Test
public void testNullProperties() throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidReturnInFinallyBlockCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidReturnInFinallyBlockCheckTest.java
index 7d8fddc73e..d90757d957 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidReturnInFinallyBlockCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidReturnInFinallyBlockCheckTest.java
@@ -23,17 +23,21 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
-public class ForbidReturnInFinallyBlockCheckTest
- extends BaseCheckTestSupport {
+public class ForbidReturnInFinallyBlockCheckTest extends AbstractModuleTestSupport {
/**
* An error message for current check.
*/
private final String warningMessage = getCheckMessage(MSG_KEY);
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
+
@Test
public void testDefault()
throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidThrowAnonymousExceptionsCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidThrowAnonymousExceptionsCheckTest.java
index 2ce3d16c94..abcea970ba 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidThrowAnonymousExceptionsCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidThrowAnonymousExceptionsCheckTest.java
@@ -23,10 +23,15 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
-public class ForbidThrowAnonymousExceptionsCheckTest extends BaseCheckTestSupport {
+public class ForbidThrowAnonymousExceptionsCheckTest extends AbstractModuleTestSupport {
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
@Test
public final void anonymousExceptionTest() throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/IllegalCatchExtendedCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/IllegalCatchExtendedCheckTest.java
index 740e7370d9..faf851ca94 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/IllegalCatchExtendedCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/IllegalCatchExtendedCheckTest.java
@@ -23,10 +23,15 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
-public class IllegalCatchExtendedCheckTest extends BaseCheckTestSupport {
+public class IllegalCatchExtendedCheckTest extends AbstractModuleTestSupport {
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
@Test
public final void testDefault() throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/LogicConditionNeedOptimizationCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/LogicConditionNeedOptimizationCheckTest.java
index 7d4d80d290..be23c1cb5b 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/LogicConditionNeedOptimizationCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/LogicConditionNeedOptimizationCheckTest.java
@@ -23,10 +23,15 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
-public class LogicConditionNeedOptimizationCheckTest extends BaseCheckTestSupport {
+public class LogicConditionNeedOptimizationCheckTest extends AbstractModuleTestSupport {
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
@Test
public void test() throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MapIterationInForEachLoopCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MapIterationInForEachLoopCheckTest.java
index 097c8b0f15..73e787744b 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MapIterationInForEachLoopCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MapIterationInForEachLoopCheckTest.java
@@ -25,11 +25,16 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.utils.CommonUtils;
-public class MapIterationInForEachLoopCheckTest extends BaseCheckTestSupport {
+public class MapIterationInForEachLoopCheckTest extends AbstractModuleTestSupport {
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
@Test
public final void basicTest() throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MoveVariableInsideIfCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MoveVariableInsideIfCheckTest.java
index 62bccfe085..4780171115 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MoveVariableInsideIfCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MoveVariableInsideIfCheckTest.java
@@ -23,11 +23,16 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.utils.CommonUtils;
-public class MoveVariableInsideIfCheckTest extends BaseCheckTestSupport {
+public class MoveVariableInsideIfCheckTest extends AbstractModuleTestSupport {
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
@Test
public final void testNoViolations() throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MultipleStringLiteralsExtendedCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MultipleStringLiteralsExtendedCheckTest.java
index 9ea90f9eb7..092e886557 100755
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MultipleStringLiteralsExtendedCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MultipleStringLiteralsExtendedCheckTest.java
@@ -23,10 +23,15 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
-public class MultipleStringLiteralsExtendedCheckTest extends BaseCheckTestSupport {
+public class MultipleStringLiteralsExtendedCheckTest extends AbstractModuleTestSupport {
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
@Test
public void testIt() throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MultipleVariableDeclarationsExtendedCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MultipleVariableDeclarationsExtendedCheckTest.java
index c1aae6459f..da4b5352d3 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MultipleVariableDeclarationsExtendedCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MultipleVariableDeclarationsExtendedCheckTest.java
@@ -24,15 +24,20 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
/** Test class. */
-public class MultipleVariableDeclarationsExtendedCheckTest extends BaseCheckTestSupport {
+public class MultipleVariableDeclarationsExtendedCheckTest extends AbstractModuleTestSupport {
private final String msgVarDeclarationsComa = getCheckMessage(MSG_VAR_DECLARATIONS_COMMA);
private final String msgVarDeclarations = getCheckMessage(MSG_VAR_DECLARATIONS);
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
+
@Test
public void testStandartSituation() throws Exception {
final DefaultConfiguration checkConfig =
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NameConventionForJunit4TestClassesCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NameConventionForJunit4TestClassesCheckTest.java
index 7a66a6937f..04ccb97dfe 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NameConventionForJunit4TestClassesCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NameConventionForJunit4TestClassesCheckTest.java
@@ -19,21 +19,21 @@
package com.github.sevntu.checkstyle.checks.coding;
-import java.text.MessageFormat;
-
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
/**
* @author Denis Antonenkov
* @author Zuy Alexey
*/
-public class NameConventionForJunit4TestClassesCheckTest extends BaseCheckTestSupport {
+public class NameConventionForJunit4TestClassesCheckTest extends AbstractModuleTestSupport {
- private final String msgFormat =
- getCheckMessage(NameConventionForJunit4TestClassesCheck.MSG_KEY);
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
@Test
public void testAnnotatedClass()
@@ -46,7 +46,7 @@ public void testAnnotatedClass()
customConfig.addAttribute("methodAnnotationNameRegex", "");
final String[] expected = {
- buildMesssage("14:18: ",
+ "14:18: " + getCheckMessage(NameConventionForJunit4TestClassesCheck.MSG_KEY,
".+Test\\d*|.+Tests\\d*|Test.+|Tests.+|.+IT|.+ITs|.+TestCase|.+TestCases"),
};
@@ -65,7 +65,7 @@ public void testAnnotatedMethod()
checkConfig.addAttribute("methodAnnotationNameRegex", "Test");
final String[] expected = {
- buildMesssage("8:18: ",
+ "8:18: " + getCheckMessage(NameConventionForJunit4TestClassesCheck.MSG_KEY,
".+Test\\d*|.+Tests\\d*|Test.+|Tests.+|.+IT|.+ITs|.+TestCase|.+TestCases"),
};
@@ -101,7 +101,7 @@ public void testRegex()
checkConfig.addAttribute("methodAnnotationNameRegex", "Test");
final String[] expected = {
- buildMesssage("7:18: ",
+ "7:18: " + getCheckMessage(NameConventionForJunit4TestClassesCheck.MSG_KEY,
".+Test\\d*|.+Tests\\d*|Test.+|Tests.+|.+IT|.+ITs|.+TestCase|.+TestCases"),
};
@@ -120,7 +120,7 @@ public void testQualifiedAnnotationName()
customConfig.addAttribute("methodAnnotationNameRegex", "org.junit.Test");
final String[] expected = {
- buildMesssage("8:18: ",
+ "8:18: " + getCheckMessage(NameConventionForJunit4TestClassesCheck.MSG_KEY,
".+Test\\d*|.+Tests\\d*|Test.+|Tests.+|.+IT|.+ITs|.+TestCase|.+TestCases"),
};
@@ -139,7 +139,7 @@ public void testJunitClassTestAnnotationNamesRegexOption()
customConfig.addAttribute("methodAnnotationNameRegex", "");
final String[] expected = {
- buildMesssage("7:18: ",
+ "7:18: " + getCheckMessage(NameConventionForJunit4TestClassesCheck.MSG_KEY,
".+Test\\d*|.+Tests\\d*|Test.+|Tests.+|.+IT|.+ITs|.+TestCase|.+TestCases"),
};
@@ -158,7 +158,7 @@ public void testJunitMethodTestAnnotationNamesRegexOption()
customConfig.addAttribute("methodAnnotationNameRegex", "SomeTestAnnotation");
final String[] expected = {
- buildMesssage("6:18: ",
+ "6:18: " + getCheckMessage(NameConventionForJunit4TestClassesCheck.MSG_KEY,
".+Test\\d*|.+Tests\\d*|Test.+|Tests.+|.+IT|.+ITs|.+TestCase|.+TestCases"),
};
@@ -176,7 +176,8 @@ public void testCorrectTestClassNameRegexOption()
customConfig.addAttribute("methodAnnotationNameRegex", "Test");
final String[] expected = {
- buildMesssage("5:14: ", "Hello*"),
+ "5:14: "
+ + getCheckMessage(NameConventionForJunit4TestClassesCheck.MSG_KEY, "Hello*"),
};
verify(customConfig, getPath("InputNameConventionForJunit4TestClassesCheck8.java"),
@@ -213,8 +214,4 @@ public void testEmptyProperties()
expected);
}
- private String buildMesssage(String lineNumber, String arguments) {
- return lineNumber + MessageFormat.format(msgFormat, arguments);
- }
-
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NoNullForCollectionReturnCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NoNullForCollectionReturnCheckTest.java
index d3adbc6f53..60146813a7 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NoNullForCollectionReturnCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NoNullForCollectionReturnCheckTest.java
@@ -23,13 +23,18 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
-public class NoNullForCollectionReturnCheckTest extends BaseCheckTestSupport {
+public class NoNullForCollectionReturnCheckTest extends AbstractModuleTestSupport {
private final String warningMessage = getCheckMessage(MSG_KEY);
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
+
@Test
public void testArraysNotDeep() throws Exception {
final DefaultConfiguration checkConfig =
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NumericLiteralNeedsUnderscoreCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NumericLiteralNeedsUnderscoreCheckTest.java
index cb2cb7e512..d41c4de07a 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NumericLiteralNeedsUnderscoreCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NumericLiteralNeedsUnderscoreCheckTest.java
@@ -32,18 +32,23 @@
import org.powermock.modules.junit4.PowerMockRunner;
import org.powermock.reflect.internal.WhiteboxImpl;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
import com.github.sevntu.checkstyle.checks.coding.NumericLiteralNeedsUnderscoreCheck.NumericType;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
@RunWith(PowerMockRunner.class)
@PrepareForTest(NumericType.class)
-public class NumericLiteralNeedsUnderscoreCheckTest extends BaseCheckTestSupport {
+public class NumericLiteralNeedsUnderscoreCheckTest extends AbstractModuleTestSupport {
private static final String EXCEPTION_MESSAGE = "Unexpected numeric type ";
private final String warningMessage = getCheckMessage(MSG_KEY);
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
+
@Test
public void test() throws Exception {
final DefaultConfiguration checkConfig =
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/OverridableMethodInConstructorCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/OverridableMethodInConstructorCheckTest.java
index 07e700d5bd..8d1f1077cf 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/OverridableMethodInConstructorCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/OverridableMethodInConstructorCheckTest.java
@@ -24,15 +24,20 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
-public class OverridableMethodInConstructorCheckTest extends BaseCheckTestSupport {
+public class OverridableMethodInConstructorCheckTest extends AbstractModuleTestSupport {
private static final String CTOR_KEY = "constructor";
private static final String CLONE_KEY = "'clone()' method";
private static final String READ_OBJECT_KEY = "'readObject()' method";
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
+
@Test
public final void revereCodeTest() throws Exception {
final DefaultConfiguration checkConfig =
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/RedundantReturnCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/RedundantReturnCheckTest.java
index 1972434835..1e61a54a25 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/RedundantReturnCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/RedundantReturnCheckTest.java
@@ -25,12 +25,17 @@
import org.junit.Assert;
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
-public class RedundantReturnCheckTest extends BaseCheckTestSupport {
+public class RedundantReturnCheckTest extends AbstractModuleTestSupport {
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
@Test
public void testInputWithIgnoreEmptyConstructorsTrue()
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/RequireFailForTryCatchInJunitCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/RequireFailForTryCatchInJunitCheckTest.java
index 6424fc1540..b1933a15aa 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/RequireFailForTryCatchInJunitCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/RequireFailForTryCatchInJunitCheckTest.java
@@ -25,13 +25,18 @@
import org.junit.Assert;
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import com.puppycrawl.tools.checkstyle.utils.CommonUtils;
-public class RequireFailForTryCatchInJunitCheckTest extends BaseCheckTestSupport {
+public class RequireFailForTryCatchInJunitCheckTest extends AbstractModuleTestSupport {
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
@Test
public void testIndifferent1() throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnBooleanFromTernaryCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnBooleanFromTernaryCheckTest.java
index 2c672ad7c8..31b174c71d 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnBooleanFromTernaryCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnBooleanFromTernaryCheckTest.java
@@ -23,13 +23,18 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
-public class ReturnBooleanFromTernaryCheckTest extends BaseCheckTestSupport {
+public class ReturnBooleanFromTernaryCheckTest extends AbstractModuleTestSupport {
private final String warninigMessage = getCheckMessage(MSG_KEY);
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
+
@Test
public void testDefault() throws Exception {
final DefaultConfiguration checkConfig =
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnCountExtendedCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnCountExtendedCheckTest.java
index 596b513420..47839b808f 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnCountExtendedCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnCountExtendedCheckTest.java
@@ -25,10 +25,15 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
-public class ReturnCountExtendedCheckTest extends BaseCheckTestSupport {
+public class ReturnCountExtendedCheckTest extends AbstractModuleTestSupport {
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
@Test
public void testNullOnIgnoreMethodsNames() throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnNullInsteadOfBooleanCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnNullInsteadOfBooleanCheckTest.java
index 47b2037289..74d1695a51 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnNullInsteadOfBooleanCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnNullInsteadOfBooleanCheckTest.java
@@ -25,15 +25,20 @@
import org.junit.Assert;
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
-public class ReturnNullInsteadOfBooleanCheckTest extends BaseCheckTestSupport {
+public class ReturnNullInsteadOfBooleanCheckTest extends AbstractModuleTestSupport {
private final String warningMessage = getCheckMessage(MSG_KEY);
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
+
@Test
public void testDefault() throws Exception {
final DefaultConfiguration checkConfig =
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/SimpleAccessorNameNotationCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/SimpleAccessorNameNotationCheckTest.java
index 0ef5c8c861..91f593908f 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/SimpleAccessorNameNotationCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/SimpleAccessorNameNotationCheckTest.java
@@ -24,14 +24,19 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
-public class SimpleAccessorNameNotationCheckTest extends BaseCheckTestSupport {
+public class SimpleAccessorNameNotationCheckTest extends AbstractModuleTestSupport {
private final String warningGetterMessage = getCheckMessage(MSG_KEY_GETTER);
private final String warningSetterMessage = getCheckMessage(MSG_KEY_SETTER);
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
+
@Test
public void test() throws Exception {
final DefaultConfiguration checkConfig =
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/SingleBreakOrContinueCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/SingleBreakOrContinueCheckTest.java
index 013dc1f86b..9078463148 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/SingleBreakOrContinueCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/SingleBreakOrContinueCheckTest.java
@@ -23,19 +23,24 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
/**
* @author Yasser Aziza
*/
-public class SingleBreakOrContinueCheckTest extends BaseCheckTestSupport {
+public class SingleBreakOrContinueCheckTest extends AbstractModuleTestSupport {
/**
* An error message for current check.
*/
private final String warningMessage = getCheckMessage(MSG_KEY);
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
+
@Test
public void testDefault()
throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/TernaryPerExpressionCountCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/TernaryPerExpressionCountCheckTest.java
index 92a4530bd7..616fabbe56 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/TernaryPerExpressionCountCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/TernaryPerExpressionCountCheckTest.java
@@ -24,14 +24,19 @@
import org.junit.Assert;
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.api.CheckstyleException;
/**
* @author Aleksey Nesterenko
*/
-public class TernaryPerExpressionCountCheckTest extends BaseCheckTestSupport {
+public class TernaryPerExpressionCountCheckTest extends AbstractModuleTestSupport {
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
@Test
public void testWithDefaultTernaryPerExpressionCountValue()
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UnnecessaryParenthesesExtendedCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UnnecessaryParenthesesExtendedCheckTest.java
index 6b6778c4b2..c21c510911 100755
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UnnecessaryParenthesesExtendedCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UnnecessaryParenthesesExtendedCheckTest.java
@@ -28,7 +28,7 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
/**
@@ -37,7 +37,12 @@
* @author Eric K. Roe
* @author Antonenko Dmitriy
*/
-public class UnnecessaryParenthesesExtendedCheckTest extends BaseCheckTestSupport {
+public class UnnecessaryParenthesesExtendedCheckTest extends AbstractModuleTestSupport {
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
@Test
public void testDefault() throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UselessSingleCatchCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UselessSingleCatchCheckTest.java
index b965617c30..edcd328c0f 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UselessSingleCatchCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UselessSingleCatchCheckTest.java
@@ -23,13 +23,18 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
-public class UselessSingleCatchCheckTest extends BaseCheckTestSupport {
+public class UselessSingleCatchCheckTest extends AbstractModuleTestSupport {
private final String warningMessage = getCheckMessage(MSG_KEY);
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
+
@Test
public void testMultiCatch() throws Exception {
final DefaultConfiguration config = createModuleConfig(UselessSingleCatchCheck.class);
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UselessSuperCtorCallCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UselessSuperCtorCallCheckTest.java
index 73d3dc1179..b399666292 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UselessSuperCtorCallCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UselessSuperCtorCallCheckTest.java
@@ -24,10 +24,15 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
-public class UselessSuperCtorCallCheckTest extends BaseCheckTestSupport {
+public class UselessSuperCtorCallCheckTest extends AbstractModuleTestSupport {
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
@Test
public void testSingleCtorWithSuperWithinNotDerivedClass()
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/WhitespaceBeforeArrayInitializerCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/WhitespaceBeforeArrayInitializerCheckTest.java
index 2a6a998dcf..6da9e912ef 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/WhitespaceBeforeArrayInitializerCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/WhitespaceBeforeArrayInitializerCheckTest.java
@@ -23,10 +23,15 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
-public class WhitespaceBeforeArrayInitializerCheckTest extends BaseCheckTestSupport {
+public class WhitespaceBeforeArrayInitializerCheckTest extends AbstractModuleTestSupport {
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
@Test
public void testWhitespaceBeforeArrayInitializer() throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/AvoidConditionInversionCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/AvoidConditionInversionCheckTest.java
index 980f0d9ad9..3d35e704e7 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/AvoidConditionInversionCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/AvoidConditionInversionCheckTest.java
@@ -25,7 +25,7 @@
import org.junit.Assert;
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
@@ -35,7 +35,12 @@
* @author Aleksey Nesterenko
*
*/
-public class AvoidConditionInversionCheckTest extends BaseCheckTestSupport {
+public class AvoidConditionInversionCheckTest extends AbstractModuleTestSupport {
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/design";
+ }
@Test
public void defaultTest() throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/CauseParameterInExceptionCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/CauseParameterInExceptionCheckTest.java
index 6751649f82..76c60b6c75 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/CauseParameterInExceptionCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/CauseParameterInExceptionCheckTest.java
@@ -25,7 +25,7 @@
import org.junit.Assert;
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
@@ -34,7 +34,12 @@
* @author Daniil
* Yaroslavtsev
*/
-public class CauseParameterInExceptionCheckTest extends BaseCheckTestSupport {
+public class CauseParameterInExceptionCheckTest extends AbstractModuleTestSupport {
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/design";
+ }
@Test
public void testNormalWork() throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/CheckstyleTestMakeupCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/CheckstyleTestMakeupCheckTest.java
index fbe7e144ad..c80fed1843 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/CheckstyleTestMakeupCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/CheckstyleTestMakeupCheckTest.java
@@ -29,12 +29,17 @@
import org.junit.Assert;
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
-public class CheckstyleTestMakeupCheckTest extends BaseCheckTestSupport {
+public class CheckstyleTestMakeupCheckTest extends AbstractModuleTestSupport {
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/design";
+ }
@Test
public void testMiscFile() throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ChildBlockLengthCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ChildBlockLengthCheckTest.java
index 708abca914..56a04c0f47 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ChildBlockLengthCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ChildBlockLengthCheckTest.java
@@ -23,14 +23,19 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
/**
* @author Daniil
* Yaroslavtsev
*/
-public class ChildBlockLengthCheckTest extends BaseCheckTestSupport {
+public class ChildBlockLengthCheckTest extends AbstractModuleTestSupport {
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/design";
+ }
@Test
public void testNpeOnAllBlockTypes() throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ConstructorWithoutParamsCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ConstructorWithoutParamsCheckTest.java
index 14d068a708..bccf77538b 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ConstructorWithoutParamsCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ConstructorWithoutParamsCheckTest.java
@@ -24,11 +24,16 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
-public class ConstructorWithoutParamsCheckTest extends BaseCheckTestSupport {
+public class ConstructorWithoutParamsCheckTest extends AbstractModuleTestSupport {
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/design";
+ }
@Test
public void testDefaultConfigProhibitsExceptionsWithoutParams() throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ForbidWildcardAsReturnTypeCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ForbidWildcardAsReturnTypeCheckTest.java
index 887d67bc4e..52546f7819 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ForbidWildcardAsReturnTypeCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/ForbidWildcardAsReturnTypeCheckTest.java
@@ -27,7 +27,7 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.utils.CommonUtils;
@@ -35,7 +35,7 @@
* Test class for ForbidWildcardInReturnTypeCheck.
* @author Baratali Izmailov
*/
-public class ForbidWildcardAsReturnTypeCheckTest extends BaseCheckTestSupport {
+public class ForbidWildcardAsReturnTypeCheckTest extends AbstractModuleTestSupport {
/**
* Line numbers with methods which have wildcard in return type.
@@ -110,6 +110,11 @@ public ForbidWildcardAsReturnTypeCheckTest() {
LINES.addAll(LINES_WITH_PUBLIC_METHODS);
}
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/design";
+ }
+
/**
* Main test.
* @throws Exception
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/HideUtilityClassConstructorCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/HideUtilityClassConstructorCheckTest.java
index e3d057652f..5a9a0a0c6f 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/HideUtilityClassConstructorCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/HideUtilityClassConstructorCheckTest.java
@@ -23,11 +23,15 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
-public class HideUtilityClassConstructorCheckTest
- extends BaseCheckTestSupport {
+public class HideUtilityClassConstructorCheckTest extends AbstractModuleTestSupport {
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/design";
+ }
/** Only static methods and no constructor - default ctor is visible */
@Test
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/InnerClassCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/InnerClassCheckTest.java
index d26831343e..08ed1b0e00 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/InnerClassCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/InnerClassCheckTest.java
@@ -23,13 +23,18 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
-public class InnerClassCheckTest extends BaseCheckTestSupport {
+public class InnerClassCheckTest extends AbstractModuleTestSupport {
private final String warningMessage = getCheckMessage(MSG_KEY);
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/design";
+ }
+
@Test
public void testMembersBeforeInner() throws Exception {
final DefaultConfiguration checkConfig =
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/NestedSwitchCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/NestedSwitchCheckTest.java
index 00aa04353d..4820a1cb06 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/NestedSwitchCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/NestedSwitchCheckTest.java
@@ -23,14 +23,19 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.utils.CommonUtils;
/**
* @author Damian Szczepanik (damianszczepanik@github)
*/
-public class NestedSwitchCheckTest extends BaseCheckTestSupport {
+public class NestedSwitchCheckTest extends AbstractModuleTestSupport {
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/design";
+ }
@Test
public void testSimple() throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/NoMainMethodInAbstractClassCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/NoMainMethodInAbstractClassCheckTest.java
index f24854341a..f5df777eca 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/NoMainMethodInAbstractClassCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/NoMainMethodInAbstractClassCheckTest.java
@@ -23,14 +23,14 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
/**
* Test class for NoMainMethodInAbstractClass check.
* @author Baratali Izmailov
*/
-public class NoMainMethodInAbstractClassCheckTest extends BaseCheckTestSupport {
+public class NoMainMethodInAbstractClassCheckTest extends AbstractModuleTestSupport {
/**
* Name of file with messages.
@@ -41,6 +41,11 @@ public class NoMainMethodInAbstractClassCheckTest extends BaseCheckTestSupport {
*/
private final String warningMessage = getCheckMessage(MSG_KEY);
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/design";
+ }
+
/**
* Main test.
* @throws Exception
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/PublicReferenceToPrivateTypeCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/PublicReferenceToPrivateTypeCheckTest.java
index 4d99cd944a..716afc8882 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/PublicReferenceToPrivateTypeCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/PublicReferenceToPrivateTypeCheckTest.java
@@ -25,7 +25,7 @@
import org.junit.Assert;
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
@@ -33,8 +33,12 @@
/**
* @author Aleksey Nesterenko
*/
-public class PublicReferenceToPrivateTypeCheckTest extends
- BaseCheckTestSupport {
+public class PublicReferenceToPrivateTypeCheckTest extends AbstractModuleTestSupport {
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/design";
+ }
/**
* Test file without method return instance of private class.
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/StaticMethodCandidateCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/StaticMethodCandidateCheckTest.java
index fbbec8da48..0a3041bbe0 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/StaticMethodCandidateCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/StaticMethodCandidateCheckTest.java
@@ -26,11 +26,16 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
-public class StaticMethodCandidateCheckTest extends BaseCheckTestSupport {
+public class StaticMethodCandidateCheckTest extends AbstractModuleTestSupport {
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/design";
+ }
@Test
public void testDefault() throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/EnumValueNameCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/EnumValueNameCheckTest.java
index b11ebd2643..aa374858ad 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/EnumValueNameCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/EnumValueNameCheckTest.java
@@ -24,10 +24,15 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
-public class EnumValueNameCheckTest extends BaseCheckTestSupport {
+public class EnumValueNameCheckTest extends AbstractModuleTestSupport {
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/naming";
+ }
@Test
public void testDefault()
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/InterfaceTypeParameterNameCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/InterfaceTypeParameterNameCheckTest.java
index 4c704a1c43..05e75f2c81 100755
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/InterfaceTypeParameterNameCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/InterfaceTypeParameterNameCheckTest.java
@@ -21,15 +21,19 @@
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
-public class InterfaceTypeParameterNameCheckTest
- extends BaseCheckTestSupport {
+public class InterfaceTypeParameterNameCheckTest extends AbstractModuleTestSupport {
/** Warning message key. */
private static final String MSG_KEY = "name.invalidPattern";
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/naming";
+ }
+
@Test
public void testInterfaceDefault()
throws Exception {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/UniformEnumConstantNameCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/UniformEnumConstantNameCheckTest.java
index c22111446e..8ea747729f 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/UniformEnumConstantNameCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/UniformEnumConstantNameCheckTest.java
@@ -26,7 +26,7 @@
import org.junit.Assert;
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.api.CheckstyleException;
@@ -35,12 +35,11 @@
*
* @author Pavel Baranchikov
*/
-public class UniformEnumConstantNameCheckTest extends BaseCheckTestSupport {
+public class UniformEnumConstantNameCheckTest extends AbstractModuleTestSupport {
- private final String inputFile;
-
- public UniformEnumConstantNameCheckTest() {
- inputFile = getPath("InputUniformEnumConstantNameCheck.java");
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/naming";
}
/**
@@ -62,7 +61,7 @@ public void testDefault()
buildMessage(90, 9, "WF_First",
UniformEnumConstantNameCheck.DEFAULT_PATTERN),
};
- verify(checkConfig, inputFile, expected);
+ verify(checkConfig, getPath("InputUniformEnumConstantNameCheck.java"), expected);
}
/**
@@ -88,7 +87,7 @@ public void testUpperCase()
buildMessage(90, 9, "WF_First",
"^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"),
};
- verify(checkConfig, inputFile, expected);
+ verify(checkConfig, getPath("InputUniformEnumConstantNameCheck.java"), expected);
}
/**
@@ -105,7 +104,7 @@ public void testAllAfterUpper()
checkConfig.addAttribute("formats",
"^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$" + ",.*");
final String[] expected = {};
- verify(checkConfig, inputFile, expected);
+ verify(checkConfig, getPath("InputUniformEnumConstantNameCheck.java"), expected);
}
/**
@@ -122,7 +121,7 @@ public void testInvalidFormat()
checkConfig.addAttribute("formats", "\\");
final String[] expected = {};
try {
- verify(checkConfig, inputFile, expected);
+ verify(checkConfig, getPath("InputUniformEnumConstantNameCheck.java"), expected);
fail();
}
catch (CheckstyleException ex) {
@@ -146,7 +145,7 @@ public void testWrongToken()
checkConfig.addAttribute("tokens", "INTERFACE_DEF");
final String[] expected = {};
try {
- verify(checkConfig, inputFile, expected);
+ verify(checkConfig, getPath("InputUniformEnumConstantNameCheck.java"), expected);
fail();
}
catch (CheckstyleException ex) {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/sizes/LineLengthExtendedCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/sizes/LineLengthExtendedCheckTest.java
index 4838a92a37..c032fa82b4 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/sizes/LineLengthExtendedCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/sizes/LineLengthExtendedCheckTest.java
@@ -25,11 +25,16 @@
import org.junit.Assert;
import org.junit.Test;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.api.CheckstyleException;
-public class LineLengthExtendedCheckTest extends BaseCheckTestSupport {
+public class LineLengthExtendedCheckTest extends AbstractModuleTestSupport {
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/sizes";
+ }
@Test
public void testSimple()
diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputAvoidModifiersForTypesCheck2.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputAvoidModifiersForTypesCheck2.java
index db00b756ed..e482020f02 100644
--- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputAvoidModifiersForTypesCheck2.java
+++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputAvoidModifiersForTypesCheck2.java
@@ -1,10 +1,8 @@
package com.github.sevntu.checkstyle.checks.coding;
-import com.github.sevntu.checkstyle.BaseCheckTestSupport;
-import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import org.junit.Test;
-public class InputAvoidModifiersForTypesCheck2 extends BaseCheckTestSupport
+public class InputAvoidModifiersForTypesCheck2 extends BaseClass
{
@Test
public void testSimple()
@@ -54,9 +52,24 @@ public void testSimpleIgnore()
//System.setProperty("testinputs.dir", "/home/romani/Practice/New_workspace/sevntu.checkstyle/src/testinputs/com/puppycrawl/tools/checkstyle/sizes");
verify(checkConfig, getPath("InputSomeFile.java"), expected);
}
-
+
class LineLengthCheck {
}
}
+class DefaultConfiguration {
+ public void addAttribute(String name, String value) {}
+}
+abstract class BaseClass {
+ protected String getPath(String fileName) {
+ return null;
+ }
+
+ protected DefaultConfiguration createModuleConfig(Class> clss) {
+ return new DefaultConfiguration();
+ }
+
+ protected void verify(DefaultConfiguration checkConfig, String path, String[] expected) {
+ }
+}
diff --git a/sevntu-checks/suppressions.xml b/sevntu-checks/suppressions.xml
index 374b28e399..cf329b31b1 100644
--- a/sevntu-checks/suppressions.xml
+++ b/sevntu-checks/suppressions.xml
@@ -16,7 +16,6 @@
-
From 95c708e587913bcf675561dcbf6313bce8bd7ecb Mon Sep 17 00:00:00 2001
From: rnveach
Date: Wed, 3 Jan 2018 14:06:59 -0500
Subject: [PATCH 148/208] Issue #630: use checkstyle's utils instead of copying
them
---
.../sevntu/checkstyle/internal/CheckUtil.java | 115 +++---------------
.../checkstyle/internal/ChecksTest.java | 13 +-
.../{XmlUtil.java => SevntuXmlUtil.java} | 47 +------
3 files changed, 23 insertions(+), 152 deletions(-)
rename sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/{XmlUtil.java => SevntuXmlUtil.java} (53%)
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckUtil.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckUtil.java
index 9c04044157..f60b3393b6 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckUtil.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckUtil.java
@@ -22,7 +22,6 @@
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
import java.text.MessageFormat;
import java.util.HashSet;
import java.util.Properties;
@@ -36,12 +35,8 @@
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.reflect.ClassPath;
-import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
-import com.puppycrawl.tools.checkstyle.api.AutomaticBean;
-import com.puppycrawl.tools.checkstyle.api.BeforeExecutionFileFilter;
-import com.puppycrawl.tools.checkstyle.api.Filter;
+import com.puppycrawl.tools.checkstyle.PackageNamesLoader;
+import com.puppycrawl.tools.checkstyle.utils.ModuleReflectionUtils;
public final class CheckUtil {
@@ -106,23 +101,19 @@ public static Set getCheckStyleChecksReferencedInConfig(String configFil
/**
* Gets the checkstyle's non abstract checks.
* @return the set of checkstyle's non abstract check classes.
- * @throws IOException if the attempt to read class path resources failed.
+ * @throws Exception if the attempt to read class path resources failed.
*/
- public static Set> getCheckstyleChecks() throws IOException {
+ public static Set> getCheckstyleChecks() throws Exception {
final Set> checkstyleChecks = new HashSet<>();
final ClassLoader loader = Thread.currentThread()
.getContextClassLoader();
- final ClassPath classpath = ClassPath.from(loader);
- final String packageName = "com.github.sevntu.checkstyle";
- final ImmutableSet checkstyleClasses = classpath
- .getTopLevelClassesRecursive(packageName);
-
- for (ClassPath.ClassInfo clazz : checkstyleClasses) {
- final String className = clazz.getSimpleName();
- final Class> loadedClass = clazz.load();
- if (isCheckstyleNonAbstractCheck(loadedClass, className)) {
- checkstyleChecks.add(loadedClass);
+ final Set> checkstyleModules = ModuleReflectionUtils.getCheckstyleModules(
+ PackageNamesLoader.getPackageNames(loader), loader);
+
+ for (Class> clazz : checkstyleModules) {
+ if (ModuleReflectionUtils.isCheckstyleCheck(clazz)) {
+ checkstyleChecks.add(clazz);
}
}
return checkstyleChecks;
@@ -158,24 +149,12 @@ public static Set> getModulesInPackage(Set> modules, String pa
* checkstyle's filters and SuppressWarningsHolder class.
*
* @return a set of checkstyle's modules names.
- * @throws IOException if the attempt to read class path resources failed.
+ * @throws Exception if the attempt to read class path resources failed.
*/
- public static Set> getCheckstyleModules() throws IOException {
- final Set> checkstyleModules = new HashSet<>();
-
+ public static Set> getCheckstyleModules() throws Exception {
final ClassLoader loader = Thread.currentThread().getContextClassLoader();
- final ClassPath classpath = ClassPath.from(loader);
- final String packageName = "com.github.sevntu.checkstyle.checks";
- final ImmutableSet checkstyleClasses = classpath
- .getTopLevelClassesRecursive(packageName);
-
- for (ClassPath.ClassInfo clazz : checkstyleClasses) {
- final Class> loadedClass = clazz.load();
- if (isCheckstyleModule(loadedClass)) {
- checkstyleModules.add(loadedClass);
- }
- }
- return checkstyleModules;
+ return ModuleReflectionUtils.getCheckstyleModules(
+ PackageNamesLoader.getPackageNames(loader), loader);
}
/**
@@ -206,72 +185,6 @@ public static Set getCheckMessages(Class> module) throws ClassNotFoundE
return checkstyleMessages;
}
- /**
- * Checks whether a class may be considered as the checkstyle module.
- * Checkstyle's modules are nonabstract classes which names end with
- * 'Check', do not contain the word 'Input' (are not input files for UTs),
- * checkstyle's filters, checkstyle's file filters and
- * SuppressWarningsHolder class.
- *
- * @param loadedClass class to check.
- * @return true if the class may be considered as the checkstyle module.
- */
- private static boolean isCheckstyleModule(Class> loadedClass) {
- final String className = loadedClass.getSimpleName();
- return isCheckstyleNonAbstractCheck(loadedClass, className)
- || isFilterModule(loadedClass, className)
- || isFileFilterModule(loadedClass, className)
- || "SuppressWarningsHolder".equals(className)
- || "FileContentsHolder".equals(className);
- }
-
- /**
- * Checks whether a class may be considered as the checkstyle check.
- * Checkstyle's checks are nonabstract classes which names end with 'Check',
- * do not contain the word 'Input' (are not input files for UTs), and extend
- * Check.
- *
- * @param loadedClass class to check.
- * @param className class name to check.
- * @return true if a class may be considered as the checkstyle check.
- */
- private static boolean isCheckstyleNonAbstractCheck(Class> loadedClass, String className) {
- return !Modifier.isAbstract(loadedClass.getModifiers()) && className.endsWith("Check")
- && !className.contains("Input")
- && AbstractCheck.class.isAssignableFrom(loadedClass);
- }
-
- /**
- * Checks whether a class may be considered as the checkstyle filter.
- * Checkstyle's filters are classes which are subclasses of AutomaticBean,
- * implement 'Filter' interface, and which names end with 'Filter'.
- *
- * @param loadedClass class to check.
- * @param className class name to check.
- * @return true if a class may be considered as the checkstyle filter.
- */
- private static boolean isFilterModule(Class> loadedClass, String className) {
- return Filter.class.isAssignableFrom(loadedClass)
- && AutomaticBean.class.isAssignableFrom(loadedClass)
- && className.endsWith("Filter");
- }
-
- /**
- * Checks whether a class may be considered as the checkstyle file filter.
- * Checkstyle's file filters are classes which are subclasses of
- * AutomaticBean, implement 'BeforeExecutionFileFilter' interface, and which
- * names end with 'FileFilter'.
- *
- * @param loadedClass class to check.
- * @param className class name to check.
- * @return true if a class may be considered as the checkstyle file filter.
- */
- private static boolean isFileFilterModule(Class> loadedClass, String className) {
- return BeforeExecutionFileFilter.class.isAssignableFrom(loadedClass)
- && AutomaticBean.class.isAssignableFrom(loadedClass)
- && className.endsWith("FileFilter");
- }
-
/**
* Gets the check message 'as is' from appropriate 'messages.properties'
* file.
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/ChecksTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/ChecksTest.java
index 69530047e3..22b83c47c2 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/ChecksTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/ChecksTest.java
@@ -44,6 +44,7 @@
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck;
import com.puppycrawl.tools.checkstyle.checks.javadoc.AbstractJavadocCheck;
+import com.puppycrawl.tools.checkstyle.internal.utils.XmlUtil;
public final class ChecksTest {
@@ -97,7 +98,7 @@ private static void validateSonarFile(Document document, Set> modules)
final Node rule = rules.item(position);
final Set children = XmlUtil.getChildrenElements(rule);
- final String key = XmlUtil.findElementByTag(children, "key").getTextContent();
+ final String key = SevntuXmlUtil.findElementByTag(children, "key").getTextContent();
final Class> module = findModule(modules, key);
modules.remove(module);
@@ -105,13 +106,13 @@ private static void validateSonarFile(Document document, Set> modules)
Assert.assertNotNull("Unknown class found in sonar: " + key, module);
final String moduleName = module.getName();
- final Node name = XmlUtil.findElementByTag(children, "name");
+ final Node name = SevntuXmlUtil.findElementByTag(children, "name");
Assert.assertNotNull(moduleName + " requires a name in sonar", name);
Assert.assertFalse(moduleName + " requires a name in sonar", name.getTextContent()
.isEmpty());
- final Node categoryNode = XmlUtil.findElementByTag(children, "category");
+ final Node categoryNode = SevntuXmlUtil.findElementByTag(children, "category");
String expectedCategory = module.getCanonicalName();
final int lastIndex = expectedCategory.lastIndexOf('.');
@@ -127,18 +128,18 @@ private static void validateSonarFile(Document document, Set> modules)
Assert.assertEquals(moduleName + " requires a valid category in sonar",
expectedCategory, categoryAttribute.getTextContent());
- final Node description = XmlUtil.findElementByTag(children, "description");
+ final Node description = SevntuXmlUtil.findElementByTag(children, "description");
Assert.assertNotNull(moduleName + " requires a description in sonar", description);
- final Node configKey = XmlUtil.findElementByTag(children, "configKey");
+ final Node configKey = SevntuXmlUtil.findElementByTag(children, "configKey");
final String expectedConfigKey = "Checker/TreeWalker/" + key;
Assert.assertNotNull(moduleName + " requires a configKey in sonar", configKey);
Assert.assertEquals(moduleName + " requires a valid configKey in sonar",
expectedConfigKey, configKey.getTextContent());
- validateSonarProperties(module, XmlUtil.findElementsByTag(children, "param"));
+ validateSonarProperties(module, SevntuXmlUtil.findElementsByTag(children, "param"));
}
for (Class> module : modules) {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/XmlUtil.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/SevntuXmlUtil.java
similarity index 53%
rename from sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/XmlUtil.java
rename to sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/SevntuXmlUtil.java
index 0b0fc08b7f..251dc9ca7e 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/XmlUtil.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/SevntuXmlUtil.java
@@ -19,57 +19,14 @@
package com.github.sevntu.checkstyle.internal;
-import java.io.IOException;
-import java.io.StringReader;
import java.util.HashSet;
-import java.util.LinkedHashSet;
import java.util.Set;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.junit.Assert;
-import org.w3c.dom.Document;
import org.w3c.dom.Node;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-public final class XmlUtil {
-
- private XmlUtil() {
- }
-
- public static Document getRawXml(String fileName, String code, String unserializedSource)
- throws ParserConfigurationException {
- Document rawXml = null;
- try {
- final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- factory.setValidating(false);
- factory.setNamespaceAware(true);
-
- final DocumentBuilder builder = factory.newDocumentBuilder();
-
- rawXml = builder.parse(new InputSource(new StringReader(code)));
- }
- catch (IOException | SAXException ex) {
- Assert.fail(fileName + " has invalid xml (" + ex.getMessage() + "): "
- + unserializedSource);
- }
-
- return rawXml;
- }
-
- public static Set getChildrenElements(Node node) {
- final Set result = new LinkedHashSet<>();
- for (Node child = node.getFirstChild(); child != null; child = child.getNextSibling()) {
- if (child.getNodeType() != Node.TEXT_NODE) {
- result.add(child);
- }
- }
+public final class SevntuXmlUtil {
- return result;
+ private SevntuXmlUtil() {
}
public static Node findElementByTag(Set nodes, String tag) {
From 46a01f64946089b51e698420f99e064722a9be72 Mon Sep 17 00:00:00 2001
From: Roman Ivanov
Date: Wed, 3 Jan 2018 17:58:17 -0800
Subject: [PATCH 149/208] config: move all travis commands to .ci folder to
ease execution on local
---
.ci/travis.sh | 83 +++++++++++++++++++++++++++++++++++++++
.ci/xtr_pr-description.sh | 29 ++++++++++++++
.travis.yml | 65 +++++-------------------------
3 files changed, 122 insertions(+), 55 deletions(-)
create mode 100755 .ci/travis.sh
create mode 100755 .ci/xtr_pr-description.sh
diff --git a/.ci/travis.sh b/.ci/travis.sh
new file mode 100755
index 0000000000..934a1b5df4
--- /dev/null
+++ b/.ci/travis.sh
@@ -0,0 +1,83 @@
+#!/bin/bash
+# Attention, there is no "-x" to avoid problems on Travis
+set -e
+
+case $1 in
+
+pr-description)
+ .ci/xtr_pr-description.sh
+ ;;
+
+eclipse-cs)
+ cd sevntu-checks
+ mvn -e clean install -Dmaven.test.skip=true -Dcheckstyle.skip=true -Dcobertura.skip=true
+ cd ..
+ git clone git://git.code.sf.net/p/eclipse-cs/git eclipse-cs-git
+ cd eclipse-cs-git/
+ git checkout 8.5.1
+ cd net.sf.eclipsecs.parent/
+ mvn -e install
+ cd ../../
+ cd eclipsecs-sevntu-plugin
+ mvn -e verify
+ mvn -e javadoc:javadoc
+ ;;
+
+maven-plugin)
+ cd sevntu-checks
+ mvn -e clean install -Dmaven.test.skip=true -Dcheckstyle.skip=true -Dcobertura.skip=true
+ cd ..
+ cd sevntu-checkstyle-maven-plugin
+ mvn -e verify
+ mvn -e javadoc:javadoc
+ ;;
+
+idea-extension)
+ cd sevntu-checks
+ mvn -e clean install -Dmaven.test.skip=true -Dcheckstyle.skip=true -Dcobertura.skip=true
+ cd ..
+ cd sevntu-checkstyle-idea-extension
+ mvn -e verify
+ mvn -e javadoc:javadoc
+ ;;
+
+sonar-plugin)
+ cd sevntu-checks
+ mvn -e clean install -Dmaven.test.skip=true -Dcheckstyle.skip=true -Dcobertura.skip=true
+ cd ..
+ cd sevntu-checkstyle-sonar-plugin
+ mvn -e verify
+ mvn -e javadoc:javadoc
+ ;;
+
+checks)
+ cd sevntu-checks
+ mvn -e install
+ mvn -e verify -Pselftesting
+ mvn -e javadoc:javadoc
+ mvn -e jacoco:report coveralls:jacoco
+ ;;
+
+checkstyle-regression)
+ git clone https://github.com/checkstyle/checkstyle
+ cd sevntu-checks
+ mvn -e install -DskipTests -Dcheckstyle.skip=true -Dcobertura.skip=true
+ mvn -e test -Dtest=CheckstyleRegressionTest#setupFiles -Dregression-path=../
+ cd ../
+ cd checkstyle
+ mvn -e clean verify -e -DskipTests -DskipITs -Dpmd.skip=true -Dfindbugs.skip=true -Dcobertura.skip=true
+ ;;
+
+eclipse-analysis)
+ cd sevntu-checks
+ mvn -e clean compile exec:exec -Peclipse-compiler
+ ;;
+
+
+*)
+ echo "Unexpected argument: $1"
+ sleep 5s
+ false
+ ;;
+
+esac
diff --git a/.ci/xtr_pr-description.sh b/.ci/xtr_pr-description.sh
new file mode 100755
index 0000000000..bfaebb6e11
--- /dev/null
+++ b/.ci/xtr_pr-description.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+# Attention, there is no "-x" to avoid problems on Travis
+set -e
+
+if [[ ! $TRAVIS_PULL_REQUEST =~ ^([0-9]*)$ ]]; then exit 0; fi
+LINK_COMMITS=https://api.github.com/repos/sevntu-checkstyle/sevntu.checkstyle/pulls/$TRAVIS_PULL_REQUEST/commits
+COMMITS=$(curl -s -H "Authorization: token $READ_ONLY_TOKEN" $LINK_COMMITS | jq '.[0] | .commit.message')
+echo 'Commit messages from github: '${COMMITS:0:60}...
+ISSUE_NUMBER=$(echo $COMMITS | sed -e 's/^.*Issue //' | sed -e 's/:.*//')
+echo 'Issue number: '$ISSUE_NUMBER && RESULT=0
+if [[ $ISSUE_NUMBER =~ ^#[0-9]+$ ]]; then
+ LINK_PR=https://api.github.com/repos/sevntu-checkstyle/sevntu.checkstyle/pulls/$TRAVIS_PULL_REQUEST
+ LINK_ISSUE=https://api.github.com/repos/sevntu-checkstyle/sevntu.checkstyle/issues/${ISSUE_NUMBER:1}
+ REGEXP=($ISSUE_NUMBER\|https://github.com/sevntu-checkstyle/sevntu.checkstyle/issues/${ISSUE_NUMBER:1})
+ PR_DESC=$(curl -s -H "Authorization: token $READ_ONLY_TOKEN" $LINK_PR | jq '.body' | grep -E $REGEXP | cat )
+ echo 'PR Description grepped:'${PR_DESC:0:80}
+ if [[ -z $PR_DESC ]]; then
+ echo 'Please put a reference to an Issue in the PR description, this will bind the Issue to your PR in Github' && RESULT=1;
+ fi
+ LABEL_APRV=$(curl -s -H "Authorization: token $READ_ONLY_TOKEN" $LINK_ISSUE | jq '.labels [] | .name' | grep approved | cat | wc -l )
+ if [[ $LABEL_APRV == 0 ]]; then
+ echo 'You are providing a PR for an Issue that is not approved yet, please ask admins to approve your Issue first' && RESULT=1;
+ fi
+ fi
+if [[ $RESULT == 0 ]]; then
+ echo 'PR validation succeeded.';
+else
+ echo 'PR validation failed.' && false;
+fi
diff --git a/.travis.yml b/.travis.yml
index b76a3d8382..6c0bb8e37a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -19,94 +19,49 @@ matrix:
- jdk: oraclejdk8
env:
- DESC="eclipse-cs"
- - CMD_="cd sevntu-checks && mvn -e clean install -Dmaven.test.skip=true -Dcheckstyle.skip=true -Dcobertura.skip=true && cd .. "
- - CMD0="git clone git://git.code.sf.net/p/eclipse-cs/git eclipse-cs-git"
- - CMD1="&& cd eclipse-cs-git/ && git checkout 8.5.1"
- - CMD2="&& cd net.sf.eclipsecs.parent/ && mvn -e install"
- - CMD3="&& cd ../../"
- - CMD4="&& cd eclipsecs-sevntu-plugin && mvn -e verify && mvn -e javadoc:javadoc"
- - CMD=$CMD_" && "$CMD0$CMD1$CMD2$CMD3$CMD4
- - PREINSTALL="true"
+ - CMD="./.ci/travis.sh eclipse-cs"
# maven-plugin
- jdk: oraclejdk8
env:
- DESC="maven-plugin"
- - CMD0="cd sevntu-checks && mvn -e clean install -Dmaven.test.skip=true -Dcheckstyle.skip=true -Dcobertura.skip=true && cd .. "
- - CMD=$CMD0" && ""cd sevntu-checkstyle-maven-plugin && mvn -e verify && mvn -e javadoc:javadoc"
+ - CMD="./.ci/travis.sh maven-plugin"
# idea-extension
- jdk: oraclejdk8
env:
- DESC="idea-extension"
- - CMD0="cd sevntu-checks && mvn -e clean install -Dmaven.test.skip=true -Dcheckstyle.skip=true -Dcobertura.skip=true && cd .. "
- - CMD=$CMD0" && ""cd sevntu-checkstyle-idea-extension && mvn -e verify && mvn -e javadoc:javadoc"
+ - CMD="./.ci/travis.sh idea-extension"
# sonar-plugin
- jdk: oraclejdk8
env:
- DESC="sonar-plugin"
- - CMD0="cd sevntu-checks && mvn -e clean install -Dmaven.test.skip=true -Dcheckstyle.skip=true -Dcobertura.skip=true && cd .. "
- - CMD=$CMD0" && ""cd sevntu-checkstyle-sonar-plugin && mvn -e verify && mvn -e javadoc:javadoc"
+ - CMD="./.ci/travis.sh sonar-plugin"
# checks
- jdk: oraclejdk8
env:
- DESC="checks"
- - CMD0="cd sevntu-checks && mvn -e install"
- - CMD1="&& mvn -e verify -Pselftesting"
- - CMD2="&& mvn -e javadoc:javadoc"
- - CMD3="&& mvn -e jacoco:report coveralls:jacoco"
- - CMD=$CMD0$CMD1$CMD2$CMD3
+ - CMD="./.ci/travis.sh checks"
# regression on checkstyle
# disabled until https://github.com/sevntu-checkstyle/sevntu.checkstyle/issues/629
#- jdk: oraclejdk8
# env:
- # - DESC="checkstyle regression"
- # - CMD0="git clone https://github.com/checkstyle/checkstyle "
- # - CMD1=" && cd sevntu-checks && mvn -e install -DskipTests -Dcheckstyle.skip=true -Dcobertura.skip=true"
- # - CMD2=" && mvn -e test -Dtest=CheckstyleRegressionTest#setupFiles -Dregression-path=../"
- # - CMD3=" && cd ../ && cd checkstyle && mvn -e clean verify -e -DskipTests -DskipITs -Dpmd.skip=true -Dfindbugs.skip=true -Dcobertura.skip=true"
- # - CMD=$CMD0$CMD1$CMD2$CMD3
+ # - DESC="checkstyle-regression"
+ # - CMD="./.ci/travis.sh checkstyle-regression"
# eclipse static analysis
- jdk: oraclejdk8
env:
- - DESC="eclipse static analysis
- - CMD="cd sevntu-checks && mvn -e clean compile exec:exec -Peclipse-compiler"
+ - DESC="eclipse-analysis"
+ - CMD="./.ci/travis.sh eclipse-analysis"
# testing of PR format
- env:
- DESC="test Issue ref in PR description"
- - CMD_="set -e"
- - CMD0=" && if [[ \$TRAVIS_PULL_REQUEST == 'false' ]]; then exit 0; fi "
- - CMD1=" && LINK_COMMITS=https://api.github.com/repos/sevntu-checkstyle/sevntu.checkstyle/pulls/$TRAVIS_PULL_REQUEST/commits "
- - CMD2=" && COMMITS=\$(curl -s -H 'Authorization: token $READ_ONLY_TOKEN' \$LINK_COMMITS | jq '.[0] | .commit.message') "
- - CMD3=" && echo 'Messages from github:'\${COMMITS:0:60}... "
- - CMD4=" && ISSUE_NUMBER=\$( echo \$COMMITS | sed -e 's/^.*Issue //' | sed -e 's/:.*//') "
- - CMD5=" && echo 'Issue number:'\$ISSUE_NUMBER && RESULT=0"
- - CMD6=" && if [[ \$ISSUE_NUMBER =~ ^#[0-9]+$ ]]; then "
- - CMD7=" LINK_PR=https://api.github.com/repos/sevntu-checkstyle/sevntu.checkstyle/pulls/$TRAVIS_PULL_REQUEST "
- - CMD8=" && LINK_ISSUE=https://api.github.com/repos/sevntu-checkstyle/sevntu.checkstyle/issues/\${ISSUE_NUMBER:1} "
- - CMD9=" && REGEXP=(\$ISSUE_NUMBER\|https://github.com/sevntu-checkstyle/sevntu.checkstyle/issues/\${ISSUE_NUMBER:1})"
- - CMD10=" && PR_DESC=\$(curl -s -H 'Authorization: token $READ_ONLY_TOKEN' \$LINK_PR | jq '.body' | grep -E \$REGEXP | cat ) "
- - CMD11=" && echo 'PR Description grepped:'\${PR_DESC:0:80} "
- - CMD12=" && if [[ -z \$PR_DESC ]]; then "
- - CMD13=" echo 'Please put a reference of Issue to PR description, this will bind Issue and PR in Github' && RESULT=1; "
- - CMD14=" fi "
- - CMD15=" && LABEL_APRV=\$(curl -s -H 'Authorization: token $READ_ONLY_TOKEN' \$LINK_ISSUE | jq '.labels [] | .name' | grep approved | cat | wc -l ) "
- - CMD16=" && if [[ \$LABEL_APRV == 0 ]]; then "
- - CMD17=" echo 'You provide PR to Issue that is not approved yes, please ask admins to approve your issue first' && RESULT=1; "
- - CMD18=" fi "
- - CMD19=" fi "
- - CMD20=" && if [[ \$RESULT == 0 ]]; then "
- - CMD21=" echo 'PR validation succeed.'; "
- - CMD22=" else "
- - CMD23=" echo 'PR validation failed.' && false; "
- - CMD24=" fi "
- - CMD=$CMD_$CMD0$CMD1$CMD2$CMD3$CMD4$CMD5$CMD6$CMD7$CMD8$CMD9$CMD10$CMD11$CMD12$CMD13$CMD14$CMD15
- - CMD=$CMD$CMD16$CMD17$CMD18$CMD19$CMD20$CMD21$CMD22$CMD23$CMD24
+ - CMD="./.ci/travis.sh pr-description"
script:
From 2b23c3b3b0360cc31ecc30921162a9373671ba9a Mon Sep 17 00:00:00 2001
From: Roman Ivanov
Date: Thu, 4 Jan 2018 08:15:13 -0800
Subject: [PATCH 150/208] minor: year bump in headers to 2018, to avoid
MCHECKSTYLE-344
---
.../sevntu/checkstyle/sonar/CheckstyleExtensionPlugin.java | 2 +-
.../sevntu/checkstyle/sonar/CheckstyleExtensionRepository.java | 2 +-
.../java/com/github/sevntu/checkstyle/sonar/package-info.java | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/sevntu-checkstyle-sonar-plugin/src/main/java/com/github/sevntu/checkstyle/sonar/CheckstyleExtensionPlugin.java b/sevntu-checkstyle-sonar-plugin/src/main/java/com/github/sevntu/checkstyle/sonar/CheckstyleExtensionPlugin.java
index 9965a53c1a..e960317040 100644
--- a/sevntu-checkstyle-sonar-plugin/src/main/java/com/github/sevntu/checkstyle/sonar/CheckstyleExtensionPlugin.java
+++ b/sevntu-checkstyle-sonar-plugin/src/main/java/com/github/sevntu/checkstyle/sonar/CheckstyleExtensionPlugin.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checkstyle-sonar-plugin/src/main/java/com/github/sevntu/checkstyle/sonar/CheckstyleExtensionRepository.java b/sevntu-checkstyle-sonar-plugin/src/main/java/com/github/sevntu/checkstyle/sonar/CheckstyleExtensionRepository.java
index 561d954c60..041f21b4f4 100644
--- a/sevntu-checkstyle-sonar-plugin/src/main/java/com/github/sevntu/checkstyle/sonar/CheckstyleExtensionRepository.java
+++ b/sevntu-checkstyle-sonar-plugin/src/main/java/com/github/sevntu/checkstyle/sonar/CheckstyleExtensionRepository.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
diff --git a/sevntu-checkstyle-sonar-plugin/src/main/java/com/github/sevntu/checkstyle/sonar/package-info.java b/sevntu-checkstyle-sonar-plugin/src/main/java/com/github/sevntu/checkstyle/sonar/package-info.java
index c46c0a3232..fa38ef0d7b 100644
--- a/sevntu-checkstyle-sonar-plugin/src/main/java/com/github/sevntu/checkstyle/sonar/package-info.java
+++ b/sevntu-checkstyle-sonar-plugin/src/main/java/com/github/sevntu/checkstyle/sonar/package-info.java
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
-// Copyright (C) 2001-2017 the original author or authors.
+// Copyright (C) 2001-2018 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
From 8e68c51ec11b66c7711ae11edfb65b3e0b59ada2 Mon Sep 17 00:00:00 2001
From: rnveach
Date: Sat, 13 Jan 2018 17:21:02 -0500
Subject: [PATCH 151/208] Issue #629: upgrade to eclipse-cs of 8.7.0
---
.ci/travis.sh | 11 +++++------
.travis.yml | 9 ++++-----
eclipsecs-sevntu-plugin/pom.xml | 2 +-
sevntu-checks/pom.xml | 2 +-
.../github/sevntu/checkstyle/internal/CheckUtil.java | 2 +-
.../checks/coding/InputForbidCertainImportsCheck.java | 6 +++++-
.../InputForbidCertainImportsCheckSinglePackage.java | 6 +++++-
sevntu-checkstyle-sonar-plugin/checkstyle.properties | 1 +
sevntu-checkstyle-sonar-plugin/pom.xml | 2 +-
9 files changed, 24 insertions(+), 17 deletions(-)
diff --git a/.ci/travis.sh b/.ci/travis.sh
index 934a1b5df4..ae4f908fec 100755
--- a/.ci/travis.sh
+++ b/.ci/travis.sh
@@ -12,12 +12,11 @@ eclipse-cs)
cd sevntu-checks
mvn -e clean install -Dmaven.test.skip=true -Dcheckstyle.skip=true -Dcobertura.skip=true
cd ..
- git clone git://git.code.sf.net/p/eclipse-cs/git eclipse-cs-git
- cd eclipse-cs-git/
- git checkout 8.5.1
- cd net.sf.eclipsecs.parent/
+ git clone https://github.com/checkstyle/eclipse-cs.git
+ cd eclipse-cs/
+ git checkout 8.7.0
mvn -e install
- cd ../../
+ cd ../
cd eclipsecs-sevntu-plugin
mvn -e verify
mvn -e javadoc:javadoc
@@ -65,7 +64,7 @@ checkstyle-regression)
mvn -e test -Dtest=CheckstyleRegressionTest#setupFiles -Dregression-path=../
cd ../
cd checkstyle
- mvn -e clean verify -e -DskipTests -DskipITs -Dpmd.skip=true -Dfindbugs.skip=true -Dcobertura.skip=true
+ mvn -e clean verify -e -DskipTests -DskipITs -Dpmd.skip=true -Dfindbugs.skip=true -Dcobertura.skip=true -Dmaven.sevntu-checkstyle-check.checkstyle.version=8.7
;;
eclipse-analysis)
diff --git a/.travis.yml b/.travis.yml
index 6c0bb8e37a..e88a6460a3 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -46,11 +46,10 @@ matrix:
- CMD="./.ci/travis.sh checks"
# regression on checkstyle
- # disabled until https://github.com/sevntu-checkstyle/sevntu.checkstyle/issues/629
- #- jdk: oraclejdk8
- # env:
- # - DESC="checkstyle-regression"
- # - CMD="./.ci/travis.sh checkstyle-regression"
+ - jdk: oraclejdk8
+ env:
+ - DESC="checkstyle-regression"
+ - CMD="./.ci/travis.sh checkstyle-regression"
# eclipse static analysis
- jdk: oraclejdk8
diff --git a/eclipsecs-sevntu-plugin/pom.xml b/eclipsecs-sevntu-plugin/pom.xml
index 1b1a226daa..1283274371 100644
--- a/eclipsecs-sevntu-plugin/pom.xml
+++ b/eclipsecs-sevntu-plugin/pom.xml
@@ -26,7 +26,7 @@
- 8.5.1-SNAPSHOT
+ 8.7.0-SNAPSHOT
diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml
index 559f7d51ee..6d6d8f680f 100644
--- a/sevntu-checks/pom.xml
+++ b/sevntu-checks/pom.xml
@@ -16,7 +16,7 @@
iso-8859-1
- 8.5
+ 8.7https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.eclipse-cs.version}/config/checkstyle_checks.xml2.17RELEASE
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckUtil.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckUtil.java
index f60b3393b6..61c578e489 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckUtil.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckUtil.java
@@ -112,7 +112,7 @@ public static Set> getCheckstyleChecks() throws Exception {
PackageNamesLoader.getPackageNames(loader), loader);
for (Class> clazz : checkstyleModules) {
- if (ModuleReflectionUtils.isCheckstyleCheck(clazz)) {
+ if (ModuleReflectionUtils.isCheckstyleTreeWalkerCheck(clazz)) {
checkstyleChecks.add(clazz);
}
}
diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputForbidCertainImportsCheck.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputForbidCertainImportsCheck.java
index 15473475a6..c595c0c907 100644
--- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputForbidCertainImportsCheck.java
+++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputForbidCertainImportsCheck.java
@@ -18,7 +18,11 @@ public class InputForbidCertainImportsCheck extends Check
public int a()
{
- AutomaticBean smth = new com.puppycrawl.tools.checkstyle.api.AutomaticBean(); // forbidden!
+ AutomaticBean smth = new com.puppycrawl.tools.checkstyle.api.AutomaticBean() { // forbidden!
+ @Override
+ protected void finishLocalSetup() {
+ }
+ };
Number test = new Integer(0);
return 5;
}
diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputForbidCertainImportsCheckSinglePackage.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputForbidCertainImportsCheckSinglePackage.java
index a64777a97c..caeb22e30c 100644
--- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputForbidCertainImportsCheckSinglePackage.java
+++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputForbidCertainImportsCheckSinglePackage.java
@@ -7,7 +7,11 @@ public class InputForbidCertainImportsCheckSinglePackage
public int a()
{
- AutomaticBean smth = new com.puppycrawl.tools.checkstyle.api.AutomaticBean(); // forbidden!
+ AutomaticBean smth = new com.puppycrawl.tools.checkstyle.api.AutomaticBean() { // forbidden!
+ @Override
+ protected void finishLocalSetup() {
+ }
+ };
return 5;
}
}
diff --git a/sevntu-checkstyle-sonar-plugin/checkstyle.properties b/sevntu-checkstyle-sonar-plugin/checkstyle.properties
index 53c8f47cd9..b33a3850a5 100644
--- a/sevntu-checkstyle-sonar-plugin/checkstyle.properties
+++ b/sevntu-checkstyle-sonar-plugin/checkstyle.properties
@@ -1,4 +1,5 @@
checkstyle.suppressions.file=suppressions.xml
+checkstyle.suppressions-xpath.file=suppressions.xml
checkstyle.header.file=https://raw.githubusercontent.com/checkstyle/checkstyle/master/config/java.header
checkstyle.regexp.header.file=https://raw.githubusercontent.com/checkstyle/checkstyle/master/config/java_regexp.header
checkstyle.importcontrol.file=import-control.xml
diff --git a/sevntu-checkstyle-sonar-plugin/pom.xml b/sevntu-checkstyle-sonar-plugin/pom.xml
index 57b763a2a7..082164f957 100644
--- a/sevntu-checkstyle-sonar-plugin/pom.xml
+++ b/sevntu-checkstyle-sonar-plugin/pom.xml
@@ -26,7 +26,7 @@
UTF-8
- 8.5
+ 8.72.17
From ef1797138d98e6d05c1df86be74f56703ec9284f Mon Sep 17 00:00:00 2001
From: rnveach
Date: Sun, 14 Jan 2018 09:16:13 -0500
Subject: [PATCH 152/208] version bump to 1.27.0
---
eclipse-pom.xml | 2 +-
eclipsecs-sevntu-plugin-feature/feature.xml | 4 ++--
eclipsecs-sevntu-plugin-feature/pom.xml | 2 +-
eclipsecs-sevntu-plugin/META-INF/MANIFEST.MF | 2 +-
eclipsecs-sevntu-plugin/pom.xml | 2 +-
sevntu-checks/pom.xml | 2 +-
sevntu-checkstyle-idea-extension/pom.xml | 2 +-
sevntu-checkstyle-maven-plugin/pom.xml | 4 ++--
sevntu-checkstyle-sonar-plugin/pom.xml | 2 +-
update-site/pom.xml | 2 +-
10 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/eclipse-pom.xml b/eclipse-pom.xml
index de06604337..3cfafc0d36 100644
--- a/eclipse-pom.xml
+++ b/eclipse-pom.xml
@@ -5,7 +5,7 @@
com.github.sevntu-checkstyleparent
- 1.26.0
+ 1.27.0pom
diff --git a/eclipsecs-sevntu-plugin-feature/feature.xml b/eclipsecs-sevntu-plugin-feature/feature.xml
index b0e518823b..5af827fd76 100644
--- a/eclipsecs-sevntu-plugin-feature/feature.xml
+++ b/eclipsecs-sevntu-plugin-feature/feature.xml
@@ -1,5 +1,5 @@
-
+
http://sevntu-checkstyle.github.io/sevntu.checkstyle/
@@ -20,6 +20,6 @@ Eclipse Public License - Version 1.0
-
+
diff --git a/eclipsecs-sevntu-plugin-feature/pom.xml b/eclipsecs-sevntu-plugin-feature/pom.xml
index 6f5897e584..be5d8c8e3c 100644
--- a/eclipsecs-sevntu-plugin-feature/pom.xml
+++ b/eclipsecs-sevntu-plugin-feature/pom.xml
@@ -7,7 +7,7 @@
../eclipse-pom.xmlcom.github.sevntu-checkstyleparent
- 1.26.0
+ 1.27.0com.github.sevntu-checkstyle
diff --git a/eclipsecs-sevntu-plugin/META-INF/MANIFEST.MF b/eclipsecs-sevntu-plugin/META-INF/MANIFEST.MF
index 071d93abcd..112dd4857c 100644
--- a/eclipsecs-sevntu-plugin/META-INF/MANIFEST.MF
+++ b/eclipsecs-sevntu-plugin/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Sevntu eclipse-cs Extension Plugin
Bundle-SymbolicName: eclipsecs-sevntu-plugin;singleton:=true
-Bundle-Version: 1.26.0
+Bundle-Version: 1.27.0
Require-Bundle: net.sf.eclipsecs.checkstyle,
net.sf.eclipsecs.core,
net.sf.eclipsecs.ui
diff --git a/eclipsecs-sevntu-plugin/pom.xml b/eclipsecs-sevntu-plugin/pom.xml
index 1283274371..77478d5642 100644
--- a/eclipsecs-sevntu-plugin/pom.xml
+++ b/eclipsecs-sevntu-plugin/pom.xml
@@ -9,7 +9,7 @@
../eclipse-pom.xmlcom.github.sevntu-checkstyleparent
- 1.26.0
+ 1.27.0com.github.sevntu-checkstyle
diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml
index 6d6d8f680f..1acd81d69a 100644
--- a/sevntu-checks/pom.xml
+++ b/sevntu-checks/pom.xml
@@ -11,7 +11,7 @@
com.github.sevntu-checkstylesevntu-checks
- 1.26.0
+ 1.27.0iso-8859-1
diff --git a/sevntu-checkstyle-idea-extension/pom.xml b/sevntu-checkstyle-idea-extension/pom.xml
index 47203f6a5a..f76c370a01 100644
--- a/sevntu-checkstyle-idea-extension/pom.xml
+++ b/sevntu-checkstyle-idea-extension/pom.xml
@@ -11,7 +11,7 @@
com.github.sevntu-checkstylesevntu-checkstyle-idea-extension
- 1.26.0
+ 1.27.0jarSevntu Checkstyle Idea extension
diff --git a/sevntu-checkstyle-maven-plugin/pom.xml b/sevntu-checkstyle-maven-plugin/pom.xml
index 20f2af394e..f683668844 100644
--- a/sevntu-checkstyle-maven-plugin/pom.xml
+++ b/sevntu-checkstyle-maven-plugin/pom.xml
@@ -12,7 +12,7 @@
com.github.sevntu-checkstylesevntu-checkstyle-maven-pluginSevntu Checkstyle Maven Plugin
- 1.26.0
+ 1.27.0
@@ -25,7 +25,7 @@
com.github.sevntu-checkstylesevntu-checks
- 1.26.0
+ 1.27.0org.apache.maven.plugins
diff --git a/sevntu-checkstyle-sonar-plugin/pom.xml b/sevntu-checkstyle-sonar-plugin/pom.xml
index 082164f957..0bf14dd970 100644
--- a/sevntu-checkstyle-sonar-plugin/pom.xml
+++ b/sevntu-checkstyle-sonar-plugin/pom.xml
@@ -11,7 +11,7 @@
com.github.sevntu-checkstylesevntu-checkstyle-sonar-plugin
- 1.26.0
+ 1.27.0sonar-pluginSevNTU Checkstyle Sonar Extension Plugin
diff --git a/update-site/pom.xml b/update-site/pom.xml
index 69da2f6d57..8516e769b8 100644
--- a/update-site/pom.xml
+++ b/update-site/pom.xml
@@ -7,7 +7,7 @@
../eclipse-pom.xmlcom.github.sevntu-checkstyleparent
- 1.26.0
+ 1.27.0com.github.sevntu.checkstyle.p2updatesite
From d024576c90a4e353c6e1c30882352b6ac2245dc2 Mon Sep 17 00:00:00 2001
From: Roman Ivanov
Date: Sun, 14 Jan 2018 06:49:50 -0800
Subject: [PATCH 153/208] minor: formatting
---
deploy.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/deploy.sh b/deploy.sh
index 0cd43da022..46543f51b0 100755
--- a/deploy.sh
+++ b/deploy.sh
@@ -58,9 +58,9 @@ deployIdea()
deployEclipse()
{
cd $REPO_HOME_DIR
- #echo -n "Enter version number: "
- #read version
- #mvn org.eclipse.tycho:tycho-versions-plugin:set-version -DnewVersion=$version -f eclipse-pom.xml
+ #echo -n "Enter version number: "
+ #read version
+ #mvn org.eclipse.tycho:tycho-versions-plugin:set-version -DnewVersion=$version -f eclipse-pom.xml
mvn clean install -f eclipse-pom.xml -Plocal-deploy
if [ "$?" != "0" ]
then
From 09367f08cea4615a2f0ea3ed4125c79244c2e481 Mon Sep 17 00:00:00 2001
From: Roman Ivanov
Date: Thu, 18 Jan 2018 13:28:46 -0800
Subject: [PATCH 154/208] Issue #639: change dtd links of eclipse-cs from
sourceforce to github
---
.../sevntu/checkstyle/checks/annotation/checkstyle-metadata.xml | 2 +-
.../sevntu/checkstyle/checks/coding/checkstyle-metadata.xml | 2 +-
.../sevntu/checkstyle/checks/design/checkstyle-metadata.xml | 2 +-
.../sevntu/checkstyle/checks/naming/checkstyle-metadata.xml | 2 +-
.../sevntu/checkstyle/checks/sizes/checkstyle-metadata.xml | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/annotation/checkstyle-metadata.xml b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/annotation/checkstyle-metadata.xml
index 035b57660a..50ed8cd8b3 100755
--- a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/annotation/checkstyle-metadata.xml
+++ b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/annotation/checkstyle-metadata.xml
@@ -1,7 +1,7 @@
+"https://checkstyle.github.io/eclipse-cs/dtds/checkstyle-metadata_1_1.dtd">
diff --git a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/coding/checkstyle-metadata.xml b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/coding/checkstyle-metadata.xml
index 4d10db211f..efc11eaa84 100644
--- a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/coding/checkstyle-metadata.xml
+++ b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/coding/checkstyle-metadata.xml
@@ -1,7 +1,7 @@
+"https://checkstyle.github.io/eclipse-cs/dtds/checkstyle-metadata_1_1.dtd">
diff --git a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/design/checkstyle-metadata.xml b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/design/checkstyle-metadata.xml
index f31f099f3e..cf21b616f1 100644
--- a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/design/checkstyle-metadata.xml
+++ b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/design/checkstyle-metadata.xml
@@ -1,7 +1,7 @@
+"https://checkstyle.github.io/eclipse-cs/dtds/checkstyle-metadata_1_1.dtd">
diff --git a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/naming/checkstyle-metadata.xml b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/naming/checkstyle-metadata.xml
index acb07027ae..f80955d403 100644
--- a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/naming/checkstyle-metadata.xml
+++ b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/naming/checkstyle-metadata.xml
@@ -1,7 +1,7 @@
+"https://checkstyle.github.io/eclipse-cs/dtds/checkstyle-metadata_1_1.dtd">
diff --git a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/sizes/checkstyle-metadata.xml b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/sizes/checkstyle-metadata.xml
index ae410ca4fd..91460a2b85 100755
--- a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/sizes/checkstyle-metadata.xml
+++ b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/sizes/checkstyle-metadata.xml
@@ -1,7 +1,7 @@
+"https://checkstyle.github.io/eclipse-cs/dtds/checkstyle-metadata_1_1.dtd">
From 72daa3ed2dd121fcbd38bc23a2cdb4dd2582b9ed Mon Sep 17 00:00:00 2001
From: Roman Ivanov
Date: Fri, 19 Jan 2018 13:50:13 -0800
Subject: [PATCH 155/208] Issue #640: define full name of plugin use proper
goal
---
.ci/travis.sh | 10 ++++++----
.travis.yml | 2 +-
sevntu-checks/pom.xml | 26 ++++++--------------------
3 files changed, 13 insertions(+), 25 deletions(-)
diff --git a/.ci/travis.sh b/.ci/travis.sh
index ae4f908fec..3e4e6d4ce0 100755
--- a/.ci/travis.sh
+++ b/.ci/travis.sh
@@ -49,12 +49,14 @@ sonar-plugin)
mvn -e javadoc:javadoc
;;
-checks)
+sevntu-checks)
cd sevntu-checks
- mvn -e install
- mvn -e verify -Pselftesting
+ mvn -e -Pcoverall install
+ mvn -e verify -Pno-validations,selftesting
mvn -e javadoc:javadoc
- mvn -e jacoco:report coveralls:jacoco
+ if [[ $TRAVIS == 'true' ]]; then
+ mvn -e -Pcoverall jacoco:report coveralls:report
+ fi
;;
checkstyle-regression)
diff --git a/.travis.yml b/.travis.yml
index e88a6460a3..791905f2fd 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -43,7 +43,7 @@ matrix:
- jdk: oraclejdk8
env:
- DESC="checks"
- - CMD="./.ci/travis.sh checks"
+ - CMD="./.ci/travis.sh sevntu-checks"
# regression on checkstyle
- jdk: oraclejdk8
diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml
index 1acd81d69a..f3f6759319 100644
--- a/sevntu-checks/pom.xml
+++ b/sevntu-checks/pom.xml
@@ -231,13 +231,7 @@
- travis
-
-
- env.TRAVIS
- true
-
-
+ coverall
@@ -246,24 +240,24 @@
0.7.1.201405082137
- prepare-agent
+ pre-unit-testprepare-agent
- report
+ post-unit-testreport
- prepare-package
+ testorg.eluder.coverallscoveralls-maven-plugin
- 2.2.0
+ 4.3.0
@@ -313,15 +307,7 @@
selftesting
- true
- true
- true
- true
- true
- true
- true
- true
- true
+ false
From c04c52fa743985344bd552a3c98babe93e6cf114 Mon Sep 17 00:00:00 2001
From: Roman Ivanov
Date: Fri, 26 Jan 2018 16:35:25 -0800
Subject: [PATCH 156/208] doc: extending documentation for
ForbidWildcardAsReturnType to mention cases for suppress
---
.../ForbidWildcardAsReturnTypeCheck.java | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ForbidWildcardAsReturnTypeCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ForbidWildcardAsReturnTypeCheck.java
index cd882f3361..d8abaaeea2 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ForbidWildcardAsReturnTypeCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ForbidWildcardAsReturnTypeCheck.java
@@ -44,6 +44,25 @@
* to accept the parameters they should accept and reject those they should
* reject. If the user of a class has to think about wildcard types, there is
* probably something wrong with the class’s API."
+ * Attention: some JDK classes have public methods with "?"(wildcard) in return type
+ * so it might not always possible to avoid wildcards in retun type, as they do not demand user
+ * to bother about it (invisible for user or method). So suppressions should be used.
+ *
+ *
+ * Examples:
+ *
+ * JDK Collectors, so usage
+ * of methods that retun wilcard could force user customizations over Collectors use wilcard in
+ * public methods
+ *
+ *
{@code
+ * // custom util method, wilcard come from Collectors.toList()
+ * public Collector singleResult(Function super Iterable, T> collector) {
+ * return Collectors.collectingAndThen(Collectors.toList(), collected -> collected.get(0));
+ * }
+ * }
+ *
If suppressions become too wide spread and annoying it might be reasonable to update Check
+ * with option to ignore wildcard if used with another type (not alone).
*
* @author Baratali Izmailov
*/
From e30f1569730cac9ac1710014f66b585489bf4275 Mon Sep 17 00:00:00 2001
From: Roman Ivanov
Date: Sun, 28 Jan 2018 05:50:23 -0800
Subject: [PATCH 157/208] config: bump checkstyle version
---
sevntu-checks/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml
index f3f6759319..28c7118f9c 100644
--- a/sevntu-checks/pom.xml
+++ b/sevntu-checks/pom.xml
@@ -16,7 +16,7 @@
iso-8859-1
- 8.7
+ 8.8https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.eclipse-cs.version}/config/checkstyle_checks.xml2.17RELEASE
From 6687a2f9f831e3ce9bbe594e501a44b063afd220 Mon Sep 17 00:00:00 2001
From: Raghav Kumar Gautam
Date: Wed, 31 Jan 2018 16:51:38 -0800
Subject: [PATCH 158/208] Issue #604: Adding missing messages to assertions
---
...NumericLiteralNeedsUnderscoreCheckTest.java | 12 ++++++++----
.../TernaryPerExpressionCountCheckTest.java | 10 +++++-----
.../UniformEnumConstantNameCheckTest.java | 18 +++++++++++-------
.../sizes/LineLengthExtendedCheckTest.java | 8 +++++---
4 files changed, 29 insertions(+), 19 deletions(-)
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NumericLiteralNeedsUnderscoreCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NumericLiteralNeedsUnderscoreCheckTest.java
index d41c4de07a..1d9353dcff 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NumericLiteralNeedsUnderscoreCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/NumericLiteralNeedsUnderscoreCheckTest.java
@@ -194,7 +194,8 @@ public void testMinSymbolsBeforeCheckingSwitchReflection() throws Exception {
fail();
}
catch (IllegalStateException ex) {
- Assert.assertTrue(ex.getMessage().startsWith(EXCEPTION_MESSAGE));
+ Assert.assertTrue("Exception's message does not start with: " + EXCEPTION_MESSAGE,
+ ex.getMessage().startsWith(EXCEPTION_MESSAGE));
}
}
@@ -208,7 +209,8 @@ public void testMaxSymbolsUntilUnderscoreSwitchReflection() throws Exception {
fail();
}
catch (IllegalStateException ex) {
- Assert.assertTrue(ex.getMessage().startsWith(EXCEPTION_MESSAGE));
+ Assert.assertTrue("Exception's message does not start with: " + EXCEPTION_MESSAGE,
+ ex.getMessage().startsWith(EXCEPTION_MESSAGE));
}
}
@@ -222,7 +224,8 @@ public void testGetNumericSegmentsSwitchReflection() throws Exception {
fail();
}
catch (IllegalStateException ex) {
- Assert.assertTrue(ex.getMessage().startsWith(EXCEPTION_MESSAGE));
+ Assert.assertTrue("Exception's message does not start with: " + EXCEPTION_MESSAGE,
+ ex.getMessage().startsWith(EXCEPTION_MESSAGE));
}
}
@@ -236,7 +239,8 @@ public void testRemovePrePostfixByTypeSwitchReflection() throws Exception {
fail();
}
catch (IllegalStateException ex) {
- Assert.assertTrue(ex.getMessage().startsWith(EXCEPTION_MESSAGE));
+ Assert.assertTrue("Exception's message does not start with: " + EXCEPTION_MESSAGE,
+ ex.getMessage().startsWith(EXCEPTION_MESSAGE));
}
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/TernaryPerExpressionCountCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/TernaryPerExpressionCountCheckTest.java
index 616fabbe56..725190021c 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/TernaryPerExpressionCountCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/TernaryPerExpressionCountCheckTest.java
@@ -84,11 +84,11 @@ public void testWithNegativeTernaryPerExpressionCountValue()
}
catch (CheckstyleException ex) {
final String errorMsg = ex.getMessage();
- Assert.assertTrue(errorMsg
- .contains("Cannot set property 'maxTernaryPerExpressionCount' "
- + "to '-1' in module "
- + "com.github.sevntu.checkstyle.checks.coding."
- + "TernaryPerExpressionCountCheck"));
+ final String expectedMessage = "Cannot set property 'maxTernaryPerExpressionCount' "
+ + "to '-1' in module com.github.sevntu.checkstyle.checks.coding."
+ + "TernaryPerExpressionCountCheck";
+ Assert.assertTrue("Expected error message is missing: " + expectedMessage,
+ errorMsg.contains(expectedMessage));
}
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/UniformEnumConstantNameCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/UniformEnumConstantNameCheckTest.java
index 8ea747729f..ab56dad649 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/UniformEnumConstantNameCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/naming/UniformEnumConstantNameCheckTest.java
@@ -125,9 +125,11 @@ public void testInvalidFormat()
fail();
}
catch (CheckstyleException ex) {
- Assert.assertTrue(ex.getMessage().startsWith("cannot initialize module "
- + "com.puppycrawl.tools.checkstyle.TreeWalker - "
- + "Cannot set property 'formats' to '\\' in module "));
+ final String messagePrefix = "cannot initialize module "
+ + "com.puppycrawl.tools.checkstyle.TreeWalker - "
+ + "Cannot set property 'formats' to '\\' in module ";
+ Assert.assertTrue("Exception's message does not start with: " + messagePrefix,
+ ex.getMessage().startsWith(messagePrefix));
}
}
@@ -149,10 +151,12 @@ public void testWrongToken()
fail();
}
catch (CheckstyleException ex) {
- Assert.assertTrue(ex.getMessage().startsWith("cannot initialize module "
- + "com.puppycrawl.tools.checkstyle.TreeWalker - "
- + "Token \"INTERFACE_DEF\" was not found in "
- + "Acceptable tokens list in check "));
+ final String messagePrefix = "cannot initialize module "
+ + "com.puppycrawl.tools.checkstyle.TreeWalker - "
+ + "Token \"INTERFACE_DEF\" was not found in "
+ + "Acceptable tokens list in check ";
+ Assert.assertTrue("Exception's message does not start with: " + messagePrefix,
+ ex.getMessage().startsWith(messagePrefix));
}
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/sizes/LineLengthExtendedCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/sizes/LineLengthExtendedCheckTest.java
index c032fa82b4..f771cce1ef 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/sizes/LineLengthExtendedCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/sizes/LineLengthExtendedCheckTest.java
@@ -96,9 +96,11 @@ public void testProperty() throws Exception {
fail();
}
catch (CheckstyleException ex) {
- Assert.assertTrue(ex.getMessage().startsWith("cannot initialize module "
- + "com.puppycrawl.tools.checkstyle.TreeWalker - "
- + "Cannot set property 'ignorePattern' to '[' in module "));
+ final String messagePrefix = "cannot initialize module "
+ + "com.puppycrawl.tools.checkstyle.TreeWalker - "
+ + "Cannot set property 'ignorePattern' to '[' in module ";
+ Assert.assertTrue("Exception's message does not start with: " + messagePrefix,
+ ex.getMessage().startsWith(messagePrefix));
}
}
From b2a82311dac666f52b7ffb18a1abe55525e59936 Mon Sep 17 00:00:00 2001
From: Raghav Kumar Gautam
Date: Tue, 12 Sep 2017 15:34:08 -0700
Subject: [PATCH 159/208] Issue #604: Add a check to ban use of specified
method
---
.../coding/checkstyle-metadata.properties | 5 +
.../checks/coding/checkstyle-metadata.xml | 13 +
sevntu-checks/sevntu-checks.xml | 4 +
.../coding/ForbidCertainMethodCheck.java | 277 ++++++++++++++
.../checks/coding/messages.properties | 1 +
.../coding/ForbidCertainMethodCheckTest.java | 352 ++++++++++++++++++
.../coding/InputForbidCertainMethodCheck.java | 57 +++
.../sonar/checkstyle-extensions.xml | 16 +
8 files changed, 725 insertions(+)
create mode 100644 sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidCertainMethodCheck.java
create mode 100644 sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidCertainMethodCheckTest.java
create mode 100644 sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputForbidCertainMethodCheck.java
diff --git a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/coding/checkstyle-metadata.properties b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/coding/checkstyle-metadata.properties
index 990e5d59b1..ab56154aa9 100755
--- a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/coding/checkstyle-metadata.properties
+++ b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/coding/checkstyle-metadata.properties
@@ -52,6 +52,11 @@ ForbidCertainImportsCheck.packageNameRegexp = Package name regexp.
ForbidCertainImportsCheck.forbiddenImportsRegexp = Regexp for matching forbidden imports
ForbidCertainImportsCheck.forbiddenImportsExcludesRegexp = Regexp for excluding imports from checking
+ForbidCertainMethodCheck.name = Forbid Certain Method
+ForbidCertainMethodCheck.desc = Forbids certain method usage.
You can configure this check using following parameters:
Method name regexp;
Argument count range;
This check reads method & constructor names without class/object name, so, please, do NOT include class/variable name in your regular expressions when configuring.
Real-life example of usage: forbid to use all "exit" method, forbid use of assertTrue/assertFalse with 1 parameter. For doing that, you should use the following check parameters:
Method name regexp = "assert(True|False)"
Argument count range = "1"
. Argument count can be bounded range(e.g.: 2-4) or unbounded range(e.g.: -5, 6-). Unbounded range can be unbounded only on one side. Multiple ranges must be comma separated. Author: Raghav Kumar Gautam
+ForbidCertainMethodCheck.methodName = Regex to match name of the forbidden method. When blank or unspecified, all the methods will be allowed.
+ForbidCertainMethodCheck.argumentCount = Number or range to match number of arguments the forbidden method takes. Multiple ranges are separated by comma. When unspecified, only method name will be used for check.
+
ForbidInstantiationCheck.name = Forbid Instantiation
ForbidInstantiationCheck.desc = Forbids instantiation of certain object types by their full classname.
For example: "java.lang.NullPointerException" will forbid the NPE instantiation.
Note: className should to be full: use "java.lang.NullPointerException" instead of "NullpointerException".
ForbidInstantiationCheck.forbiddenClasses = ClassNames for objects that are forbidden to instantiate.
diff --git a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/coding/checkstyle-metadata.xml b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/coding/checkstyle-metadata.xml
index efc11eaa84..5821d48c1b 100644
--- a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/coding/checkstyle-metadata.xml
+++ b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/coding/checkstyle-metadata.xml
@@ -179,6 +179,19 @@
+
+
+ %ForbidCertainMethodCheck.desc
+
+ %ForbidCertainMethodCheck.methodName
+
+
+ %ForbidCertainMethodCheck.argumentCount
+
+
+
+
+
%ForbidInstantiationCheck.desc
diff --git a/sevntu-checks/sevntu-checks.xml b/sevntu-checks/sevntu-checks.xml
index 7e624eca0a..82feb5fee2 100644
--- a/sevntu-checks/sevntu-checks.xml
+++ b/sevntu-checks/sevntu-checks.xml
@@ -80,6 +80,10 @@
+
+
+
+
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidCertainMethodCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidCertainMethodCheck.java
new file mode 100644
index 0000000000..d9c65264ac
--- /dev/null
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidCertainMethodCheck.java
@@ -0,0 +1,277 @@
+////////////////////////////////////////////////////////////////////////////////
+// checkstyle: Checks Java source code for adherence to a set of rules.
+// Copyright (C) 2001-2018 the original author or authors.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+////////////////////////////////////////////////////////////////////////////////
+
+package com.github.sevntu.checkstyle.checks.coding;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import com.github.sevntu.checkstyle.Utils;
+import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
+import com.puppycrawl.tools.checkstyle.api.CheckstyleException;
+import com.puppycrawl.tools.checkstyle.api.DetailAST;
+import com.puppycrawl.tools.checkstyle.api.TokenTypes;
+import com.puppycrawl.tools.checkstyle.utils.CommonUtils;
+
+/**
+ * Check that forbidden method is not used. We can forbid a method by method name and number of
+ * arguments.
+ * This can be used to enforce things like:
+ *
+ *
exit() method of System class should not be called.
+ *
assertTrue() and assertFalse() methods of Assert class have a 1 arg variant that does not
+ * provide a helpful message on failure. These methods should not be used.
+ *
+ * Parameters are:
+ *
+ *
methodName - Regex to match name of the method to be forbidden.
+ * When blank or unspecified, all the methods are allowed.
+ *
argumentCount - Number or range to match number of arguments the method takes.
+ * Multiple numbers/ranges must be comma separated. When unspecified, defaults to "0-".
+ *
+ * Argument count can be bounded range (e.g.: {@code 2-4}) or unbounded range
+ * (e.g.: {@code -5, 6-}). Unbounded range can be unbounded only on one side.
+ * Multiple ranges must be comma separated.
+ * For example, the following will allow only 4 and 8 arguments.
+ *
+ *
+ * Note: The check only matches method name. Matching on class/object of the
+ * method is not done. For e.g. there is no way to forbid only "System.exit()". You can match
+ * by methodName="exit", but beware that it will violate "System.exit()" and "MySystem.exit()",
+ * so use it with caution.
+ *
+ *
+ * @author Raghav Kumar Gautam
+ */
+public class ForbidCertainMethodCheck extends AbstractCheck {
+
+ /** Key is pointing to the warning message text in "messages.properties" file. */
+ public static final String MSG_KEY = "forbid.certain.method";
+ /** Regex for splitting string on comma. */
+ private static final Pattern COMMA_REGEX = Pattern.compile(",");
+
+ /** Name of the method. */
+ private Pattern methodName = CommonUtils.createPattern("^$");
+
+ /** Range for number of arguments. */
+ private String argumentCount = "0-";
+ /** Range objects for matching number of arguments. */
+ private final List argumentCountRanges = new ArrayList<>(
+ Collections.singletonList(new IntRange(0, Integer.MAX_VALUE)));
+
+ /**
+ * Set method name regex for the forbidden method.
+ * @param methodName regex for the method name
+ */
+ public void setMethodName(String methodName) {
+ this.methodName = CommonUtils.createPattern(methodName);
+ }
+
+ /**
+ * Set number or range to match number of arguments of the forbidden method.
+ * Multiple values must be comma separated.
+ * @param argumentCount range for matching number of arguments
+ * @throws CheckstyleException when argumentCount is not a valid range
+ */
+ public void setArgumentCount(String argumentCount) throws CheckstyleException {
+ this.argumentCount = argumentCount;
+ if (argumentCount.trim().length() > 0) {
+ final String[] rangeTokens = COMMA_REGEX.split(argumentCount);
+ argumentCountRanges.clear();
+ for (String oneToken : rangeTokens) {
+ argumentCountRanges.add(IntRange.from(oneToken));
+ }
+ }
+ else {
+ throw new CheckstyleException(
+ "argumentCount must be non-empty, found: " + argumentCount);
+ }
+ }
+
+ @Override
+ public int[] getDefaultTokens() {
+ return getRequiredTokens();
+ }
+
+ @Override
+ public int[] getAcceptableTokens() {
+ return getRequiredTokens();
+ }
+
+ @Override
+ public int[] getRequiredTokens() {
+ return new int[] {
+ TokenTypes.METHOD_CALL,
+ };
+ }
+
+ @Override
+ public void visitToken(DetailAST ast) {
+ switch (ast.getType()) {
+ case TokenTypes.METHOD_CALL:
+ final DetailAST dot = ast.getFirstChild();
+ // method that looks like: method()
+ final String methodNameInCode;
+ if (dot.getType() == TokenTypes.IDENT) {
+ methodNameInCode = dot.getText();
+ }
+ // method that looks like: obj.method()
+ else {
+ methodNameInCode = dot.getLastChild().getText();
+ }
+ final int numArgsInCode = dot.getNextSibling().getChildCount(TokenTypes.EXPR);
+ if (isForbiddenMethod(ast, methodNameInCode, numArgsInCode)) {
+ log(ast.getLineNo(), ast.getColumnNo(), MSG_KEY, methodNameInCode, methodName,
+ numArgsInCode, argumentCount);
+ }
+ break;
+ default:
+ Utils.reportInvalidToken(ast.getType());
+ break;
+ }
+ }
+
+ /**
+ * Check if the method/constructor call against defined rules.
+ * @param ast ast for the call
+ * @param name ruleName of the the method
+ * @param argCount number of arguments of the method
+ * @return true if method name and argument matches, false otherwise.
+ */
+ private boolean isForbiddenMethod(DetailAST ast, String name, int argCount) {
+ boolean matched = false;
+ if (methodName.matcher(name).matches()) {
+ for (IntRange intRange : argumentCountRanges) {
+ if (intRange.contains(argCount)) {
+ matched = true;
+ break;
+ }
+ }
+ }
+ return matched;
+ }
+
+ /**
+ * Represents a range of non-negative integers.
+ * Range must be bounded on one side or both sides.
+ * It can't be unbounded on both side.
+ *
+ * Some examples of vaild ranges:
+ *
+ *
1-10: 1 and 10 and all numbers between 1 and 10
+ *
-10: same as 0-10
+ *
5-: same as 5-infinity
+ *
1: same as 1-1
+ *
+ */
+ static class IntRange {
+ /** Regex for matching range. */
+ private static final Pattern RANGE_PATTERN =
+ Pattern.compile("^\\s*+(\\d*+)\\s*+-\\s*+(\\d*+)\\s*+$");
+ /** Lower limit of the range. No lower limit when null. */
+ private final int lowerLimit;
+ /** Upper limit of the range. No upper limit when null. */
+ private final int upperLimit;
+
+ /**
+ * Initialize IntRange object with a lower limit and an upper limit.
+ * @param lowerLimit lower limit of the range, must be >= 0, null is equivalent to 0
+ * @param upperLimit upper limit of the range, null is equivalent to infinity
+ */
+ IntRange(int lowerLimit, int upperLimit) {
+ this.lowerLimit = lowerLimit;
+ this.upperLimit = upperLimit;
+ }
+
+ /**
+ * Create a range object corresponding to it string representation.
+ * @param range string representation of the range
+ * @return IntRange object for the string
+ *
+ * @throws CheckstyleException if the specified range is not valid
+ */
+ static IntRange from(String range) throws CheckstyleException {
+ int lowerLimit = 0;
+ int upperLimit = Integer.MAX_VALUE;
+ if (!range.contains("-")) {
+ lowerLimit = Integer.parseInt(range.trim());
+ upperLimit = lowerLimit;
+ }
+ else {
+ final Matcher matcher = RANGE_PATTERN.matcher(range);
+ if (!matcher.find()) {
+ throw new CheckstyleException("Specified range is not valid: " + range);
+ }
+ final String lowerLimitString = matcher.group(1);
+ final String upperLimitString = matcher.group(2);
+ if (lowerLimitString.length() == 0 && upperLimitString.length() == 0) {
+ throw new CheckstyleException("Specified range is unbounded on both side: "
+ + range);
+ }
+ if (lowerLimitString.length() > 0) {
+ lowerLimit = Integer.parseInt(lowerLimitString);
+ }
+ if (upperLimitString.length() > 0) {
+ upperLimit = Integer.parseInt(upperLimitString);
+ }
+ if (lowerLimit > upperLimit) {
+ throw new CheckstyleException(
+ "Lower limit of the range is larger than the upper limit: " + range);
+ }
+ }
+ return new IntRange(lowerLimit, upperLimit);
+ }
+
+ /**
+ * Check if range contain given number. Range is closed.
+ * If lower/upper bound is absent, it is considered unbounded on lower/upper side.
+ * @param num the number to be checked
+ * @return true if number is contained in the range, false otherwise
+ */
+ public boolean contains(int num) {
+ return num >= lowerLimit && num <= upperLimit;
+ }
+ }
+
+}
diff --git a/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/coding/messages.properties b/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/coding/messages.properties
index 216612d9ff..04ee0a0026 100644
--- a/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/coding/messages.properties
+++ b/sevntu-checks/src/main/resources/com/github/sevntu/checkstyle/checks/coding/messages.properties
@@ -19,6 +19,7 @@ finalize.implementation.public = finalize() method should have a "protected" vis
finalize.implementation.useless = finalize() method is useless: it does nothing except for calling super.finalize().
finalize.implementation.missed.super.finalize = You have to call super.finalize() right after finally opening brace.
forbid.certain.imports=Import ''{1}'' should not match ''{0}'' pattern, it is forbidden.
+forbid.certain.method=Call to ''{0}'' method (matches pattern ''{1}'') with ''{2}'' arguments (matches pattern ''{3}'') is forbidden.
forbid.c.comments.in.the.method.body=C-style comments (/*...*/) inside method body are not allowed.
forbid.return.in.finally.block=Finally block should not contain return statements.
forbid.throw.anonymous.exception=Avoid throwing anonymous exception.
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidCertainMethodCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidCertainMethodCheckTest.java
new file mode 100644
index 0000000000..bc63bda6e9
--- /dev/null
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ForbidCertainMethodCheckTest.java
@@ -0,0 +1,352 @@
+////////////////////////////////////////////////////////////////////////////////
+// checkstyle: Checks Java source code for adherence to a set of rules.
+// Copyright (C) 2001-2018 the original author or authors.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+////////////////////////////////////////////////////////////////////////////////
+
+package com.github.sevntu.checkstyle.checks.coding;
+
+import static com.github.sevntu.checkstyle.checks.coding.ForbidCertainMethodCheck.MSG_KEY;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
+import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
+import com.puppycrawl.tools.checkstyle.api.CheckstyleException;
+import com.puppycrawl.tools.checkstyle.api.DetailAST;
+import com.puppycrawl.tools.checkstyle.api.TokenTypes;
+
+public class ForbidCertainMethodCheckTest extends AbstractModuleTestSupport {
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/github/sevntu/checkstyle/checks/coding";
+ }
+
+ @Test
+ public void testEmptyRules() throws Exception {
+ final DefaultConfiguration checkConfig =
+ createModuleConfig(ForbidCertainMethodCheck.class);
+ verify(checkConfig, getPath("InputForbidCertainMethodCheck.java"));
+ }
+
+ @Test
+ public void testNoArgumentCount() throws Exception {
+ final DefaultConfiguration checkConfig =
+ createModuleConfig(ForbidCertainMethodCheck.class);
+ checkConfig.addAttribute("methodName", "exit");
+ final String[] expected = {
+ "22:20: " + getCheckMessage(MSG_KEY, "exit", "exit", "1", "0-"),
+ };
+ verify(checkConfig, getPath("InputForbidCertainMethodCheck.java"), expected);
+ }
+
+ @Test
+ public void testWithEmptyArgumentCount() throws Exception {
+ final DefaultConfiguration checkConfig =
+ createModuleConfig(ForbidCertainMethodCheck.class);
+ checkConfig.addAttribute("methodName", "exit2");
+ checkConfig.addAttribute("argumentCount", "");
+ try {
+ verify(checkConfig, getPath("InputForbidCertainMethodCheck.java"));
+ Assert.fail("Expecting CheckstyleException");
+ }
+ catch (CheckstyleException ex) {
+ checkExceptionMessage(ex,
+ "cannot initialize module com.puppycrawl.tools.checkstyle.TreeWalker - "
+ + "Cannot set property 'argumentCount' to '' in module "
+ + "com.github.sevntu.checkstyle.checks.coding.ForbidCertainMethodCheck");
+ }
+ }
+
+ @Test
+ public void testWithSpacesForArgumentCount() throws Exception {
+ final DefaultConfiguration checkConfig =
+ createModuleConfig(ForbidCertainMethodCheck.class);
+ checkConfig.addAttribute("methodName", "exit2");
+ checkConfig.addAttribute("argumentCount", " ");
+ try {
+ verify(checkConfig, getPath("InputForbidCertainMethodCheck.java"));
+ Assert.fail("Expecting CheckstyleException");
+ }
+ catch (CheckstyleException ex) {
+ checkExceptionMessage(ex,
+ "cannot initialize module com.puppycrawl.tools.checkstyle.TreeWalker - "
+ + "Cannot set property 'argumentCount' to ' ' in module "
+ + "com.github.sevntu.checkstyle.checks.coding.ForbidCertainMethodCheck");
+ }
+ }
+
+ @Test
+ public void testWithSpacesAndCommaForArgumentCount() throws Exception {
+ final DefaultConfiguration checkConfig =
+ createModuleConfig(ForbidCertainMethodCheck.class);
+ checkConfig.addAttribute("methodName", "exit2");
+ checkConfig.addAttribute("argumentCount", " , ");
+ try {
+ verify(checkConfig, getPath("InputForbidCertainMethodCheck.java"));
+ Assert.fail("Expecting CheckstyleException");
+ }
+ catch (CheckstyleException ex) {
+ checkExceptionMessage(ex,
+ "cannot initialize module com.puppycrawl.tools.checkstyle.TreeWalker - "
+ + "Cannot set property 'argumentCount' to ' , ' in module "
+ + "com.github.sevntu.checkstyle.checks.coding.ForbidCertainMethodCheck");
+ }
+ }
+
+ @Test
+ public void testWithNullArgumentCount() throws Exception {
+ final DefaultConfiguration checkConfig =
+ createModuleConfig(ForbidCertainMethodCheck.class);
+ checkConfig.addAttribute("methodName", "exit2");
+ checkConfig.addAttribute("argumentCount", null);
+ try {
+ verify(checkConfig, getPath("InputForbidCertainMethodCheck.java"));
+ Assert.fail("Expecting CheckstyleException");
+ }
+ catch (CheckstyleException ex) {
+ checkExceptionMessage(ex,
+ "cannot initialize module com.puppycrawl.tools.checkstyle.TreeWalker - "
+ + "Cannot set property 'argumentCount' to 'null' in module "
+ + "com.github.sevntu.checkstyle.checks.coding.ForbidCertainMethodCheck");
+ }
+ }
+
+ @Test
+ public void testWithRegexForMethodName() throws Exception {
+ final DefaultConfiguration checkConfig =
+ createModuleConfig(ForbidCertainMethodCheck.class);
+ checkConfig.addAttribute("methodName", "assert(True|False)");
+ checkConfig.addAttribute("argumentCount", "1");
+
+ final String[] expected = {
+ "29:26: " + getCheckMessage(MSG_KEY, "assertTrue", "assert(True|False)", 1,
+ "1"),
+ };
+ verify(checkConfig, getPath("InputForbidCertainMethodCheck.java"), expected);
+ }
+
+ @Test
+ public void testUnsupportedToken() {
+ final DetailAST sync = new DetailAST();
+ sync.setType(TokenTypes.LITERAL_SYNCHRONIZED);
+ try {
+ final ForbidCertainMethodCheck check = new ForbidCertainMethodCheck();
+ check.visitToken(sync);
+ Assert.fail("Expecting IllegalArgumentException");
+ }
+ catch (IllegalArgumentException ex) {
+ Assert.assertEquals("Found unsupported token: LITERAL_SYNCHRONIZED", ex.getMessage());
+ }
+ }
+
+ @Test
+ public void testNullMethodNameRegex() throws Exception {
+ final DefaultConfiguration checkConfig =
+ createModuleConfig(ForbidCertainMethodCheck.class);
+ checkConfig.addAttribute("methodName", null);
+ try {
+ verify(checkConfig, getPath("InputForbidCertainMethodCheck.java"));
+ Assert.fail("Expecting CheckstyleException");
+ }
+ catch (CheckstyleException ex) {
+ checkExceptionMessage(ex,
+ "cannot initialize module com.puppycrawl.tools.checkstyle.TreeWalker - "
+ + "Cannot set property 'methodName' to 'null' in module "
+ + "com.github.sevntu.checkstyle.checks.coding.ForbidCertainMethodCheck");
+ }
+ }
+
+ @Test
+ public void testEmptyMethodNameRegex() throws Exception {
+ final DefaultConfiguration checkConfig =
+ createModuleConfig(ForbidCertainMethodCheck.class);
+ checkConfig.addAttribute("methodName", "");
+ verify(checkConfig, getPath("InputForbidCertainMethodCheck.java"));
+ }
+
+ @Test
+ public void testBadMethodNameRegex() throws Exception {
+ final DefaultConfiguration checkConfig =
+ createModuleConfig(ForbidCertainMethodCheck.class);
+ checkConfig.addAttribute("methodName", "[exit");
+ try {
+ verify(checkConfig, getPath("InputForbidCertainMethodCheck.java"));
+ Assert.fail("Expecting CheckstyleException");
+ }
+ catch (CheckstyleException ex) {
+ checkExceptionMessage(ex,
+ "cannot initialize module com.puppycrawl.tools.checkstyle.TreeWalker - "
+ + "Cannot set property 'methodName' to '[exit' in module "
+ + "com.github.sevntu.checkstyle.checks.coding.ForbidCertainMethodCheck");
+ }
+ }
+
+ @Test
+ public void testBadRangeForArgumentCount() throws Exception {
+ testBadRangeInner("badArgCount",
+ "cannot initialize module com.puppycrawl.tools.checkstyle.TreeWalker - "
+ + "Cannot set property 'argumentCount' to 'badArgCount' in module "
+ + "com.github.sevntu.checkstyle.checks.coding.ForbidCertainMethodCheck");
+ }
+
+ @Test
+ public void testBadRange2ForArgumentCount() throws Exception {
+ testBadRangeInner("badStart-badEnd",
+ "cannot initialize module com.puppycrawl.tools.checkstyle.TreeWalker - "
+ + "Cannot set property 'argumentCount' to 'badStart-badEnd' in module "
+ + "com.github.sevntu.checkstyle.checks.coding.ForbidCertainMethodCheck");
+ }
+
+ @Test
+ public void testBadRange3ForArgumentCount() throws Exception {
+ testBadRangeInner("2, badStart-badEnd",
+ "cannot initialize module com.puppycrawl.tools.checkstyle.TreeWalker - "
+ + "Cannot set property 'argumentCount' to '2, badStart-badEnd' in module "
+ + "com.github.sevntu.checkstyle.checks.coding.ForbidCertainMethodCheck");
+ }
+
+ @Test
+ public void testBadRange4ForArgumentCount() throws Exception {
+ testBadRangeInner(" , 1-4 ",
+ "cannot initialize module com.puppycrawl.tools.checkstyle.TreeWalker - "
+ + "Cannot set property 'argumentCount' to ' , 1-4 ' in module "
+ + "com.github.sevntu.checkstyle.checks.coding.ForbidCertainMethodCheck");
+ }
+
+ @Test
+ public void testUnboundedRangeForArgumentCount() throws Exception {
+ testBadRangeInner(" - ",
+ "cannot initialize module com.puppycrawl.tools.checkstyle.TreeWalker - "
+ + "Cannot set property 'argumentCount' to ' - ' in module "
+ + "com.github.sevntu.checkstyle.checks.coding.ForbidCertainMethodCheck");
+ }
+
+ @Test
+ public void testRangeWithBadBoundsForArgumentCount() throws Exception {
+ testBadRangeInner("10-1",
+ "cannot initialize module com.puppycrawl.tools.checkstyle.TreeWalker - "
+ + "Cannot set property 'argumentCount' to '10-1' in module "
+ + "com.github.sevntu.checkstyle.checks.coding.ForbidCertainMethodCheck");
+ }
+
+ private void testBadRangeInner(String value, String expectedMessage) throws Exception {
+ final DefaultConfiguration checkConfig =
+ createModuleConfig(ForbidCertainMethodCheck.class);
+ checkConfig.addAttribute("methodName", "exit");
+ checkConfig.addAttribute("argumentCount", value);
+ final String[] expected = {
+ };
+ try {
+ verify(checkConfig, getPath("InputForbidCertainMethodCheck.java"), expected);
+ Assert.fail("Expecting CheckstyleException");
+ }
+ catch (CheckstyleException ex) {
+ checkExceptionMessage(ex,
+ expectedMessage);
+ }
+ }
+
+ @Test
+ public void testRangeForArgumentCount() throws Exception {
+ final DefaultConfiguration checkConfig =
+ createModuleConfig(ForbidCertainMethodCheck.class);
+ checkConfig.addAttribute("methodName", "assert(True|False)");
+ checkConfig.addAttribute("argumentCount", "0-1");
+
+ final String[] expected = {
+ "29:26: " + getCheckMessage(MSG_KEY, "assertTrue", "assert(True|False)", 1,
+ "0-1"),
+ };
+ verify(checkConfig, getPath("InputForbidCertainMethodCheck.java"), expected);
+ }
+
+ @Test
+ public void testRangeWithSpaceForArgumentCount() throws Exception {
+ final DefaultConfiguration checkConfig =
+ createModuleConfig(ForbidCertainMethodCheck.class);
+ checkConfig.addAttribute("methodName", "assert(True|False)");
+ checkConfig.addAttribute("argumentCount", " 0 - 1 ");
+
+ final String[] expected = {
+ "29:26: " + getCheckMessage(MSG_KEY, "assertTrue", "assert(True|False)", 1,
+ " 0 - 1 "),
+ };
+ verify(checkConfig, getPath("InputForbidCertainMethodCheck.java"), expected);
+ }
+
+ @Test
+ public void testLeftOpenRangeForArgumentCount() throws Exception {
+ final DefaultConfiguration checkConfig =
+ createModuleConfig(ForbidCertainMethodCheck.class);
+ checkConfig.addAttribute("methodName", "assert(True|False)");
+ checkConfig.addAttribute("argumentCount", "-1");
+
+ final String[] expected = {
+ "29:26: " + getCheckMessage(MSG_KEY, "assertTrue", "assert(True|False)", 1,
+ "-1"),
+ };
+ verify(checkConfig, getPath("InputForbidCertainMethodCheck.java"), expected);
+ }
+
+ @Test
+ public void testRightOpenRangeForArgumentCount() throws Exception {
+ final DefaultConfiguration checkConfig =
+ createModuleConfig(ForbidCertainMethodCheck.class);
+ checkConfig.addAttribute("methodName", "assert(True|False)");
+ checkConfig.addAttribute("argumentCount", "0-");
+
+ final String[] expected = {
+ "29:26: " + getCheckMessage(MSG_KEY,
+ "assertTrue", "assert(True|False)", 1, "0-"),
+ "30:26: " + getCheckMessage(MSG_KEY,
+ "assertTrue", "assert(True|False)", 2, "0-"),
+ };
+ verify(checkConfig, getPath("InputForbidCertainMethodCheck.java"), expected);
+ }
+
+ @Test
+ public void testMultipleRangesForArgumentCount() throws Exception {
+ final DefaultConfiguration checkConfig =
+ createModuleConfig(ForbidCertainMethodCheck.class);
+ checkConfig.addAttribute("methodName", "asList");
+ // allow arg count 4, 8
+ checkConfig.addAttribute("argumentCount", "-3, 5-7, 9-");
+
+ final String[] expected = {
+ "43:26: " + getCheckMessage(MSG_KEY, "asList", "asList", 1, "-3, 5-7, 9-"),
+ "44:26: " + getCheckMessage(MSG_KEY, "asList", "asList", 2, "-3, 5-7, 9-"),
+ "45:26: " + getCheckMessage(MSG_KEY, "asList", "asList", 3, "-3, 5-7, 9-"),
+ "47:26: " + getCheckMessage(MSG_KEY, "asList", "asList", 5, "-3, 5-7, 9-"),
+ "48:26: " + getCheckMessage(MSG_KEY, "asList", "asList", 6, "-3, 5-7, 9-"),
+ "49:26: " + getCheckMessage(MSG_KEY, "asList", "asList", 7, "-3, 5-7, 9-"),
+ "51:26: " + getCheckMessage(MSG_KEY, "asList", "asList", 9, "-3, 5-7, 9-"),
+ "52:26: " + getCheckMessage(MSG_KEY, "asList", "asList", 10, "-3, 5-7, 9-"),
+ "53:26: " + getCheckMessage(MSG_KEY, "asList", "asList", 11, "-3, 5-7, 9-"),
+ "54:26: " + getCheckMessage(MSG_KEY, "asList", "asList", 12, "-3, 5-7, 9-"),
+ };
+ verify(checkConfig, getPath("InputForbidCertainMethodCheck.java"), expected);
+ }
+
+ private static void checkExceptionMessage(Exception exception, String expectedMessage) {
+ Assert.assertEquals("Exception did not have correct error message.",
+ expectedMessage,
+ exception.getMessage());
+ }
+
+}
diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputForbidCertainMethodCheck.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputForbidCertainMethodCheck.java
new file mode 100644
index 0000000000..cc5c8809f4
--- /dev/null
+++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputForbidCertainMethodCheck.java
@@ -0,0 +1,57 @@
+////////////////////////////////////////////////////////////////////////////////
+// Test case file for checkstyle.
+// Created: 2017
+////////////////////////////////////////////////////////////////////////////////
+package com.github.sevntu.checkstyle.checks.coding;
+
+import org.junit.Assert;
+
+import java.io.File;
+import java.util.Arrays;
+
+/**
+ * Test case for detecting usage of forbidden method.
+ * @author Raghav Kumar Gautam
+ **/
+class InputForbidCertainMethodCheck
+{
+ /**
+ * no param constructor
+ */
+ InputForbidCertainMethodCheck() {
+ System.exit(1);
+ }
+
+ /**
+ * non final param method
+ */
+ void method(String s) {
+ Assert.assertTrue(1 != 2);
+ Assert.assertTrue("Good assert with some reason.", true);
+ ForbiddenMethod.exit2();
+ ForbiddenMethod.INSTANCE.exit2();
+ //method call that does not need "." in it
+ method("");
+ // new usage that does not invoke constructor
+ String[] strs = new String[4];
+ Arrays.stream(strs).map(File::new).count();
+ }
+
+ private static class ForbiddenMethod {
+ static final ForbiddenMethod INSTANCE = new ForbiddenMethod();
+ static void exit2() {
+ Arrays.asList(1);
+ Arrays.asList(1, 2);
+ Arrays.asList(1, 2, 3);
+ Arrays.asList(1, 2, 3, 4);
+ Arrays.asList(1, 2, 3, 4, 5);
+ Arrays.asList(1, 2, 3, 4, 5, 6);
+ Arrays.asList(1, 2, 3, 4, 5, 6, 7);
+ Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8);
+ Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9);
+ Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
+ Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
+ Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
+ }
+ }
+}
diff --git a/sevntu-checkstyle-sonar-plugin/src/main/resources/com/github/sevntu/checkstyle/sonar/checkstyle-extensions.xml b/sevntu-checkstyle-sonar-plugin/src/main/resources/com/github/sevntu/checkstyle/sonar/checkstyle-extensions.xml
index 978f232515..9693a62b4e 100644
--- a/sevntu-checkstyle-sonar-plugin/src/main/resources/com/github/sevntu/checkstyle/sonar/checkstyle-extensions.xml
+++ b/sevntu-checkstyle-sonar-plugin/src/main/resources/com/github/sevntu/checkstyle/sonar/checkstyle-extensions.xml
@@ -377,6 +377,22 @@
+
+ com.github.sevntu.checkstyle.checks.coding.ForbidCertainMethodCheck
+ Forbid Certain Method
+
+ Forbids certain method in class.
+ Checker/TreeWalker/com.github.sevntu.checkstyle.checks.coding.ForbidCertainMethodCheck
+
+ ^$
+ Regex to match method name.
+
+
+ 0-
+ Number or range to match number of arguments. Multiple numbers/ranges must be comma separated.
+
+
+
com.github.sevntu.checkstyle.checks.coding.ForbidInstantiationCheckForbid Instantiation
From d87fa0f8736095f4889c537b3898b2cb8f9eddbe Mon Sep 17 00:00:00 2001
From: rnveach
Date: Mon, 26 Feb 2018 22:01:09 -0500
Subject: [PATCH 160/208] config: version bump to 1.28.0
---
eclipse-pom.xml | 2 +-
eclipsecs-sevntu-plugin-feature/feature.xml | 4 ++--
eclipsecs-sevntu-plugin-feature/pom.xml | 2 +-
eclipsecs-sevntu-plugin/META-INF/MANIFEST.MF | 2 +-
eclipsecs-sevntu-plugin/pom.xml | 2 +-
sevntu-checks/pom.xml | 2 +-
sevntu-checkstyle-idea-extension/pom.xml | 2 +-
sevntu-checkstyle-maven-plugin/pom.xml | 4 ++--
sevntu-checkstyle-sonar-plugin/pom.xml | 2 +-
update-site/pom.xml | 2 +-
10 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/eclipse-pom.xml b/eclipse-pom.xml
index 3cfafc0d36..9420f5510b 100644
--- a/eclipse-pom.xml
+++ b/eclipse-pom.xml
@@ -5,7 +5,7 @@
com.github.sevntu-checkstyleparent
- 1.27.0
+ 1.28.0pom
diff --git a/eclipsecs-sevntu-plugin-feature/feature.xml b/eclipsecs-sevntu-plugin-feature/feature.xml
index 5af827fd76..229abef370 100644
--- a/eclipsecs-sevntu-plugin-feature/feature.xml
+++ b/eclipsecs-sevntu-plugin-feature/feature.xml
@@ -1,5 +1,5 @@
-
+
http://sevntu-checkstyle.github.io/sevntu.checkstyle/
@@ -20,6 +20,6 @@ Eclipse Public License - Version 1.0
-
+
diff --git a/eclipsecs-sevntu-plugin-feature/pom.xml b/eclipsecs-sevntu-plugin-feature/pom.xml
index be5d8c8e3c..a433339008 100644
--- a/eclipsecs-sevntu-plugin-feature/pom.xml
+++ b/eclipsecs-sevntu-plugin-feature/pom.xml
@@ -7,7 +7,7 @@
../eclipse-pom.xmlcom.github.sevntu-checkstyleparent
- 1.27.0
+ 1.28.0com.github.sevntu-checkstyle
diff --git a/eclipsecs-sevntu-plugin/META-INF/MANIFEST.MF b/eclipsecs-sevntu-plugin/META-INF/MANIFEST.MF
index 112dd4857c..a28b2ff93d 100644
--- a/eclipsecs-sevntu-plugin/META-INF/MANIFEST.MF
+++ b/eclipsecs-sevntu-plugin/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Sevntu eclipse-cs Extension Plugin
Bundle-SymbolicName: eclipsecs-sevntu-plugin;singleton:=true
-Bundle-Version: 1.27.0
+Bundle-Version: 1.28.0
Require-Bundle: net.sf.eclipsecs.checkstyle,
net.sf.eclipsecs.core,
net.sf.eclipsecs.ui
diff --git a/eclipsecs-sevntu-plugin/pom.xml b/eclipsecs-sevntu-plugin/pom.xml
index 77478d5642..ab763f9b27 100644
--- a/eclipsecs-sevntu-plugin/pom.xml
+++ b/eclipsecs-sevntu-plugin/pom.xml
@@ -9,7 +9,7 @@
../eclipse-pom.xmlcom.github.sevntu-checkstyleparent
- 1.27.0
+ 1.28.0com.github.sevntu-checkstyle
diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml
index 28c7118f9c..8651c32587 100644
--- a/sevntu-checks/pom.xml
+++ b/sevntu-checks/pom.xml
@@ -11,7 +11,7 @@
com.github.sevntu-checkstylesevntu-checks
- 1.27.0
+ 1.28.0iso-8859-1
diff --git a/sevntu-checkstyle-idea-extension/pom.xml b/sevntu-checkstyle-idea-extension/pom.xml
index f76c370a01..bc69779c3e 100644
--- a/sevntu-checkstyle-idea-extension/pom.xml
+++ b/sevntu-checkstyle-idea-extension/pom.xml
@@ -11,7 +11,7 @@
com.github.sevntu-checkstylesevntu-checkstyle-idea-extension
- 1.27.0
+ 1.28.0jarSevntu Checkstyle Idea extension
diff --git a/sevntu-checkstyle-maven-plugin/pom.xml b/sevntu-checkstyle-maven-plugin/pom.xml
index f683668844..5b4bb09255 100644
--- a/sevntu-checkstyle-maven-plugin/pom.xml
+++ b/sevntu-checkstyle-maven-plugin/pom.xml
@@ -12,7 +12,7 @@
com.github.sevntu-checkstylesevntu-checkstyle-maven-pluginSevntu Checkstyle Maven Plugin
- 1.27.0
+ 1.28.0
@@ -25,7 +25,7 @@
com.github.sevntu-checkstylesevntu-checks
- 1.27.0
+ 1.28.0org.apache.maven.plugins
diff --git a/sevntu-checkstyle-sonar-plugin/pom.xml b/sevntu-checkstyle-sonar-plugin/pom.xml
index 0bf14dd970..e46eb6403d 100644
--- a/sevntu-checkstyle-sonar-plugin/pom.xml
+++ b/sevntu-checkstyle-sonar-plugin/pom.xml
@@ -11,7 +11,7 @@
com.github.sevntu-checkstylesevntu-checkstyle-sonar-plugin
- 1.27.0
+ 1.28.0sonar-pluginSevNTU Checkstyle Sonar Extension Plugin
diff --git a/update-site/pom.xml b/update-site/pom.xml
index 8516e769b8..ff74847374 100644
--- a/update-site/pom.xml
+++ b/update-site/pom.xml
@@ -7,7 +7,7 @@
../eclipse-pom.xmlcom.github.sevntu-checkstyleparent
- 1.27.0
+ 1.28.0com.github.sevntu.checkstyle.p2updatesite
From 3c62c33e0e0b7aaad8cbfad32507e86dbc816815 Mon Sep 17 00:00:00 2001
From: Raghav Kumar Gautam
Date: Wed, 28 Feb 2018 11:06:02 -0800
Subject: [PATCH 161/208] Issue #648: Updating sevntu-checks.xml to refer to
new dtd
---
sevntu-checks/sevntu-checks.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sevntu-checks/sevntu-checks.xml b/sevntu-checks/sevntu-checks.xml
index 82feb5fee2..d4c7612e18 100644
--- a/sevntu-checks/sevntu-checks.xml
+++ b/sevntu-checks/sevntu-checks.xml
@@ -1,5 +1,5 @@

-
+
From 109869fec19187ac1b71b44788bf9b1563bfc464 Mon Sep 17 00:00:00 2001
From: Roman Ivanov
Date: Sun, 11 Mar 2018 11:44:16 -0700
Subject: [PATCH 162/208] minor: spaces removal from README
---
README.textile | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/README.textile b/README.textile
index b089b0cdb4..bda6f44f54 100644
--- a/README.textile
+++ b/README.textile
@@ -1,4 +1,4 @@
-h3. Information "!https://secure.travis-ci.org/sevntu-checkstyle/sevntu.checkstyle.png!":http://travis-ci.org/sevntu-checkstyle/sevntu.checkstyle/builds !https://coveralls.io/repos/sevntu-checkstyle/sevntu.checkstyle/badge.svg?branch=master&service=github(Coverage Status)!:https://coveralls.io/github/sevntu-checkstyle/sevntu.checkstyle?branch=master !https://sonarqube.com/api/badges/measure?key=com.github.sevntu.checkstyle:sevntu-checks&metric=sqale_debt_ratio!:https://sonarqube.com/dashboard?id=com.github.sevntu.checkstyle%3Asevntu-checks
+h3. Information "!https://secure.travis-ci.org/sevntu-checkstyle/sevntu.checkstyle.png!":http://travis-ci.org/sevntu-checkstyle/sevntu.checkstyle/builds !https://coveralls.io/repos/sevntu-checkstyle/sevntu.checkstyle/badge.svg?branch=master&service=github(Coverage Status)!:https://coveralls.io/github/sevntu-checkstyle/sevntu.checkstyle?branch=master !https://sonarqube.com/api/badges/measure?key=com.github.sevntu.checkstyle:sevntu-checks&metric=sqale_debt_ratio!:https://sonarqube.com/dashboard?id=com.github.sevntu.checkstyle%3Asevntu-checks
sevntu-checks: !https://maven-badges.herokuapp.com/maven-central/com.github.sevntu-checkstyle/sevntu-checks/badge.svg!:https://search.maven.org/#search|gav|1|g%3A%22com.github.sevntu-checkstyle%22%20AND%20a%3A%22sevntu-checks%22
sevntu-checkstyle-idea-extension:!https://maven-badges.herokuapp.com/maven-central/com.github.sevntu-checkstyle/sevntu-checkstyle-idea-extension/badge.svg!:https://search.maven.org/#search|gav|1|g%3A%22com.github.sevntu-checkstyle%22%20AND%20a%3A%22sevntu-checkstyle-idea-extension%22
@@ -12,7 +12,7 @@ Additional(non-standard) checks for Checkstyle that are compiled as:
- extension to "Sonar Checkstyle Plugin":http://docs.codehaus.org/display/SONAR/Checkstyle+Plugin (how to use: "instructions with pictures":https://github.com/sevntu-checkstyle/sevntu.checkstyle/wiki/How-to-integrate-sevntu-checks-into-SonarQubeTM-%28user%27s-guide%29).
- extension to "CheckStyle-IDEA":http://plugins.jetbrains.com/plugin/1065 (how to use: "instructions with pictures":https://github.com/sevntu-checkstyle/sevntu.checkstyle/wiki/How-to-use-SevNTU-Checkstyle-in-Intellij-IDEA).
- extension to "Checkstyle Beans, NetBeans":http://plugins.netbeans.org/plugin/3413/checkstyle-beans (how to use: "instructions with pictures":https://github.com/sevntu-checkstyle/sevntu.checkstyle/wiki/How-to-use-SevNTU-Checkstyle-in-NetBeans).
-- extension to "Checkstyle Eclipse plugin":http://eclipse-cs.sourceforge.net/ how to use: install from EclipseCS "update site":
+- extension to "Checkstyle Eclipse plugin":http://eclipse-cs.sourceforge.net/ how to use: install from EclipseCS "update site":
!https://cloud.githubusercontent.com/assets/812984/2935361/20e479c8-d805-11e3-9391-f41cc4aa979c.png!
h3. Related Projects
@@ -21,7 +21,7 @@ h3. Related Projects
h3. Contributors
-"Roman Ivanov":https://github.com/romani, "Ivan Sopov":https://github.com/isopov, "Ruslan Diachenko":https://github.com/rdiachenko, Danil Lopatin, "Daniil Yaroslavtsev":https://github.com/daniilyar, "Yuriy Balahonov":https://github.com/balakhonov, Dmitriy Antonenko,
+"Roman Ivanov":https://github.com/romani, "Ivan Sopov":https://github.com/isopov, "Ruslan Diachenko":https://github.com/rdiachenko, Danil Lopatin, "Daniil Yaroslavtsev":https://github.com/daniilyar, "Yuriy Balahonov":https://github.com/balakhonov, Dmitriy Antonenko,
Hidoyatov Victor, Troshin Sergey, Svinukhov Vladimir, "Ilia Dubinin":https://github.com/sabaka, Dmitry Gridyushko, "Vadym Chekrii":https://github.com/vchekrii, "Vadim Panasiuk":https://github.com/VadimPanasiuk,
"Aleksey Grigirov":https://github.com/KTannenberg, Alexander Berezovsky, "Sergey Burtsev":https://github.com/burtsevsergey, "Baratali Izmailov":https://github.com/baratali, "Max Vetrenko":https://github.com/maxvetrenko,
"Pavel Baranchikov":https://github.com/pbaranchikov , "Ashutosh Agarwal":https://github.com/Radsaggi, "Alexey Nesterenko":https://github.com/alexkravin. , ...... for whole list please look at "contributors list":https://github.com/sevntu-checkstyle/sevntu.checkstyle/network/members .
From 3d6d0678adc37b271f3def9b0bad262f1b335c4b Mon Sep 17 00:00:00 2001
From: Roman Ivanov
Date: Sun, 11 Mar 2018 11:44:54 -0700
Subject: [PATCH 163/208] minor: New project badges at sonarcloud.io
checkstyle/checkstyle#5605
---
README.textile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.textile b/README.textile
index bda6f44f54..9896b6ba6a 100644
--- a/README.textile
+++ b/README.textile
@@ -1,4 +1,4 @@
-h3. Information "!https://secure.travis-ci.org/sevntu-checkstyle/sevntu.checkstyle.png!":http://travis-ci.org/sevntu-checkstyle/sevntu.checkstyle/builds !https://coveralls.io/repos/sevntu-checkstyle/sevntu.checkstyle/badge.svg?branch=master&service=github(Coverage Status)!:https://coveralls.io/github/sevntu-checkstyle/sevntu.checkstyle?branch=master !https://sonarqube.com/api/badges/measure?key=com.github.sevntu.checkstyle:sevntu-checks&metric=sqale_debt_ratio!:https://sonarqube.com/dashboard?id=com.github.sevntu.checkstyle%3Asevntu-checks
+h3. Information "!https://secure.travis-ci.org/sevntu-checkstyle/sevntu.checkstyle.png!":http://travis-ci.org/sevntu-checkstyle/sevntu.checkstyle/builds !https://coveralls.io/repos/sevntu-checkstyle/sevntu.checkstyle/badge.svg?branch=master&service=github(Coverage Status)!:https://coveralls.io/github/sevntu-checkstyle/sevntu.checkstyle?branch=master !https://sonarcloud.io/images/project_badges/sonarcloud-white.svg!:https://sonarqube.com/dashboard?id=com.github.sevntu.checkstyle%3Asevntu-checks
sevntu-checks: !https://maven-badges.herokuapp.com/maven-central/com.github.sevntu-checkstyle/sevntu-checks/badge.svg!:https://search.maven.org/#search|gav|1|g%3A%22com.github.sevntu-checkstyle%22%20AND%20a%3A%22sevntu-checks%22
sevntu-checkstyle-idea-extension:!https://maven-badges.herokuapp.com/maven-central/com.github.sevntu-checkstyle/sevntu-checkstyle-idea-extension/badge.svg!:https://search.maven.org/#search|gav|1|g%3A%22com.github.sevntu-checkstyle%22%20AND%20a%3A%22sevntu-checkstyle-idea-extension%22
From f74b8da56fbd63cbe5b0a2c5db229851c716c015 Mon Sep 17 00:00:00 2001
From: Roman Ivanov
Date: Sun, 11 Mar 2018 12:49:46 -0700
Subject: [PATCH 164/208] minor: New project badges at sonarcloud.io
checkstyle/checkstyle#5605
---
README.textile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.textile b/README.textile
index 9896b6ba6a..4ce61f5ffc 100644
--- a/README.textile
+++ b/README.textile
@@ -1,4 +1,4 @@
-h3. Information "!https://secure.travis-ci.org/sevntu-checkstyle/sevntu.checkstyle.png!":http://travis-ci.org/sevntu-checkstyle/sevntu.checkstyle/builds !https://coveralls.io/repos/sevntu-checkstyle/sevntu.checkstyle/badge.svg?branch=master&service=github(Coverage Status)!:https://coveralls.io/github/sevntu-checkstyle/sevntu.checkstyle?branch=master !https://sonarcloud.io/images/project_badges/sonarcloud-white.svg!:https://sonarqube.com/dashboard?id=com.github.sevntu.checkstyle%3Asevntu-checks
+h3. Information "!https://secure.travis-ci.org/sevntu-checkstyle/sevntu.checkstyle.png!":http://travis-ci.org/sevntu-checkstyle/sevntu.checkstyle/builds !https://coveralls.io/repos/sevntu-checkstyle/sevntu.checkstyle/badge.svg?branch=master&service=github(Coverage Status)!:https://coveralls.io/github/sevntu-checkstyle/sevntu.checkstyle?branch=master !https://sonarcloud.io/api/project_badges/measure?project=com.github.sevntu.checkstyle%3Asevntu-checks&metric=sqale_index!:https://sonarqube.com/dashboard?id=com.github.sevntu.checkstyle%3Asevntu-checks
sevntu-checks: !https://maven-badges.herokuapp.com/maven-central/com.github.sevntu-checkstyle/sevntu-checks/badge.svg!:https://search.maven.org/#search|gav|1|g%3A%22com.github.sevntu-checkstyle%22%20AND%20a%3A%22sevntu-checks%22
sevntu-checkstyle-idea-extension:!https://maven-badges.herokuapp.com/maven-central/com.github.sevntu-checkstyle/sevntu-checkstyle-idea-extension/badge.svg!:https://search.maven.org/#search|gav|1|g%3A%22com.github.sevntu-checkstyle%22%20AND%20a%3A%22sevntu-checkstyle-idea-extension%22
From e7098a1dd14bb02f18425db347e97db56a4cb101 Mon Sep 17 00:00:00 2001
From: Josh Soref
Date: Wed, 28 Mar 2018 03:31:52 +0000
Subject: [PATCH 165/208] minor: follow redirect
---
.../sevntu/checkstyle/checks/annotation/checkstyle-metadata.xml | 2 +-
.../sevntu/checkstyle/checks/coding/checkstyle-metadata.xml | 2 +-
.../sevntu/checkstyle/checks/design/checkstyle-metadata.xml | 2 +-
.../sevntu/checkstyle/checks/naming/checkstyle-metadata.xml | 2 +-
.../sevntu/checkstyle/checks/sizes/checkstyle-metadata.xml | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/annotation/checkstyle-metadata.xml b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/annotation/checkstyle-metadata.xml
index 50ed8cd8b3..c2f55ecdac 100755
--- a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/annotation/checkstyle-metadata.xml
+++ b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/annotation/checkstyle-metadata.xml
@@ -1,7 +1,7 @@
+"http://checkstyle.org/eclipse-cs/dtds/checkstyle-metadata_1_1.dtd">
diff --git a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/coding/checkstyle-metadata.xml b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/coding/checkstyle-metadata.xml
index 5821d48c1b..3392c3bec1 100644
--- a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/coding/checkstyle-metadata.xml
+++ b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/coding/checkstyle-metadata.xml
@@ -1,7 +1,7 @@
+"http://checkstyle.org/eclipse-cs/dtds/checkstyle-metadata_1_1.dtd">
diff --git a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/design/checkstyle-metadata.xml b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/design/checkstyle-metadata.xml
index cf21b616f1..b55cc10551 100644
--- a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/design/checkstyle-metadata.xml
+++ b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/design/checkstyle-metadata.xml
@@ -1,7 +1,7 @@
+"http://checkstyle.org/eclipse-cs/dtds/checkstyle-metadata_1_1.dtd">
diff --git a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/naming/checkstyle-metadata.xml b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/naming/checkstyle-metadata.xml
index f80955d403..d96cd7fce5 100644
--- a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/naming/checkstyle-metadata.xml
+++ b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/naming/checkstyle-metadata.xml
@@ -1,7 +1,7 @@
+"http://checkstyle.org/eclipse-cs/dtds/checkstyle-metadata_1_1.dtd">
diff --git a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/sizes/checkstyle-metadata.xml b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/sizes/checkstyle-metadata.xml
index 91460a2b85..d76ad4d19c 100755
--- a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/sizes/checkstyle-metadata.xml
+++ b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/sizes/checkstyle-metadata.xml
@@ -1,7 +1,7 @@
+"http://checkstyle.org/eclipse-cs/dtds/checkstyle-metadata_1_1.dtd">
From 0cfed385c9ff26e83ad79820452ce825b947f106 Mon Sep 17 00:00:00 2001
From: Josh Soref
Date: Wed, 28 Mar 2018 22:38:56 +0000
Subject: [PATCH 166/208] spelling: comments
---
.github/PULL_REQUEST_TEMPLATE.md | 2 +-
README.textile | 2 +-
deploy.sh | 12 ++++++------
pom-version-bump.sh | 4 ++--
sevntu-checks/import-control.xml | 8 ++++----
sevntu-checks/pom.xml | 4 ++--
.../ForbidAnnotationElementValueCheck.java | 2 +-
.../checks/coding/AvoidModifiersForTypesCheck.java | 2 +-
.../checks/coding/EmptyPublicCtorInClassCheck.java | 2 +-
.../checks/coding/FinalizeImplementationCheck.java | 2 +-
.../checks/coding/ForbidCertainMethodCheck.java | 2 +-
.../checks/coding/ForbidInstantiationCheck.java | 2 +-
.../coding/ForbidReturnInFinallyBlockCheck.java | 2 +-
.../coding/ForbidThrowAnonymousExceptionsCheck.java | 10 +++++-----
.../coding/MapIterationInForEachLoopCheck.java | 2 +-
.../coding/OverridableMethodInConstructorCheck.java | 8 ++++----
.../coding/SimpleAccessorNameNotationCheck.java | 4 ++--
.../coding/UnnecessaryParenthesesExtendedCheck.java | 2 +-
.../checks/coding/UselessSingleCatchCheck.java | 2 +-
.../checks/coding/UselessSuperCtorCallCheck.java | 2 +-
.../checks/design/CheckstyleTestMakeupCheck.java | 2 +-
.../checks/design/ChildBlockLengthCheck.java | 2 +-
.../design/ForbidWildcardAsReturnTypeCheck.java | 6 +++---
.../checks/naming/UniformEnumConstantNameCheck.java | 4 ++--
sevntu-checks/src/main/sh/ast.sh | 4 ++--
.../InputHideUtilityClassConstructorCheck4.java | 4 ++--
.../checks/sizes/InputLineLengthExtendedCheck.java | 2 +-
.../checkstyle/sonar/checkstyle-extensions.xml | 8 ++++----
28 files changed, 54 insertions(+), 54 deletions(-)
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 285e43f0e3..ab236e32fa 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -11,6 +11,6 @@ Mandatory to understand and do:
To avoid multiple iterations of fixes and CIs failures, please read http://checkstyle.sourceforge.net/contributing.html
-ATTENTION: We are not merging Pull Requests that not passing our CIs, but we help to resole issues.
+ATTENTION: We are not merging Pull Requests that not passing our CIs, but we help to resolve issues.
Thanks for reading, remove whole this message and type what you need.
diff --git a/README.textile b/README.textile
index 4ce61f5ffc..83bdce4eb3 100644
--- a/README.textile
+++ b/README.textile
@@ -21,7 +21,7 @@ h3. Related Projects
h3. Contributors
-"Roman Ivanov":https://github.com/romani, "Ivan Sopov":https://github.com/isopov, "Ruslan Diachenko":https://github.com/rdiachenko, Danil Lopatin, "Daniil Yaroslavtsev":https://github.com/daniilyar, "Yuriy Balahonov":https://github.com/balakhonov, Dmitriy Antonenko,
+"Roman Ivanov":https://github.com/romani, "Ivan Sopov":https://github.com/isopov, "Ruslan Diachenko":https://github.com/rdiachenko, Danil Lopatin, "Daniil Yaroslavtsev":https://github.com/daniilyar, "Yuriy Balakhonov":https://github.com/balakhonov, Dmitriy Antonenko,
Hidoyatov Victor, Troshin Sergey, Svinukhov Vladimir, "Ilia Dubinin":https://github.com/sabaka, Dmitry Gridyushko, "Vadym Chekrii":https://github.com/vchekrii, "Vadim Panasiuk":https://github.com/VadimPanasiuk,
"Aleksey Grigirov":https://github.com/KTannenberg, Alexander Berezovsky, "Sergey Burtsev":https://github.com/burtsevsergey, "Baratali Izmailov":https://github.com/baratali, "Max Vetrenko":https://github.com/maxvetrenko,
"Pavel Baranchikov":https://github.com/pbaranchikov , "Ashutosh Agarwal":https://github.com/Radsaggi, "Alexey Nesterenko":https://github.com/alexkravin. , ...... for whole list please look at "contributors list":https://github.com/sevntu-checkstyle/sevntu.checkstyle/network/members .
diff --git a/deploy.sh b/deploy.sh
index 46543f51b0..e7d401153e 100755
--- a/deploy.sh
+++ b/deploy.sh
@@ -77,9 +77,9 @@ deployEclipse()
deployMavenLibrary()
{
- # As we do not use SNAPSHOT qualifier for developemnt in pom.xml
- # we have to deploy library sevntu-checks always even it overides existing binaries in maven repository
- # for relase build - it will not override binaries
+ # As we do not use SNAPSHOT qualifier for development in pom.xml
+ # we have to deploy library sevntu-checks always even it overrides existing binaries in maven repository
+ # for release build - it will not override binaries
# for test build - it will override as we need to be sure that in repository,
# we have previous release version but compiled with from new code
cd $REPO_HOME_DIR/sevntu-checks
@@ -102,9 +102,9 @@ deployMavenLibrary()
deployToMavenCentral()
{
- # As we do not use SNAPSHOT qualifier for developemnt in pom.xml
- # we have to deploy library sevntu-checks always even it overides existing binaries in maven repository
- # for relase build - it will not override binaries
+ # As we do not use SNAPSHOT qualifier for development in pom.xml
+ # we have to deploy library sevntu-checks always even it overrides existing binaries in maven repository
+ # for release build - it will not override binaries
# for test build - it will override as we need to be sure that in repository,
# we have previous release version but compiled with from new code
cd $REPO_HOME_DIR/sevntu-checks
diff --git a/pom-version-bump.sh b/pom-version-bump.sh
index 7251f2f3e7..cf70d257ed 100755
--- a/pom-version-bump.sh
+++ b/pom-version-bump.sh
@@ -40,7 +40,7 @@ do
mv $i.new $i
done
-#aditional version reference in dependency
+#additional version reference in dependency
FILE=sevntu-checkstyle-maven-plugin/pom.xml
echo "Updating: "$FILE
xmlstarlet ed --ps -N pom="http://maven.apache.org/POM/4.0.0" \
@@ -48,7 +48,7 @@ xmlstarlet ed --ps -N pom="http://maven.apache.org/POM/4.0.0" \
$FILE > $FILE.new
mv $FILE.new $FILE
-#aditional version reference, eclipse file
+#additional version reference, eclipse file
FILE=eclipsecs-sevntu-plugin-feature/feature.xml
echo "Updating: "$FILE
xmlstarlet ed --ps \
diff --git a/sevntu-checks/import-control.xml b/sevntu-checks/import-control.xml
index 20c6d84be5..d1b80f02db 100644
--- a/sevntu-checks/import-control.xml
+++ b/sevntu-checks/import-control.xml
@@ -77,7 +77,7 @@
-
+
@@ -91,16 +91,16 @@
-
+
-
+
-
+
diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml
index 8651c32587..45b5602f0e 100644
--- a/sevntu-checks/pom.xml
+++ b/sevntu-checks/pom.xml
@@ -15,7 +15,7 @@
iso-8859-1
-
+
8.8https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.eclipse-cs.version}/config/checkstyle_checks.xml2.17
@@ -321,7 +321,7 @@
checkstyle${checkstyle.eclipse-cs.version}
-
+
com.github.sevntu-checkstylesevntu-checks
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationElementValueCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationElementValueCheck.java
index 81d40a7944..c9fb3b8609 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationElementValueCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationElementValueCheck.java
@@ -86,7 +86,7 @@
* @SuppressWarnings("unchecked")
*
*
- * To forbid any array-valued element, frobiddenElementValueRegexp option should be: "\{.*\}".
+ * To forbid any array-valued element, forbiddenElementValueRegexp option should be: "\{.*\}".
*
*
* Config
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidModifiersForTypesCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidModifiersForTypesCheck.java
index c705f44442..8a7a28f0c3 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidModifiersForTypesCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidModifiersForTypesCheck.java
@@ -525,7 +525,7 @@ private static String getClassName(final String classNameAndPath) {
* Gets the modifiers of the defined variable (annotation, public, private, final, static,
* transient or volatile).
* @param variableDefAst
- * A DeatilAST node is related to the variable definition
+ * A DetailAST node is related to the variable definition
* (VARIABLE_DEF type)
* @return List of token types is related to the given variable modifiers.
*/
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EmptyPublicCtorInClassCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EmptyPublicCtorInClassCheck.java
index cc75c89f1a..44b4541128 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EmptyPublicCtorInClassCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EmptyPublicCtorInClassCheck.java
@@ -233,7 +233,7 @@ private static int getClassCtorCount(DetailAST classDefNode) {
}
/**
- * Gets first constructor defininition for class.
+ * Gets first constructor definition for class.
* @param classDefNode
* a class definition node.
* @return first ctor definition node for class or null if class has no ctor.
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/FinalizeImplementationCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/FinalizeImplementationCheck.java
index 2b5fbe55ad..fef76f0341 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/FinalizeImplementationCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/FinalizeImplementationCheck.java
@@ -168,7 +168,7 @@ && isFinalizeMethodName(methodDefToken) && isVoid(methodDefToken)
* @param modifierType
* modifier type.
* @param methodToken
- * MODIFIRES Token.
+ * MODIFIERS Token.
* @return true, if finalize() has "protected" access modifier.
*/
private static boolean hasModifier(int modifierType, DetailAST methodToken) {
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidCertainMethodCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidCertainMethodCheck.java
index d9c65264ac..716bc66ae1 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidCertainMethodCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidCertainMethodCheck.java
@@ -197,7 +197,7 @@ private boolean isForbiddenMethod(DetailAST ast, String name, int argCount) {
* Range must be bounded on one side or both sides.
* It can't be unbounded on both side.
*
- * Some examples of vaild ranges:
+ * Some examples of valid ranges:
*
*
1-10: 1 and 10 and all numbers between 1 and 10
*
-10: same as 0-10
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidInstantiationCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidInstantiationCheck.java
index cb15d33d10..e70bd6215d 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidInstantiationCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidInstantiationCheck.java
@@ -235,7 +235,7 @@ private static String getClassName(final String classNameAndPath) {
* - DetailAST node is pointing to import definition or to the "new"
* literal node ("IMPORT" or "LITERAL_NEW" node types).
* @return Import text without "import" word and semicolons for given
- * "IMPORT" node or instanstiated class Name&Path for given
+ * "IMPORT" node or instantiated class Name&Path for given
* "LITERAL_NEW" node.
*/
private static String getText(final DetailAST ast) {
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidReturnInFinallyBlockCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidReturnInFinallyBlockCheck.java
index 46bab15389..ef6713ba2e 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidReturnInFinallyBlockCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidReturnInFinallyBlockCheck.java
@@ -30,7 +30,7 @@
*
* The finally block is always executed unless there is abnormal program termination, either
* resulting from a JVM crash or from a call to System.exit(0). On top of that, any value returned
- * from within the finnally block will override the value returned prior to execution of the finally
+ * from within the finally block will override the value returned prior to execution of the finally
* block. This check reports if the finally block contains a return statement.
*
*
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidThrowAnonymousExceptionsCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidThrowAnonymousExceptionsCheck.java
index 74eace682f..f5cd575567 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidThrowAnonymousExceptionsCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ForbidThrowAnonymousExceptionsCheck.java
@@ -140,7 +140,7 @@ else if (throwingLiteralNewAst == null) {
/**
* Analyzes variable definition for anonymous exception definition. if found
* - adds it to list of anonymous exceptions
- * @param variableDefAst The token to exmaine.
+ * @param variableDefAst The token to examine.
*/
private void
lookForAnonymousExceptionDefinition(DetailAST variableDefAst) {
@@ -168,7 +168,7 @@ && hasObjectBlock(variableLiteralNewAst)) {
/**
* Gets the literal new node from variable definition node or throw node.
- * @param literalThrowOrVariableDefAst The token to exmaine.
+ * @param literalThrowOrVariableDefAst The token to examine.
* @return the specified node.
*/
private static DetailAST
@@ -179,7 +179,7 @@ && hasObjectBlock(variableLiteralNewAst)) {
/**
* Retrieves the AST node which contains the name of throwing exception.
- * @param expressionAst The token to exmaine.
+ * @param expressionAst The token to examine.
* @return the specified node.
*/
private static DetailAST
@@ -189,7 +189,7 @@ && hasObjectBlock(variableLiteralNewAst)) {
/**
* Checks if definition with a literal new has an ObjBlock.
- * @param literalNewAst The token to exmaine.
+ * @param literalNewAst The token to examine.
* @return true if the new has an object block.
*/
private static boolean hasObjectBlock(DetailAST literalNewAst) {
@@ -199,7 +199,7 @@ private static boolean hasObjectBlock(DetailAST literalNewAst) {
/**
* Checks if variable name is definitely an exception name. It is so if
* variable type ends with "Exception" suffix
- * @param variableNameAst The token to exmaine.
+ * @param variableNameAst The token to examine.
* @return true if the name is an exception.
*/
private boolean isExceptionName(DetailAST variableNameAst) {
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MapIterationInForEachLoopCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MapIterationInForEachLoopCheck.java
index 1a397d35c3..18aef2fbea 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MapIterationInForEachLoopCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MapIterationInForEachLoopCheck.java
@@ -377,7 +377,7 @@ else if (proposeEntrySetUsage) {
/**
* Checks if the not is a for each.
- * @param forNode The token to exmaine.
+ * @param forNode The token to examine.
* @return true if is for each.
*/
private static boolean isForEach(DetailAST forNode) {
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/OverridableMethodInConstructorCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/OverridableMethodInConstructorCheck.java
index eea1e72ede..77f99607aa 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/OverridableMethodInConstructorCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/OverridableMethodInConstructorCheck.java
@@ -177,7 +177,7 @@ public class OverridableMethodInConstructorCheck extends AbstractCheck {
private DetailAST curMethodDef;
/**
- * A current root of the synthax tree is being processed.
+ * A current root of the syntax tree is being processed.
* */
private DetailAST treeRootAST;
@@ -648,7 +648,7 @@ else if (dotChild.getType() == TokenTypes.DOT) {
}
/**
- * Gets the count of parameters for current method definitioin or
+ * Gets the count of parameters for current method definition or
* method call.
* @param methodDefOrCallAST METHOD_DEF or METHOD_CALL
* DetailAST node
@@ -730,7 +730,7 @@ private static DetailAST getClassDef(final DetailAST methodNode) {
* Gets the CLASS_DEF DetailAST node for the class is named "aClassName".
*
* @param rootNode
- * A root node of synthax tree is being processed.
+ * A root node of syntax tree is being processed.
* @param className
* The name of class to search.
* @return The CLASS_DEF DetailAST node which is related to the class is
@@ -892,7 +892,7 @@ private static List getChildren(final DetailAST node) {
}
/**
- * Class that incapsulates the DetailAST node related to the method call
+ * Class that encapsulates the DetailAST node related to the method call
* that leads to call of the overridable method and the name of
* overridable method.
*/
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/SimpleAccessorNameNotationCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/SimpleAccessorNameNotationCheck.java
index 960e3b8e5a..6e5e9beb82 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/SimpleAccessorNameNotationCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/SimpleAccessorNameNotationCheck.java
@@ -39,7 +39,7 @@
* , for example:
*
*
* The check is not "type aware", that is to say, it can't tell if parentheses
* are unnecessary based on the types in an expression. It also doesn't know
- * about operator precedence and associatvity; therefore it won't catch
+ * about operator precedence and associativity; therefore it won't catch
* something like
*
*
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UselessSingleCatchCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UselessSingleCatchCheck.java
index 8771f39b71..e09a472308 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UselessSingleCatchCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UselessSingleCatchCheck.java
@@ -92,7 +92,7 @@ && isSimpleRethrow(firstStatementNode)) {
* throw exceptionObject;.
* @param throwNode
* node of type TokenTypes.LITERAL_THROW
- * @return wheather this throw node is of specified form
+ * @return whether this throw node is of specified form
*/
private static boolean isSimpleRethrow(DetailAST throwNode) {
final DetailAST exprNode = throwNode.findFirstToken(TokenTypes.EXPR);
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UselessSuperCtorCallCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UselessSuperCtorCallCheck.java
index 039ce5f64f..14507bae97 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UselessSuperCtorCallCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UselessSuperCtorCallCheck.java
@@ -87,7 +87,7 @@
* Check will not generate violation when "super()" called inside class ctor when class
* has multiple public ctors(however, setting this option to "true" will not prevent Check
* from logging violation if class does not extend anything). This option defaults to "false".
- * This option may be usefull for cases in which class`s ctors just forward its arguments to
+ * This option may be useful for cases in which class`s ctors just forward its arguments to
* super ctors, thus removing "super()" in this case will make default ctors look not like
* others. For example:
*
Rationale: This check was made to ensure tests follow a specific design implementation
- * so 3rd party utilities like the regression utility can parse the tests for informaiton
+ * so 3rd party utilities like the regression utility can parse the tests for information
* used in creating regression reports.
*
*
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ChildBlockLengthCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ChildBlockLengthCheck.java
index e28d2d6cdb..87a115641a 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ChildBlockLengthCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ChildBlockLengthCheck.java
@@ -55,7 +55,7 @@ public class ChildBlockLengthCheck extends AbstractCheck {
public static final String MSG_KEY = "child.block.length";
/**
- * The constant is used in percantage arifmethic operations. Represents
+ * The constant is used in percentage arithmetic operations. Represents
* '100%'
*/
private static final double PERCENTS_FACTOR = 100.0;
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ForbidWildcardAsReturnTypeCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ForbidWildcardAsReturnTypeCheck.java
index d8abaaeea2..03316e4c1f 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ForbidWildcardAsReturnTypeCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/ForbidWildcardAsReturnTypeCheck.java
@@ -45,18 +45,18 @@
* reject. If the user of a class has to think about wildcard types, there is
* probably something wrong with the class’s API."
* Attention: some JDK classes have public methods with "?"(wildcard) in return type
- * so it might not always possible to avoid wildcards in retun type, as they do not demand user
+ * so it might not always possible to avoid wildcards in return type, as they do not demand user
* to bother about it (invisible for user or method). So suppressions should be used.
*
*
* Examples:
*
* JDK Collectors, so usage
- * of methods that retun wilcard could force user customizations over Collectors use wilcard in
+ * of methods that return wildcard could force user customizations over Collectors use wildcard in
* public methods
*
*
{@code
- * // custom util method, wilcard come from Collectors.toList()
+ * // custom util method, wildcard come from Collectors.toList()
* public Collector singleResult(Function super Iterable, T> collector) {
* return Collectors.collectingAndThen(Collectors.toList(), collected -> collected.get(0));
* }
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/naming/UniformEnumConstantNameCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/naming/UniformEnumConstantNameCheck.java
index d3f9587a0d..1a006ac322 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/naming/UniformEnumConstantNameCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/naming/UniformEnumConstantNameCheck.java
@@ -206,13 +206,13 @@ private void logViolation(DetailAST member, String enumName, BitSet violated) {
/**
* Matches the specified enum name against the patterns, specified by
- * {@code conformedPattenrs}.
+ * {@code conformedPatterns}.
*
* @param name
* name to validate
* @param conformedPatterns
* bit set of patterns, which the method should match against.
- * @return bit set of matched patterns. Returned value is alwais a subset of
+ * @return bit set of matched patterns. Returned value is always a subset of
* {@code conformedPatterns}
*/
private BitSet match(String name, BitSet conformedPatterns) {
diff --git a/sevntu-checks/src/main/sh/ast.sh b/sevntu-checks/src/main/sh/ast.sh
index 244d4e8e65..ba4db142a7 100755
--- a/sevntu-checks/src/main/sh/ast.sh
+++ b/sevntu-checks/src/main/sh/ast.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
#################################################################################
-# This is a useful script which builds Checkstyle AST (abstract synthax tree) #
+# This is a useful script which builds Checkstyle AST (abstract syntax tree) #
# for custom Java file and opens it using simple built-in Checkstyle GUI. #
#################################################################################
@@ -41,7 +41,7 @@ CHECKSTYLE_VERSION=5.7
ARCHIVE_FILE_NAME=checkstyle-${CHECKSTYLE_VERSION}-bin.tar.gz
CHECKSTYLE_OUTPUT_FILE_NAME=checkstyle-${CHECKSTYLE_VERSION}-all.jar
-# checking /tmp for existance
+# checking /tmp for existence
TMPDIR=/tmp
if [ ! -d $TMPDIR ]
then
diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputHideUtilityClassConstructorCheck4.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputHideUtilityClassConstructorCheck4.java
index 82194b8b04..7c0de5cd98 100644
--- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputHideUtilityClassConstructorCheck4.java
+++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputHideUtilityClassConstructorCheck4.java
@@ -41,7 +41,7 @@ private void aPrivateMethod()
protected abstract void nonFinalButAbstract();
- // this one is bad: neither abtract, final, or empty
+ // this one is bad: neither abstract, final, or empty
protected void doh()
{
@@ -55,7 +55,7 @@ protected void doh()
// tries to trigger bug #884035
// MyComparator is a private class, so there cannot be subclasses
- // and it should not be neccessary to declare compare() as final
+ // and it should not be necessary to declare compare() as final
private class MyComparator implements java.util.Comparator
{
public int compare(Object o1, Object o2)
diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/sizes/InputLineLengthExtendedCheck.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/sizes/InputLineLengthExtendedCheck.java
index 68ce0d507c..0a873a84b6 100644
--- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/sizes/InputLineLengthExtendedCheck.java
+++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/sizes/InputLineLengthExtendedCheck.java
@@ -220,6 +220,6 @@ enum MyEnum1
/** XYZ constant */
XYZ;
- /** Should be mSomeMemeber */
+ /** Should be mSomeMember */
private int someMember;
}
diff --git a/sevntu-checkstyle-sonar-plugin/src/main/resources/com/github/sevntu/checkstyle/sonar/checkstyle-extensions.xml b/sevntu-checkstyle-sonar-plugin/src/main/resources/com/github/sevntu/checkstyle/sonar/checkstyle-extensions.xml
index 9693a62b4e..083323a6c7 100644
--- a/sevntu-checkstyle-sonar-plugin/src/main/resources/com/github/sevntu/checkstyle/sonar/checkstyle-extensions.xml
+++ b/sevntu-checkstyle-sonar-plugin/src/main/resources/com/github/sevntu/checkstyle/sonar/checkstyle-extensions.xml
@@ -135,7 +135,7 @@
false
- Check overrided methods.
+ Check overridden methods.false
@@ -159,7 +159,7 @@
com.github.sevntu.checkstyle.checks.design.NoMainMethodInAbstractClassCheckNo Main Method In Abstract Class
- Forbids main methods in abstract classes. Rationale: existance of 'main' method can mislead a developer to consider this class as a ready-to-use implementation.
+ Forbids main methods in abstract classes. Rationale: existence of 'main' method can mislead a developer to consider this class as a ready-to-use implementation.Checker/TreeWalker/com.github.sevntu.checkstyle.checks.design.NoMainMethodInAbstractClassCheck
@@ -502,7 +502,7 @@
false
- Check to highlight all dublicates.
+ Check to highlight all duplicates.
@@ -623,7 +623,7 @@
com.github.sevntu.checkstyle.checks.design.PublicReferenceToPrivateTypeCheckPublic Reference To Private Type
- This Check warns on propagation of inner private types to outer classes: - Externally accessible method if it returns private inner type. - Externally accessible field if it's type is a private inner type. These types could be private inner classe, interfaces or enumerations.
+ This Check warns on propagation of inner private types to outer classes: - Externally accessible method if it returns private inner type. - Externally accessible field if it's type is a private inner type. These types could be private inner classes, interfaces or enumerations.Checker/TreeWalker/com.github.sevntu.checkstyle.checks.design.PublicReferenceToPrivateTypeCheck
From c9a31a32f9caed89aca75faf40815ee5edeb0337 Mon Sep 17 00:00:00 2001
From: Josh Soref
Date: Wed, 28 Mar 2018 22:42:46 +0000
Subject: [PATCH 167/208] spelling: functions/variables
---
.../coding/ConfusingConditionCheck.java | 6 +-
.../checks/coding/EitherLogOrThrowCheck.java | 6 +-
.../MapIterationInForEachLoopCheck.java | 12 +--
.../SimpleAccessorNameNotationCheck.java | 8 +-
...ForbidAnnotationElementValueCheckTest.java | 2 +-
...ltSerializableInInnerClassesCheckTest.java | 4 +-
.../CustomDeclarationOrderCheckTest.java | 2 +-
...erridableMethodInConstructorCheckTest.java | 4 +-
.../SimpleAccessorNameNotationCheckTest.java | 2 +-
...PublicReferenceToPrivateTypeCheckTest.java | 2 +-
.../checkstyle/internal/AllChecksTest.java | 12 +--
.../sevntu/checkstyle/internal/CheckUtil.java | 4 +-
.../checkstyle/internal/ChecksTest.java | 84 +++++++++----------
.../InputRedundantReturnCheckTestNPE.java | 6 +-
...faultSerializableInInnerClassesCheck1.java | 4 +-
.../InputAvoidHidingCauseExceptionCheck.java | 8 +-
.../InputCustomDeclarationOrderCheck.java | 2 +-
...OverridableMethodInConstructorCheck27.java | 2 +-
.../InputForbidWildcardAsReturnTypeCheck.java | 2 +-
19 files changed, 86 insertions(+), 86 deletions(-)
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ConfusingConditionCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ConfusingConditionCheck.java
index 556f151f44..108cab65f6 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ConfusingConditionCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ConfusingConditionCheck.java
@@ -242,9 +242,9 @@ private boolean isRatioBetweenIfAndElseBlockSuitable(DetailAST literalIf) {
boolean result = true;
final DetailAST lastChildAfterIf = literalIf.getLastChild();
- final int linesOfCodeInElseBlock = getAmounOfCodeRowsInBlock(lastChildAfterIf);
+ final int linesOfCodeInElseBlock = getAmountOfCodeRowsInBlock(lastChildAfterIf);
if (linesOfCodeInElseBlock > 0) {
- final int linesOfCodeInIfBlock = getAmounOfCodeRowsInBlock(literalIf);
+ final int linesOfCodeInIfBlock = getAmountOfCodeRowsInBlock(literalIf);
result = linesOfCodeInIfBlock / linesOfCodeInElseBlock < multiplyFactorForElseBlocks;
}
return result;
@@ -256,7 +256,7 @@ private boolean isRatioBetweenIfAndElseBlockSuitable(DetailAST literalIf) {
* @param detailAST The token to examine.
* @return linesOfCodeInIfBlock line of code in block.
*/
- private static int getAmounOfCodeRowsInBlock(DetailAST detailAST) {
+ private static int getAmountOfCodeRowsInBlock(DetailAST detailAST) {
final DetailAST firstBrace = getFirstBrace(detailAST);
int linesOfCodeInIfBlock;
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EitherLogOrThrowCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EitherLogOrThrowCheck.java
index 0f5f62adba..1f5da3df8f 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EitherLogOrThrowCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EitherLogOrThrowCheck.java
@@ -579,11 +579,11 @@ private static boolean isPrintStackTrace(final DetailAST expressionAst,
/**
* Verify that method is invoked on aUsedInstanceName.
- * @param usedInstanseName name of instance.
+ * @param usedInstanceName name of instance.
* @param methodCallAst DetailAST of METHOD_CALL.
* @return true if method is invoked on aUsedInstanceName.
*/
- private static boolean isInstanceMethodCall(final String usedInstanseName,
+ private static boolean isInstanceMethodCall(final String usedInstanceName,
final DetailAST methodCallAst) {
boolean result = false;
if (methodCallAst != null
@@ -594,7 +594,7 @@ private static boolean isInstanceMethodCall(final String usedInstanseName,
if (firstDotIndex != -1) {
final String usedObjectName =
methodCallIdent.substring(0, firstDotIndex);
- if (usedObjectName.equals(usedInstanseName)) {
+ if (usedObjectName.equals(usedInstanceName)) {
result = true;
}
}
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MapIterationInForEachLoopCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MapIterationInForEachLoopCheck.java
index 18aef2fbea..e623ffd84d 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MapIterationInForEachLoopCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MapIterationInForEachLoopCheck.java
@@ -587,12 +587,12 @@ else if (methodGetKeyCallCount > 0 && methodGetValueCallCount == 0) {
*/
private boolean isMapVariable(DetailAST variableDefNode) {
boolean result = false;
- final List literaNewNodeslList =
+ final List literalNewNodeslList =
getSubTreeNodesOfType(variableDefNode,
TokenTypes.LITERAL_NEW, TokenTypes.ASSIGN);
- final String className = getClassName(literaNewNodeslList);
+ final String className = getClassName(literalNewNodeslList);
if (className != null
- && getFirstNodeOfType(literaNewNodeslList, TokenTypes.ASSIGN) != null) {
+ && getFirstNodeOfType(literalNewNodeslList, TokenTypes.ASSIGN) != null) {
result = isMapImplementation(className);
}
return result;
@@ -652,14 +652,14 @@ private boolean isClassContainsInsideQualifiedImportList(String className) {
/**
* Returns the instance's class name.
- * @param literaNewNodesList
+ * @param literalNewNodesList
* This list contains "new" literals.
* @return object's class name,
* if class name is missed, returns null.
*/
- private static String getClassName(final List literaNewNodesList) {
+ private static String getClassName(final List literalNewNodesList) {
String result = null;
- for (DetailAST literalNewNode : literaNewNodesList) {
+ for (DetailAST literalNewNode : literalNewNodesList) {
final DetailAST exprNode = literalNewNode.getParent();
if (exprNode.getParent().getType() == TokenTypes.ASSIGN) {
result = literalNewNode.getFirstChild().getText();
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/SimpleAccessorNameNotationCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/SimpleAccessorNameNotationCheck.java
index 6e5e9beb82..ac2f83b065 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/SimpleAccessorNameNotationCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/SimpleAccessorNameNotationCheck.java
@@ -328,18 +328,18 @@ private static String getNameOfGettingField(DetailAST expr) {
* Return true when name of the field is not contained in parameters of the
* setter method.
*
- * @param paramrters
+ * @param parameters
* - DetailAST contains parameters of the setter.
* @param fieldName
* - name of the field.
* @return true when name of the field is not contained in parameters.
*/
- private static boolean checkNameOfParameters(DetailAST paramrters,
+ private static boolean checkNameOfParameters(DetailAST parameters,
String fieldName) {
boolean isNameOfParameter = false;
- final int parametersChildCount = paramrters.getChildCount();
+ final int parametersChildCount = parameters.getChildCount();
- final DetailAST parameterDef = paramrters
+ final DetailAST parameterDef = parameters
.findFirstToken(TokenTypes.PARAMETER_DEF);
for (int i = 0; i < parametersChildCount && !isNameOfParameter; i++) {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationElementValueCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationElementValueCheckTest.java
index 5cad4dbb82..2fc041f004 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationElementValueCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationElementValueCheckTest.java
@@ -145,7 +145,7 @@ public void testAnnotationWithSingleParameter() throws Exception {
}
@Test
- public void testAnnotationWtithBooleanParameterValueDoesntMatch() throws Exception {
+ public void testAnnotationWithBooleanParameterValueDoesntMatch() throws Exception {
final DefaultConfiguration checkConfig =
createModuleConfig(ForbidAnnotationElementValueCheck.class);
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidDefaultSerializableInInnerClassesCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidDefaultSerializableInInnerClassesCheckTest.java
index b92781f5bf..dcb16fbd78 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidDefaultSerializableInInnerClassesCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/AvoidDefaultSerializableInInnerClassesCheckTest.java
@@ -36,7 +36,7 @@ protected String getPackageLocation() {
}
@Test
- public void testWithAllowPartiaFalse()
+ public void testWithAllowPartialFalse()
throws Exception {
final DefaultConfiguration checkConfig =
createModuleConfig(AvoidDefaultSerializableInInnerClassesCheck.class);
@@ -90,7 +90,7 @@ public void testRealReadObjectNotRealReadObjectRealPrivate()
}
@Test
- public void testWithAllowPartiaTrue()
+ public void testWithAllowPartialTrue()
throws Exception {
final DefaultConfiguration checkConfig =
createModuleConfig(AvoidDefaultSerializableInInnerClassesCheck.class);
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheckTest.java
index b5c38c0f2c..7567ecea66 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheckTest.java
@@ -39,7 +39,7 @@ protected String getPackageLocation() {
}
@Test
- public void testCustomDecrationOrder() throws Exception {
+ public void testCustomDeclarationOrder() throws Exception {
final DefaultConfiguration checkConfig =
createModuleConfig(CustomDeclarationOrderCheck.class);
final String[] expected = {
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/OverridableMethodInConstructorCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/OverridableMethodInConstructorCheckTest.java
index 8d1f1077cf..98f97c6422 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/OverridableMethodInConstructorCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/OverridableMethodInConstructorCheckTest.java
@@ -54,7 +54,7 @@ public final void revereCodeTest() throws Exception {
}
@Test
- public final void newFeauture() throws Exception {
+ public final void newFeature() throws Exception {
final DefaultConfiguration checkConfig =
createModuleConfig(OverridableMethodInConstructorCheck.class);
checkConfig.addAttribute("checkCloneMethod", "true");
@@ -70,7 +70,7 @@ public final void newFeauture() throws Exception {
}
@Test
- public final void newFeautureWithoutMethodsByArgCount() throws Exception {
+ public final void newFeatureWithoutMethodsByArgCount() throws Exception {
final DefaultConfiguration checkConfig =
createModuleConfig(OverridableMethodInConstructorCheck.class);
checkConfig.addAttribute("checkCloneMethod", "true");
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/SimpleAccessorNameNotationCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/SimpleAccessorNameNotationCheckTest.java
index 91f593908f..9a5f1d4b6b 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/SimpleAccessorNameNotationCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/SimpleAccessorNameNotationCheckTest.java
@@ -68,7 +68,7 @@ public void correctWithoutPrefix() throws Exception {
}
@Test
- public void correctWithtPrefix() throws Exception {
+ public void correctWithPrefix() throws Exception {
final DefaultConfiguration checkConfig =
createModuleConfig(SimpleAccessorNameNotationCheck.class);
checkConfig.addAttribute("prefix", "m");
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/PublicReferenceToPrivateTypeCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/PublicReferenceToPrivateTypeCheckTest.java
index 716afc8882..e05a85c438 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/PublicReferenceToPrivateTypeCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/PublicReferenceToPrivateTypeCheckTest.java
@@ -80,7 +80,7 @@ public void returnPrivateTest()
* exceptions while verify()
*/
@Test
- public void returnPrivateThatImplimentTest()
+ public void returnPrivateThatImplementTest()
throws Exception {
final DefaultConfiguration checkConfig =
createModuleConfig(PublicReferenceToPrivateTypeCheck.class);
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/AllChecksTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/AllChecksTest.java
index 8269f28363..065a9e92d6 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/AllChecksTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/AllChecksTest.java
@@ -236,14 +236,14 @@ private static void grabAllTests(Map> allTests, File file)
}
final int slash = path.lastIndexOf(File.separatorChar);
- final String packge = path.substring(0, slash);
+ final String pkg = path.substring(0, slash);
- List classes = allTests.get(packge);
+ List classes = allTests.get(pkg);
if (classes == null) {
classes = new ArrayList();
- allTests.put(packge, classes);
+ allTests.put(pkg, classes);
}
classes.add(path.substring(slash + 1));
@@ -272,10 +272,10 @@ private static void verifyInputFile(Map> allTests, File fil
fileName = fileName.substring(5, period);
final int slash = path.lastIndexOf(File.separatorChar);
- final String packge = path.substring(0, slash);
- final List classes = allTests.get(packge);
+ final String pkg = path.substring(0, slash);
+ final List classes = allTests.get(pkg);
- if (classes != null || !packge.endsWith("external")) {
+ if (classes != null || !pkg.endsWith("external")) {
Assert.assertNotNull("Resource must be in a package that has tests: " + path,
classes);
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckUtil.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckUtil.java
index 61c578e489..f5e527c43a 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckUtil.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckUtil.java
@@ -130,11 +130,11 @@ public static Set getPackages(Set> modules) {
return result;
}
- public static Set> getModulesInPackage(Set> modules, String packge) {
+ public static Set> getModulesInPackage(Set> modules, String pkg) {
final Set> result = new HashSet<>();
for (Class> module : modules) {
- if (module.getPackage().getName().endsWith(packge)) {
+ if (module.getPackage().getName().endsWith(pkg)) {
result.add(module);
}
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/ChecksTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/ChecksTest.java
index 22b83c47c2..8e3b1a007c 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/ChecksTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/ChecksTest.java
@@ -80,14 +80,14 @@ public void verifyTestConfigurationFiles() throws Exception {
Assert.assertTrue("folder " + p + " must exist in eclipsecs", new File(
getEclipseCsPath(p)).exists());
- final Set> packgeModules = CheckUtil.getModulesInPackage(modules, p);
+ final Set> pkgModules = CheckUtil.getModulesInPackage(modules, p);
validateEclipseCsMetaXmlFile(
new File(getEclipseCsPath(p + "/checkstyle-metadata.xml")), p, new HashSet<>(
- packgeModules));
+ pkgModules));
validateEclipseCsMetaPropFile(new File(getEclipseCsPath(p
- + "/checkstyle-metadata.properties")), p, new HashSet<>(packgeModules));
+ + "/checkstyle-metadata.properties")), p, new HashSet<>(pkgModules));
}
}
@@ -173,9 +173,9 @@ private static void validateSonarProperties(Class> module, Set parameter
}
}
- private static void validateEclipseCsMetaXmlFile(File file, String packge,
- Set> packgeModules) throws Exception {
- Assert.assertTrue("'checkstyle-metadata.xml' must exist in eclipsecs in inside " + packge,
+ private static void validateEclipseCsMetaXmlFile(File file, String pkg,
+ Set> pkgModules) throws Exception {
+ Assert.assertTrue("'checkstyle-metadata.xml' must exist in eclipsecs in inside " + pkg,
file.exists());
final String input = new String(Files.readAllBytes(file.toPath()), UTF_8);
@@ -183,62 +183,62 @@ private static void validateEclipseCsMetaXmlFile(File file, String packge,
final NodeList ruleGroups = document.getElementsByTagName("rule-group-metadata");
- Assert.assertTrue(packge + " checkstyle-metadata.xml must contain only one rule group",
+ Assert.assertTrue(pkg + " checkstyle-metadata.xml must contain only one rule group",
ruleGroups.getLength() == 1);
for (int position = 0; position < ruleGroups.getLength(); position++) {
final Node ruleGroup = ruleGroups.item(position);
final Set children = XmlUtil.getChildrenElements(ruleGroup);
- validateEclipseCsMetaXmlFileRules(packge, packgeModules, children);
+ validateEclipseCsMetaXmlFileRules(pkg, pkgModules, children);
}
- for (Class> module : packgeModules) {
- Assert.fail("Module not found in " + packge + " checkstyle-metadata.xml: "
+ for (Class> module : pkgModules) {
+ Assert.fail("Module not found in " + pkg + " checkstyle-metadata.xml: "
+ module.getCanonicalName());
}
}
- private static void validateEclipseCsMetaXmlFileRules(String packge,
- Set> packgeModules, Set rules) throws Exception {
+ private static void validateEclipseCsMetaXmlFileRules(String pkg,
+ Set> pkgModules, Set rules) throws Exception {
for (Node rule : rules) {
final NamedNodeMap attributes = rule.getAttributes();
final Node internalNameNode = attributes.getNamedItem("internal-name");
- Assert.assertNotNull(packge + " checkstyle-metadata.xml must contain an internal name",
+ Assert.assertNotNull(pkg + " checkstyle-metadata.xml must contain an internal name",
internalNameNode);
final String internalName = internalNameNode.getTextContent();
- final String classpath = "com.github.sevntu.checkstyle.checks." + packge + "."
+ final String classpath = "com.github.sevntu.checkstyle.checks." + pkg + "."
+ internalName;
- final Class> module = findModule(packgeModules, classpath);
- packgeModules.remove(module);
+ final Class> module = findModule(pkgModules, classpath);
+ pkgModules.remove(module);
- Assert.assertNotNull("Unknown class found in " + packge + " checkstyle-metadata.xml: "
+ Assert.assertNotNull("Unknown class found in " + pkg + " checkstyle-metadata.xml: "
+ internalName, module);
final Node nameAttribute = attributes.getNamedItem("name");
- Assert.assertNotNull(packge + " checkstyle-metadata.xml requires a name for "
+ Assert.assertNotNull(pkg + " checkstyle-metadata.xml requires a name for "
+ internalName, nameAttribute);
- Assert.assertEquals(packge + " checkstyle-metadata.xml requires a valid name for "
+ Assert.assertEquals(pkg + " checkstyle-metadata.xml requires a valid name for "
+ internalName, "%" + internalName + ".name", nameAttribute.getTextContent());
final Node parentAttribute = attributes.getNamedItem("parent");
- Assert.assertNotNull(packge + " checkstyle-metadata.xml requires a parent for "
+ Assert.assertNotNull(pkg + " checkstyle-metadata.xml requires a parent for "
+ internalName, parentAttribute);
- Assert.assertEquals(packge + " checkstyle-metadata.xml requires a valid parent for "
+ Assert.assertEquals(pkg + " checkstyle-metadata.xml requires a valid parent for "
+ internalName, "TreeWalker", parentAttribute.getTextContent());
final Set children = XmlUtil.getChildrenElements(rule);
- validateEclipseCsMetaXmlFileRule(packge, module, children);
+ validateEclipseCsMetaXmlFileRule(pkg, module, children);
}
}
- private static void validateEclipseCsMetaXmlFileRule(String packge, Class> module,
+ private static void validateEclipseCsMetaXmlFileRule(String pkg, Class> module,
Set children) throws Exception {
final String moduleName = module.getSimpleName();
final Set properties = getFinalProperties(module);
@@ -261,41 +261,41 @@ private static void validateEclipseCsMetaXmlFileRule(String packge, Class> mod
case "alternative-name":
final Node internalNameNode = attributes.getNamedItem("internal-name");
- Assert.assertNotNull(packge
+ Assert.assertNotNull(pkg
+ " checkstyle-metadata.xml must contain an internal name for "
+ moduleName, internalNameNode);
final String internalName = internalNameNode.getTextContent();
- Assert.assertEquals(packge
+ Assert.assertEquals(pkg
+ " checkstyle-metadata.xml requires a valid internal-name for "
+ moduleName, module.getName(), internalName);
break;
case "description":
Assert.assertEquals(
- packge + " checkstyle-metadata.xml requires a valid description for "
+ pkg + " checkstyle-metadata.xml requires a valid description for "
+ moduleName, "%" + moduleName + ".desc",
child.getTextContent());
break;
case "property-metadata":
final String propertyName = attributes.getNamedItem("name").getTextContent();
- Assert.assertTrue(packge
+ Assert.assertTrue(pkg
+ " checkstyle-metadata.xml has an unknown parameter for "
+ moduleName + ": " + propertyName, properties.remove(propertyName));
final Node firstChild = child.getFirstChild().getNextSibling();
- Assert.assertNotNull(packge
+ Assert.assertNotNull(pkg
+ " checkstyle-metadata.xml requires atleast one child for "
+ moduleName + ", " + propertyName, firstChild);
Assert.assertEquals(
- packge
+ pkg
+ " checkstyle-metadata.xml should have a description for the "
+ "first child of "
+ moduleName + ", " + propertyName, "description",
firstChild.getNodeName());
- Assert.assertEquals(packge
+ Assert.assertEquals(pkg
+ " checkstyle-metadata.xml requires a valid description for "
+ moduleName + ", " + propertyName, "%" + moduleName + "."
+ propertyName,
@@ -304,57 +304,57 @@ private static void validateEclipseCsMetaXmlFileRule(String packge, Class> mod
case "message-key":
final String key = attributes.getNamedItem("key").getTextContent();
- Assert.assertTrue(packge
+ Assert.assertTrue(pkg
+ " checkstyle-metadata.xml has an unknown message for "
+ moduleName + ": " + key, messages.remove(key));
break;
default:
- Assert.fail(packge + " checkstyle-metadata.xml unknown node for " + moduleName
+ Assert.fail(pkg + " checkstyle-metadata.xml unknown node for " + moduleName
+ ": " + child.getNodeName());
break;
}
}
for (String property : properties) {
- Assert.fail(packge + " checkstyle-metadata.xml missing parameter for " + moduleName
+ Assert.fail(pkg + " checkstyle-metadata.xml missing parameter for " + moduleName
+ ": " + property);
}
for (String message : messages) {
- Assert.fail(packge + " checkstyle-metadata.xml missing message for " + moduleName
+ Assert.fail(pkg + " checkstyle-metadata.xml missing message for " + moduleName
+ ": " + message);
}
}
- private static void validateEclipseCsMetaPropFile(File file, String packge,
- Set> packgeModules) throws Exception {
+ private static void validateEclipseCsMetaPropFile(File file, String pkg,
+ Set> pkgModules) throws Exception {
Assert.assertTrue("'checkstyle-metadata.properties' must exist in eclipsecs in inside "
- + packge, file.exists());
+ + pkg, file.exists());
final Properties prop = new Properties();
prop.load(new FileInputStream(file));
final Set properties = new HashSet<>(Collections.list(prop.keys()));
- for (Class> module : packgeModules) {
+ for (Class> module : pkgModules) {
final String moduleName = module.getSimpleName();
- Assert.assertTrue(moduleName + " requires a name in eclipsecs properties " + packge,
+ Assert.assertTrue(moduleName + " requires a name in eclipsecs properties " + pkg,
properties.remove(moduleName + ".name"));
- Assert.assertTrue(moduleName + " requires a desc in eclipsecs properties " + packge,
+ Assert.assertTrue(moduleName + " requires a desc in eclipsecs properties " + pkg,
properties.remove(moduleName + ".desc"));
final Set moduleProperties = getFinalProperties(module);
for (String moduleProperty : moduleProperties) {
Assert.assertTrue(moduleName + " requires the property " + moduleProperty
- + " in eclipsecs properties " + packge,
+ + " in eclipsecs properties " + pkg,
properties.remove(moduleName + "." + moduleProperty));
}
}
for (Object property : properties) {
- Assert.fail("Unknown property found in eclipsecs properties " + packge + ": "
+ Assert.fail("Unknown property found in eclipsecs properties " + pkg + ": "
+ property);
}
}
diff --git a/sevntu-checks/src/test/resources-noncompilable/com/github/sevntu/checkstyle/checks/coding/InputRedundantReturnCheckTestNPE.java b/sevntu-checks/src/test/resources-noncompilable/com/github/sevntu/checkstyle/checks/coding/InputRedundantReturnCheckTestNPE.java
index 5ed0dd68f7..a92e677657 100644
--- a/sevntu-checks/src/test/resources-noncompilable/com/github/sevntu/checkstyle/checks/coding/InputRedundantReturnCheckTestNPE.java
+++ b/sevntu-checks/src/test/resources-noncompilable/com/github/sevntu/checkstyle/checks/coding/InputRedundantReturnCheckTestNPE.java
@@ -51,14 +51,14 @@ public static void outputDocument(String targetProvider, String uri, String requ
return;
}
- long ifModofiedSince = Integer.parseInt(request);
+ long ifModifiedSince = Integer.parseInt(request);
boolean gzip = Boolean.getBoolean(request);
String output = new String(response + gzip);
try {
- if (ifModofiedSince > 0) {
- if (!targetProvider.equals(uri + ifModofiedSince + output)) {
+ if (ifModifiedSince > 0) {
+ if (!targetProvider.equals(uri + ifModifiedSince + output)) {
response.concat("");
return;
}
diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputAvoidDefaultSerializableInInnerClassesCheck1.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputAvoidDefaultSerializableInInnerClassesCheck1.java
index 93b2314215..8829c477b5 100644
--- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputAvoidDefaultSerializableInInnerClassesCheck1.java
+++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputAvoidDefaultSerializableInInnerClassesCheck1.java
@@ -156,7 +156,7 @@ public void readObject(ObjectInputStream s)
}
}
- private class NoErrorForPartlial1 implements Serializable
+ private class NoErrorForPartial1 implements Serializable
{
private void readObject(ObjectInputStream s)
{
@@ -168,7 +168,7 @@ public int writeObject(ObjectOutputStream s)
}
}
- private class ErrorForPartlial implements Serializable //error
+ private class ErrorForPartial implements Serializable //error
{
private final int readObject(ObjectInputStream s)
{
diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputAvoidHidingCauseExceptionCheck.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputAvoidHidingCauseExceptionCheck.java
index 2b072f4ecf..51bc063a75 100644
--- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputAvoidHidingCauseExceptionCheck.java
+++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputAvoidHidingCauseExceptionCheck.java
@@ -20,12 +20,12 @@ public void Simple()
catch (IllegalStateException e) {
//your code
- throw new RuntimeException("Runtime Ecxeption!"); // !
+ throw new RuntimeException("Runtime Exception!"); // !
}
catch (java.lang.ArithmeticException e) {
//your code
- throw new RuntimeException("Runtime Ecxeption!", e);
+ throw new RuntimeException("Runtime Exception!", e);
}
catch (RuntimeException e) {
@@ -62,14 +62,14 @@ public void Stronger()
x = !!!!!!!!false & !!!!!!!!true;
double kkk = Math.pow(5, 25555555);
int ee = (int) kkk;
- throw new RuntimeException("Runtime Ecxeption!"); // !
+ throw new RuntimeException("Runtime Exception!"); // !
}
}
catch (java.lang.ArithmeticException e) {
int []err = new int [50];
if (err[51]==0) { err[999]++; }
- throw new RuntimeException("Runtime Ecxeption!", e);
+ throw new RuntimeException("Runtime Exception!", e);
}
catch (RuntimeException e) {
diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputCustomDeclarationOrderCheck.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputCustomDeclarationOrderCheck.java
index 21f8fc4f5d..c46b3524be 100644
--- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputCustomDeclarationOrderCheck.java
+++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputCustomDeclarationOrderCheck.java
@@ -77,7 +77,7 @@ private void innerTest1() {
private static class Test {
private abstract static class AbstractTest1 {
}
- public abstract class AbstractrTest2 {
+ public abstract class AbstractTest2 {
}
}
diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck27.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck27.java
index 55ba8b2e18..5b5fdaeeae 100644
--- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck27.java
+++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck27.java
@@ -44,7 +44,7 @@ class Child27 extends Base27
void init()
{
- System.out.println("Overrriden init");
+ System.out.println("Overridden init");
}
void overrideMe(String aString)
diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputForbidWildcardAsReturnTypeCheck.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputForbidWildcardAsReturnTypeCheck.java
index 9da35e4f62..b96447d850 100644
--- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputForbidWildcardAsReturnTypeCheck.java
+++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputForbidWildcardAsReturnTypeCheck.java
@@ -4,7 +4,7 @@
import java.util.Comparator; import java.util.List;
import java.util.Map;
import java.util.ArrayList;
-class Wildscards
+class Wildcards
{
public List super T> met1()
{
From 96e27cd4343d2ee40edae248a08354883090fd80 Mon Sep 17 00:00:00 2001
From: Roman Ivanov
Date: Wed, 4 Apr 2018 06:01:47 -0700
Subject: [PATCH 168/208] config: bump checkstyle version
---
sevntu-checks/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml
index 45b5602f0e..097246993e 100644
--- a/sevntu-checks/pom.xml
+++ b/sevntu-checks/pom.xml
@@ -16,7 +16,7 @@
iso-8859-1
- 8.8
+ 8.9https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.eclipse-cs.version}/config/checkstyle_checks.xml2.17RELEASE
From 54d32710710b69dd6d30811b535833d9a39de3b9 Mon Sep 17 00:00:00 2001
From: Josh Soref
Date: Tue, 27 Mar 2018 05:41:04 +0000
Subject: [PATCH 169/208] spelling: complicated
---
.../checks/coding/checkstyle-metadata.properties | 6 +++---
.../checks/design/checkstyle-metadata.properties | 2 +-
.../coding/CustomDeclarationOrderCheck.java | 2 +-
.../ReturnBooleanFromTernaryCheckTest.java | 16 ++++++++--------
4 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/coding/checkstyle-metadata.properties b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/coding/checkstyle-metadata.properties
index ab56154aa9..79c572c003 100755
--- a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/coding/checkstyle-metadata.properties
+++ b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/coding/checkstyle-metadata.properties
@@ -100,10 +100,10 @@ MultipleStringLiteralsExtendedCheck.desc = Checks for multiple occurrences of th
MultipleStringLiteralsExtendedCheck.ignoreOccurrenceContext = Token type names where duplicate strings are ignored even if they don't match ignoredStringsRegexp. This allows you to exclude syntactical contexts like Annotations or static initializers from the check.
MultipleStringLiteralsExtendedCheck.ignoreStringsRegexp = Regexp pattern for ignored strings (with quotation marks)
MultipleStringLiteralsExtendedCheck.name = Multiple String Literals Extended
-MultipleStringLiteralsExtendedCheck.highlightAllDuplicates = Check to highlight all dublicates
+MultipleStringLiteralsExtendedCheck.highlightAllDuplicates = Check to highlight all duplicates
TernaryPerExpressionCountCheck.name = Ternary Per Expression Count
-TernaryPerExpressionCountCheck.desc = Restricts the number of ternary operators in expression to a specific limit.
Rationale: This Check helps to improve code readability by pointing developer on expressions which contain more than user-defined count of ternary operators.
It points to complicated ternary expressions. Reason: - Complicated ternary expressions are not easy to read. - Complicated ternary expressions could lead to ambiguous result if user does not know Java's operators priority well, e.g.:
Output for code above is "D", but more obvious would be "BC". Check has following properties:
maxTernaryPerExpressionCount - limit of ternary operators perexpression
ignoreTernaryOperatorsInBraces - if true Check will ignore ternary operators in braces (braces explicitly set priority level)
ignoreIsolatedTernaryOnLine - if true Check will ignore one line ternary operators, if only it is places in line alone.
Options ignoreTernaryOperatorsInBraces and ignoreIsolatedTernaryOnLine can make Check less strict, e.g.: Using ignoreTernaryOperatorsInBraces option (value = true) does not put violation on code below:
When using ignoreIsolatedTernaryOnLine (value = true), even without ignoreTernaryOperatorsInBraces option Check won't warn on code below:
int a = (d == 5) ? d : f + ((d == 6) ? g : k);
@author Aleksey Nesterenko
+TernaryPerExpressionCountCheck.desc = Restricts the number of ternary operators in expression to a specific limit.
Rationale: This Check helps to improve code readability by pointing developer on expressions which contain more than user-defined count of ternary operators.
It points to complicated ternary expressions. Reason: - Complicated ternary expressions are not easy to read. - Complicated ternary expressions could lead to ambiguous result if user does not know Java's operators priority well, e.g.:
Output for code above is "D", but more obvious would be "BC". Check has following properties:
maxTernaryPerExpressionCount - limit of ternary operators per expression
ignoreTernaryOperatorsInBraces - if true Check will ignore ternary operators in braces (braces explicitly set priority level)
ignoreIsolatedTernaryOnLine - if true Check will ignore one line ternary operators, if only it is places in line alone.
Options ignoreTernaryOperatorsInBraces and ignoreIsolatedTernaryOnLine can make Check less strict, e.g.: Using ignoreTernaryOperatorsInBraces option (value = true) does not put violation on code below:
When using ignoreIsolatedTernaryOnLine (value = true), even without ignoreTernaryOperatorsInBraces option Check won't warn on code below:
int a = (d == 5) ? d : f + ((d == 6) ? g : k);
@author Aleksey Nesterenko
TernaryPerExpressionCountCheck.maxTernaryPerExpressionCount = Maximum number of ternary operators in expression
TernaryPerExpressionCountCheck.ignoreTernaryOperatorsInBraces = Ignore ternary operators in expression in case if priority level is set explicitly
TernaryPerExpressionCountCheck.ignoreIsolatedTernaryOnLine = Ignore ternary operators in expression in case if ternary operator is isolated in line
@@ -171,7 +171,7 @@ UselessSingleCatchCheck.desc =
Checks for the presence of useless single catc
UselessSingleCatchCheck.name = Useless single catch check
UselessSuperCtorCallCheck.name = Useless super constructor call
-UselessSuperCtorCallCheck.desc =
Checks for useless "super()" calls in ctors.
"super()" call could be considered by Check as "useless" in two cases:
Case 1. no-argument "super()" is called from class ctor if class is not derived, for example:
class Dummy { Dummy() { super();
}
"super()" call is useless because class "Dummy" is not derived.
Case 2. no-argument "super()" is called without parameters from class ctor if class is derived, for example:
class Derived extends Base { Derived() { super(); } }
Java compiler automatically inserts a call to the no-args constructor of the super class, so there is no need to call super ctor explicitly. Check has options "allowCallToNoArgsSuperCtor" and "allowCallToNoArgsSuperCtorIfMultiplePublicCtor" to adjust check behavior for such cases(see Check`s options description for details).
Check has following options:
"allowCallToNoArgsSuperCtor" - if this option set to true, Check will not generate violations when "super()" called inside derived class. This option defaults to "false". If for example this option set to "true", then Check will not generate violation for cases like following:
class Base { public Base() { } }
class Derived extends Base { public Derived() { super(); } }
"allowCallToNoArgsSuperCtorIfMultiplePublicCtor" - if this option set to "true",then Check will not generate violation when "super()" called inside class ctor when class has multiple public ctors(however, setting this option to"true" will not prevent Check from logging violation if class does not extend anything). This option defaults to "false". This option may be usefull for cases in which class`s ctors just forward its arguments to super ctors, thus removing "super()" in this case will make default ctors look not like others.For example:
class Base { public Base() { }
public Base(int i) { } }
class Derived extends Base { public Derived() { super(); // this "super()" will not be considered useless if option is set to true, // because "Derived" has multiple public ctors. }
public Derived(int i) { super(i); // this "super()" will not be considered useless if option is set to true, // because "Derived" has multiple public ctors. } }
class NotDerived{ public NotDerived() { super(); // this "super()" will be considered useless regardless of option value, // because "NotDerived" does not extend anything. } public NotDerived(int i) { super(); // this "super()" will be considered useless regardless of option value, // because "NotDerived" does not extend anything. } }
"super()" call could be considered by Check as "useless" in two cases:
Case 1. no-argument "super()" is called from class ctor if class is not derived, for example:
class Dummy { Dummy() { super();
}
"super()" call is useless because class "Dummy" is not derived.
Case 2. no-argument "super()" is called without parameters from class ctor if class is derived, for example:
class Derived extends Base { Derived() { super(); } }
Java compiler automatically inserts a call to the no-args constructor of the super class, so there is no need to call super ctor explicitly. Check has options "allowCallToNoArgsSuperCtor" and "allowCallToNoArgsSuperCtorIfMultiplePublicCtor" to adjust check behavior for such cases(see Check`s options description for details).
Check has following options:
"allowCallToNoArgsSuperCtor" - if this option set to true, Check will not generate violations when "super()" called inside derived class. This option defaults to "false". If for example this option set to "true", then Check will not generate violation for cases like following:
class Base { public Base() { } }
class Derived extends Base { public Derived() { super(); } }
"allowCallToNoArgsSuperCtorIfMultiplePublicCtor" - if this option set to "true",then Check will not generate violation when "super()" called inside class ctor when class has multiple public ctors(however, setting this option to"true" will not prevent Check from logging violation if class does not extend anything). This option defaults to "false". This option may be useful for cases in which class`s ctors just forward its arguments to super ctors, thus removing "super()" in this case will make default ctors look not like others.For example:
class Base { public Base() { }
public Base(int i) { } }
class Derived extends Base { public Derived() { super(); // this "super()" will not be considered useless if option is set to true, // because "Derived" has multiple public ctors. }
public Derived(int i) { super(i); // this "super()" will not be considered useless if option is set to true, // because "Derived" has multiple public ctors. } }
class NotDerived{ public NotDerived() { super(); // this "super()" will be considered useless regardless of option value, // because "NotDerived" does not extend anything. } public NotDerived(int i) { super(); // this "super()" will be considered useless regardless of option value, // because "NotDerived" does not extend anything. } }
@author Zuy Alexey
UselessSuperCtorCallCheck.allowCallToNoArgsSuperCtor = Allow calls to no-arguments super constructor from derived class.
UselessSuperCtorCallCheck.allowCallToNoArgsSuperCtorIfMultiplePublicCtor = Allow calls to no-arguments super constructor from derived class if it has multiple public constructors.
diff --git a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/design/checkstyle-metadata.properties b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/design/checkstyle-metadata.properties
index ecabd4ae42..3fb1fc557d 100644
--- a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/design/checkstyle-metadata.properties
+++ b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/design/checkstyle-metadata.properties
@@ -15,7 +15,7 @@ ChildBlockLengthCheck.maxChildBlockPercentage = Maximum percentage ratio between
ChildBlockLengthCheck.ignoreBlockLinesCount = Maximum number of lines of which block body may consist to be skipped by check.
NoMainMethodInAbstractClassCheck.name = No Main Method In Abstract Class
-NoMainMethodInAbstractClassCheck.desc = Forbids main methods in abstract classes. Rationale: existance of 'main' method can mislead a developer to consider this class as a ready-to-use implementation.
+NoMainMethodInAbstractClassCheck.desc = Forbids main methods in abstract classes. Rationale: existence of 'main' method can mislead a developer to consider this class as a ready-to-use implementation.
ForbidWildcardAsReturnTypeCheck.name = Forbid Wildcard As Return Type
ForbidWildcardAsReturnTypeCheck.desc = Prevents using wildcards as return type of methods.
"Do not use wildcard types as return types. Rather than providing additional flexibility for your users, it would force them to use wildcard types in client code. Properly used, wildcard types are nearly invisible to users of a class. They cause methods to accept the parameters they should accept and reject those they should reject. If the user of a class has to think about wildcard types, there is probably something wrong with the class\u2019s API."
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheck.java
index 727a75d50f..c50ce89f69 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheck.java
@@ -1318,7 +1318,7 @@ public Map getWrongOrderedGettersSetters() {
/**
* Compare order of getters and setters. Order should be like "getX; setX; getY; setY; ...".
* If it is wrong order, then wrong ordered setters and getters will be returned as map.
- * @param allGettersSetters collection of all gettter and setters
+ * @param allGettersSetters collection of all getter and setters
* @param index index from upper loo
* @return Map with setter AST as key and getter AST as value.
*/
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnBooleanFromTernaryCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnBooleanFromTernaryCheckTest.java
index 31b174c71d..d25217bf44 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnBooleanFromTernaryCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/ReturnBooleanFromTernaryCheckTest.java
@@ -28,7 +28,7 @@
public class ReturnBooleanFromTernaryCheckTest extends AbstractModuleTestSupport {
- private final String warninigMessage = getCheckMessage(MSG_KEY);
+ private final String warningMessage = getCheckMessage(MSG_KEY);
@Override
protected String getPackageLocation() {
@@ -40,13 +40,13 @@ public void testDefault() throws Exception {
final DefaultConfiguration checkConfig =
createModuleConfig(ReturnBooleanFromTernaryCheck.class);
final String[] expected = {
- "6:35: " + warninigMessage,
- "7:38: " + warninigMessage,
- "8:38: " + warninigMessage,
- "9:35: " + warninigMessage,
- "9:43: " + warninigMessage,
- "10:28: " + warninigMessage,
- "11:27: " + warninigMessage,
+ "6:35: " + warningMessage,
+ "7:38: " + warningMessage,
+ "8:38: " + warningMessage,
+ "9:35: " + warningMessage,
+ "9:43: " + warningMessage,
+ "10:28: " + warningMessage,
+ "11:27: " + warningMessage,
};
verify(checkConfig, getPath("InputReturnBooleanFromTernaryCheck.java"), expected);
}
From a162e96237db05bde11b5001f073c67b4a00399b Mon Sep 17 00:00:00 2001
From: Josh Soref
Date: Tue, 27 Mar 2018 05:41:04 +0000
Subject: [PATCH 170/208] Issue #656: CustomDeclarationOrderCheck: Correct
spelling of DeclareAnonClassField
---
.../checks/coding/checkstyle-metadata.properties | 2 +-
.../coding/CustomDeclarationOrderCheck.java | 8 ++++----
.../coding/CustomDeclarationOrderCheckTest.java | 16 ++++++++--------
3 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/coding/checkstyle-metadata.properties b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/coding/checkstyle-metadata.properties
index 79c572c003..e7efd317dd 100755
--- a/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/coding/checkstyle-metadata.properties
+++ b/eclipsecs-sevntu-plugin/src/com/github/sevntu/checkstyle/checks/coding/checkstyle-metadata.properties
@@ -25,7 +25,7 @@ AvoidModifiersForTypesCheck.forbiddenClassesRegexpProtected = The regexp defines
AvoidModifiersForTypesCheck.forbiddenClassesRegexpPublic = The regexp defines the names of classes, that could not have 'public' modifier.
CustomDeclarationOrderCheck.name = Custom Declaration Order
-CustomDeclarationOrderCheck.desc =
Checks that the parts of a class(main, nested, member inner) declaration appear in the rules order set by user using regular expressions.
The check forms line which consists of class member annotations, modifiers,type and name from your code and compares it with your RegExp.
The rule consists of:*
ClassMember(RegExp)
To set class order use the following notation of the class members (case insensitive):
"Field" to denote the Fields
"DeclareAnnonClassField" to denote the fields keeping objects of anonymous classes
"Ctor" to denote the Constructors
"Method" to denote the Methods
"GetterSetter" to denote the group of getter and setter methods
Use separator ' ', '.', '\s' between declaration in the RegExp. Whitespace should be added after each modifier.
Example: Field(public .*final .*) Field(public final .*) Field(public\s*final .*)
NOTICE!
It is important to write exact order of modifiers in rules. So ruleField(public final) does not match to final public value;.ModifierOrderCheckis recommended to use.
If you set empty RegExp e.g. Field(), it means that class member doesn't have modifiers(default modifier) and checking the type and name of member doesn't occur.
Between the declaration of a array and generic can't be whitespaces.E.g.: ArrayList<String[]> someName
Use the separator '###' between the class declarations.
For Example:
Field(private static final long serialVersionUID) ###Field(public static final .*) ### Field(.*private .*) ### Ctor(.*) ###GetterSetter(.*) ### Method(.*public .*final .*|@Ignore.*public .*) ###Method(public static .*(final|(new|edit|create).*).*) ###InnerClass(public abstract .*) ### InnerInterface(.*) ### InnerEnum(.*)
*
What is group of getters and setters(GetterSetter)?
It is ordered sequence of getters and setters like:
public int getValue() { log.info("Getting value"); return value;} *public void setValue(int newValue) { value = newValue;} *public Object getObj() { return obj;} *public void setObj(Object obj) { if (obj != null) { this.obj = obj; } else { throw new IllegalArgumentException("Null value"); }} *...
Getter is public method that returns class field. Name of getter should be'getFieldName' in camel case.
Setter is public method with one parameter that assigns this parameter to class field. Name of setter should be 'setFieldName' in camel case.
Setter of field X should be right after getter of field X.
Use separator ' ', '.', '\s' between declaration in the RegExp. Whitespace should be added after each modifier.
Example: Field(public .*final .*) Field(public final .*) Field(public\s*final .*)
NOTICE!
It is important to write exact order of modifiers in rules. So ruleField(public final) does not match to final public value;.ModifierOrderCheckis recommended to use.
If you set empty RegExp e.g. Field(), it means that class member doesn't have modifiers(default modifier) and checking the type and name of member doesn't occur.
Between the declaration of a array and generic can't be whitespaces.E.g.: ArrayList<String[]> someName
Use the separator '###' between the class declarations.
For Example:
Field(private static final long serialVersionUID) ###Field(public static final .*) ### Field(.*private .*) ### Ctor(.*) ###GetterSetter(.*) ### Method(.*public .*final .*|@Ignore.*public .*) ###Method(public static .*(final|(new|edit|create).*).*) ###InnerClass(public abstract .*) ### InnerInterface(.*) ### InnerEnum(.*)
*
What is group of getters and setters(GetterSetter)?
It is ordered sequence of getters and setters like:
public int getValue() { log.info("Getting value"); return value;} *public void setValue(int newValue) { value = newValue;} *public Object getObj() { return obj;} *public void setObj(Object obj) { if (obj != null) { this.obj = obj; } else { throw new IllegalArgumentException("Null value"); }} *...
Getter is public method that returns class field. Name of getter should be'getFieldName' in camel case.
Setter is public method with one parameter that assigns this parameter to class field. Name of setter should be 'setFieldName' in camel case.
Setter of field X should be right after getter of field X.
*@author Danil Lopatin@author Baratali Izmailov
CustomDeclarationOrderCheck.fieldPrefix = Prefix of field's name.
CustomDeclarationOrderCheck.customDeclarationOrder = Regular expression, which sets the order of the parts of a class(main, nested, member inner).
CustomDeclarationOrderCheck.caseSensitive = Set false to ignore case.
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheck.java
index c50ce89f69..4d11850ab7 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheck.java
@@ -53,7 +53,7 @@
* insensitive):
*
*
"Field" to denote the Fields
- *
"DeclareAnnonClassField" to denote the fields keeping objects of anonymous classes
+ *
"DeclareAnonClassField" to denote the fields keeping objects of anonymous classes
*
"Ctor" to denote the Constructors
*
"Method" to denote the Methods
*
"GetterSetter" to denote the group of getter and setter methods
- * But in Java, in IF condition it is impossible to use assignment,
- * so that habit become unnecessary and do damage readability of code.
+ * If comparing values, C(C++) developers prefer to put the constant first in the equality check,
+ * to prevent situations of assignment rather than equality checking. It is easy to write "="
+ * instead of "==", and no compile error will be produced but condition will work in a different
+ * way then intended. However, in Java it is impossible to use assignment inside the
+ * if condition, so that habit becomes unnecessary and does damage to the readability
+ * of the code.
*
*
*
- * In C(C++), comparison for null is tricky, and it is easy to write "=" instead of "==",
- * and no complication error will be but condition will work in different way
+ * This check was extended to include all equality checks like ">", ">=", "<", "<="
+ * for users who prefer constants always be on the right-hand side for any condition.
*
* This check prevents the placement of local variables and fields after calling
- * methods in '&&' and '||' conditions.
+ * methods and instanceof in '&&' and '||' conditions.
*
*
* For example: if(getProperty() && property) ==> if(property && getProperty()),
@@ -76,8 +76,21 @@ public void visitToken(DetailAST detailAST) {
*/
private static boolean needOptimization(DetailAST logicNode) {
final DetailAST secondOperand = getSecondOperand(logicNode);
- return !secondOperand.branchContains(TokenTypes.METHOD_CALL)
- && logicNode.branchContains(TokenTypes.METHOD_CALL);
+ final boolean firstInstanceOf = logicNode.branchContains(TokenTypes.LITERAL_INSTANCEOF);
+ final boolean secondTypeCast = secondOperand.branchContains(TokenTypes.TYPECAST);
+ final boolean result;
+
+ if (firstInstanceOf && secondTypeCast) {
+ result = false;
+ }
+ else {
+ result = !secondOperand.branchContains(TokenTypes.METHOD_CALL)
+ && !secondOperand.branchContains(TokenTypes.LITERAL_INSTANCEOF)
+ && (firstInstanceOf
+ || logicNode.branchContains(TokenTypes.METHOD_CALL));
+ }
+
+ return result;
}
/**
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/LogicConditionNeedOptimizationCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/LogicConditionNeedOptimizationCheckTest.java
index c844d3baec..c87d4a56ff 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/LogicConditionNeedOptimizationCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/LogicConditionNeedOptimizationCheckTest.java
@@ -55,6 +55,11 @@ public void test() throws Exception {
"69:50: " + getCheckMessage(MSG_KEY, "&&", 69, 35),
"72:34: " + getCheckMessage(MSG_KEY, "&&", 72, 19),
"93:34: " + getCheckMessage(MSG_KEY, "||", 93, 33),
+ "103:35: " + getCheckMessage(MSG_KEY, "&&", 103, 34),
+ "104:46: " + getCheckMessage(MSG_KEY, "&&", 104, 45),
+ "105:47: " + getCheckMessage(MSG_KEY, "&&", 105, 46),
+ "106:47: " + getCheckMessage(MSG_KEY, "||", 106, 46),
+ "110:33: " + getCheckMessage(MSG_KEY, "&&", 110, 32),
};
verify(checkConfig, getPath("InputLogicConditionNeedOptimizationCheck.java"), expected);
}
diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputLogicConditionNeedOptimizationCheck.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputLogicConditionNeedOptimizationCheck.java
index a2ca396be6..fe0f8fde86 100644
--- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputLogicConditionNeedOptimizationCheck.java
+++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputLogicConditionNeedOptimizationCheck.java
@@ -93,4 +93,21 @@ private void methodInParentheses(){
found = (lst.remove(elem)) || found;
found = found || (lst.remove(elem));
}
+
+ private void instanceOf() {
+ String s = "";
+ Object o = null;
+ if (("Test".equals(s)) && (o instanceof String)) {}
+ if ((o instanceof String)) {}
+ if (o==null && (o instanceof String)) {}
+ if ((o instanceof String) && o==null ) {} // violation
+ if (o==null && (o instanceof String) && o!=null) {} // violation
+ if (o==null && ((o instanceof String) && o!=null)) {} // violation
+ if (o==null && ((o instanceof String) || o!=null)) {} // violation
+ if (o==null && (o!=null && (o instanceof String))) {}
+ if (o instanceof InputLogicConditionNeedOptimizationCheck
+ && ((InputLogicConditionNeedOptimizationCheck) o).field1 == true) {}
+ if (o instanceof String && o != null && ((String) o).length() > 0) {} // violation
+ if (o != null && o instanceof String && ((String) o).length() > 0) {}
+ }
}
From 0edf2acf9c96b5e1c9896aa27c2646a77ff70ccf Mon Sep 17 00:00:00 2001
From: rnveach
Date: Fri, 8 Jun 2018 16:26:33 -0400
Subject: [PATCH 191/208] Issue #683: fixed parenthesis handling in
LogicConditionNeedOptimization
---
.../LogicConditionNeedOptimizationCheck.java | 102 +++++++++++++++---
...gicConditionNeedOptimizationCheckTest.java | 2 +
...utLogicConditionNeedOptimizationCheck.java | 8 ++
3 files changed, 99 insertions(+), 13 deletions(-)
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/LogicConditionNeedOptimizationCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/LogicConditionNeedOptimizationCheck.java
index c0709599f9..96839aae1e 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/LogicConditionNeedOptimizationCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/LogicConditionNeedOptimizationCheck.java
@@ -42,6 +42,11 @@ public class LogicConditionNeedOptimizationCheck extends AbstractCheck {
*/
public static final String MSG_KEY = "logic.condition.need.optimization";
+ /** Integer for the 3rd position. */
+ private static final int THIRD_POSITION = 3;
+ /** Number of operands positions in start/stop array. */
+ private static final int OPERAND_SIZE = 4;
+
@Override
public int[] getDefaultTokens() {
return new int[] {TokenTypes.LAND, TokenTypes.LOR };
@@ -75,19 +80,19 @@ public void visitToken(DetailAST detailAST) {
* @return - boolean variable
*/
private static boolean needOptimization(DetailAST logicNode) {
- final DetailAST secondOperand = getSecondOperand(logicNode);
- final boolean firstInstanceOf = logicNode.branchContains(TokenTypes.LITERAL_INSTANCEOF);
- final boolean secondTypeCast = secondOperand.branchContains(TokenTypes.TYPECAST);
+ final DetailAST[] operands = getOperands(logicNode);
+ final boolean firstInstanceOf = branchContains(operands, 1, TokenTypes.LITERAL_INSTANCEOF);
+ final boolean secondTypeCast = branchContains(operands, 2, TokenTypes.TYPECAST);
final boolean result;
if (firstInstanceOf && secondTypeCast) {
result = false;
}
else {
- result = !secondOperand.branchContains(TokenTypes.METHOD_CALL)
- && !secondOperand.branchContains(TokenTypes.LITERAL_INSTANCEOF)
+ result = !branchContains(operands, 2, TokenTypes.METHOD_CALL)
+ && !branchContains(operands, 2, TokenTypes.LITERAL_INSTANCEOF)
&& (firstInstanceOf
- || logicNode.branchContains(TokenTypes.METHOD_CALL));
+ || branchContains(operands, 1, TokenTypes.METHOD_CALL));
}
return result;
@@ -95,17 +100,88 @@ private static boolean needOptimization(DetailAST logicNode) {
/**
*
- * Return second operand of current logic operator.
+ * Return operands of current logic operator.
*
* @param logicNode - current logic operator
- * @return second operand
+ * @return operands
+ */
+ private static DetailAST[] getOperands(DetailAST logicNode) {
+ final DetailAST[] results = new DetailAST[OPERAND_SIZE];
+ DetailAST node = logicNode.getFirstChild();
+
+ // start of first
+ results[0] = node;
+
+ int parenthesis = 0;
+
+ do {
+ if (node.getType() == TokenTypes.LPAREN) {
+ parenthesis++;
+ }
+ else {
+ if (node.getType() == TokenTypes.RPAREN) {
+ parenthesis--;
+ }
+ if (parenthesis == 0) {
+ // end of first
+ results[1] = node;
+ }
+ }
+
+ node = node.getNextSibling();
+ } while (parenthesis > 0);
+
+ // start of second
+ results[2] = node;
+ results[THIRD_POSITION] = logicNode.getLastChild();
+
+ return results;
+ }
+
+ /**
+ * Checks if the node range contains a token of the provided type.
+ * @param operands the list operands in order of start and stop
+ * @param setNumber to retrieve the 1st or 2nd operand
+ * @param type a TokenType
+ * @return true if and only if the node range
+ * contains a token of type {@code type}.
*/
- private static DetailAST getSecondOperand(DetailAST logicNode) {
- DetailAST child = logicNode.getLastChild();
- if (child.getType() == TokenTypes.RPAREN) {
- child = child.getPreviousSibling();
+ private static boolean branchContains(DetailAST[] operands, int setNumber, int type) {
+ final boolean result;
+
+ if (setNumber == 1) {
+ result = branchContains(operands[0], operands[1], type);
}
- return child;
+ else {
+ result = branchContains(operands[2], operands[THIRD_POSITION], type);
+ }
+
+ return result;
+ }
+
+ /**
+ * Checks if the node range contains a token of the provided type.
+ * @param start the token to start checking with (inclusive)
+ * @param end the token to end with (inclusive)
+ * @param type a TokenType
+ * @return true if and only if the node range
+ * contains a token of type {@code type}.
+ */
+ private static boolean branchContains(DetailAST start, DetailAST end, int type) {
+ boolean result = false;
+ DetailAST current = start;
+
+ while (true) {
+ result = current.branchContains(type);
+
+ if (current == end || result) {
+ break;
+ }
+
+ current = current.getNextSibling();
+ }
+
+ return result;
}
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/LogicConditionNeedOptimizationCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/LogicConditionNeedOptimizationCheckTest.java
index c87d4a56ff..b934a057a5 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/LogicConditionNeedOptimizationCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/LogicConditionNeedOptimizationCheckTest.java
@@ -60,6 +60,8 @@ public void test() throws Exception {
"105:47: " + getCheckMessage(MSG_KEY, "&&", 105, 46),
"106:47: " + getCheckMessage(MSG_KEY, "||", 106, 46),
"110:33: " + getCheckMessage(MSG_KEY, "&&", 110, 32),
+ "117:29: " + getCheckMessage(MSG_KEY, "&&", 117, 28),
+ "118:29: " + getCheckMessage(MSG_KEY, "&&", 118, 28),
};
verify(checkConfig, getPath("InputLogicConditionNeedOptimizationCheck.java"), expected);
}
diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputLogicConditionNeedOptimizationCheck.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputLogicConditionNeedOptimizationCheck.java
index fe0f8fde86..4c076bd784 100644
--- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputLogicConditionNeedOptimizationCheck.java
+++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputLogicConditionNeedOptimizationCheck.java
@@ -110,4 +110,12 @@ private void instanceOf() {
if (o instanceof String && o != null && ((String) o).length() > 0) {} // violation
if (o != null && o instanceof String && ((String) o).length() > 0) {}
}
+
+ private void complexConditions() {
+ String s = System.getProperty("s");
+ int i = 0;
+ if (((s.equals("1") && (i != 1))) ||
+ ((s.equals("2") && (i != 2)))) {}
+ if ("true".equals(s) || ((s.contains("test")))) {}
+ }
}
From 538d6c30b243720d38704dd4253222935b454885 Mon Sep 17 00:00:00 2001
From: rnveach
Date: Sat, 9 Jun 2018 11:43:38 -0400
Subject: [PATCH 192/208] Issue #687: fixed NPE with empty methods in
RedundantReturnCheck
---
.../checks/coding/RedundantReturnCheck.java | 1 +
.../checks/coding/RedundantReturnCheckTest.java | 12 ++++++++++++
...InputRedundantReturnCheckMethodInEmptyMethod.java | 11 +++++++++++
3 files changed, 24 insertions(+)
create mode 100644 sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRedundantReturnCheckMethodInEmptyMethod.java
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/RedundantReturnCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/RedundantReturnCheck.java
index fe09d1d494..43aeddbabf 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/RedundantReturnCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/RedundantReturnCheck.java
@@ -149,6 +149,7 @@ public void visitToken(DetailAST ast) {
*/
private boolean ignoreLonelyReturn(DetailAST objectBlockAst) {
return allowReturnInEmptyMethodsAndConstructors
+ && objectBlockAst.getFirstChild() != null
&& objectBlockAst.getFirstChild().getType()
== TokenTypes.LITERAL_RETURN;
}
diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/RedundantReturnCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/RedundantReturnCheckTest.java
index f05ffc1c9d..012a8549a7 100644
--- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/RedundantReturnCheckTest.java
+++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/RedundantReturnCheckTest.java
@@ -113,6 +113,18 @@ public void testForNullPointerExceptionsInInterface()
verify(checkConfig, getPath("InputRedundantReturnCheckMethodInInterface.java"), expected);
}
+ @Test
+ public void testForNullPointerExceptionsInEmptyMethod()
+ throws Exception {
+ final DefaultConfiguration checkConfig = createModuleConfig(RedundantReturnCheck.class);
+ checkConfig.addAttribute("allowReturnInEmptyMethodsAndConstructors",
+ "true");
+
+ final String[] expected = {};
+
+ verify(checkConfig, getPath("InputRedundantReturnCheckMethodInEmptyMethod.java"), expected);
+ }
+
@Test
public void testSomeFalsePositiveCase()
throws Exception {
diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRedundantReturnCheckMethodInEmptyMethod.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRedundantReturnCheckMethodInEmptyMethod.java
new file mode 100644
index 0000000000..28356f5420
--- /dev/null
+++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRedundantReturnCheckMethodInEmptyMethod.java
@@ -0,0 +1,11 @@
+package com.github.sevntu.checkstyle.checks.coding;
+
+public class InputRedundantReturnCheckMethodInEmptyMethod {
+ public native void method();
+}
+abstract class InputRedundantReturnCheckMethodInEmptyMethod2 {
+ public abstract void method();
+}
+interface InputRedundantReturnCheckMethodInEmptyMethod3 {
+ void method();
+}
From 2dd143800fa608889e5f1d04d5ef55a3b7bc9044 Mon Sep 17 00:00:00 2001
From: rnveach
Date: Sat, 9 Jun 2018 13:29:37 -0400
Subject: [PATCH 193/208] config: added skip option to travis
---
.travis.yml | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index 791905f2fd..46fe1c6f7d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -64,6 +64,28 @@ matrix:
script:
- - eval $CMD
+ - SKIP_FILES1=".github|codeship-*|buddy.yml|appveyor.yml|circleci|distelli-manifest.yml"
+ - SKIP_FILES2="|fast-forward-merge.sh|LICENSE|LICENSE.apache20|README.md|release.sh|RIGHTS.antlr"
+ - SKIP_FILES3="|shippable.yml|shippable.sh|wercker.yml|wercker.sh|intellij-idea-inspections.xml"
+ - SKIP_FILES=$SKIP_FILES1$SKIP_FILES2$SKIP_FILES3
+ - |
+ if [[ $SKIP_CI != 'false' ]]; then
+ if [[ $(git diff --name-only HEAD HEAD~1 | grep -vE "$SKIP_FILES" \
+ | cat | wc -c | sed 's/^ *//' ) > 0 ]]; then
+ SKIP_CI="false"
+ else
+ SKIP_CI="true"
+ fi
+ fi
+ - echo "SKIP_CI="$SKIP_CI
+ - |
+ set -e
+ if [[ $SKIP_CI == 'false' ]];
+ then
+ eval $CMD;
+ echo "eval of CMD is completed"
+ else
+ echo "CI is skipped"
+ fi
after_success:
From 5bf365902c5557de6ec82cabdf375191da3eca70 Mon Sep 17 00:00:00 2001
From: rnveach
Date: Sat, 9 Jun 2018 14:06:45 -0400
Subject: [PATCH 194/208] config: added base of wercker yml
---
wercker.yml | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
create mode 100644 wercker.yml
diff --git a/wercker.yml b/wercker.yml
new file mode 100644
index 0000000000..bd4d76bd3c
--- /dev/null
+++ b/wercker.yml
@@ -0,0 +1,52 @@
+box: maven:3.5.2-jdk-8
+
+build:
+ steps:
+ - script:
+ name: setup maven local repo
+ code: |
+ export MAVEN_OPTS="-Dmaven.repo.local=${WERCKER_CACHE_DIR}"
+ mvn -version
+ echo "------"
+ du -hs ${WERCKER_CACHE_DIR}
+ echo "------"
+ du -hs ${WERCKER_CACHE_DIR}/* | sort -h
+
+ - script:
+ name: install groovy
+ code: |
+ if [ ! -d ${WERCKER_CACHE_DIR}/groovy ]; then
+ GROOVY_LINK="https://dl.bintray.com/groovy/maven/apache-groovy-binary-2.4.7.zip"
+ wget -O ${WERCKER_CACHE_DIR}/groovy.zip $GROOVY_LINK;
+ unzip ${WERCKER_CACHE_DIR}/groovy.zip -d ${WERCKER_CACHE_DIR};
+ mv ${WERCKER_CACHE_DIR}/groovy-2.4.7 ${WERCKER_CACHE_DIR}/groovy
+ fi
+ export GROOVY_HOME=${WERCKER_CACHE_DIR}/groovy
+ PATH=$GROOVY_HOME/bin:$PATH
+ groovy -v
+
+ - script:
+ name: Build Sevntu
+ code: |
+ SKIP_FILES1="appveyor.yml|codeship-*|buddy.yml|circleci|travis"
+ SKIP_FILES2="|shippable|sonar-|fast-forward-merge.sh|LICENSE|LICENSE.apache20"
+ SKIP_FILES3="|README.md|release.sh|RIGHTS.antlr|intellij-idea-inspections.xml"
+ SKIP_FILES4="|org.eclipse.jdt.core.prefs|distelli-manifest.yml|jsoref-spellchecker"
+ SKIP_FILES5="|check-only-javadoc-error.sh|eclipse-compiler-javac.sh|idea_inspection"
+ SKIP_FILES6="|test-spelling-unknown-words.sh"
+ SKIP_FILES=$SKIP_FILES1$SKIP_FILES2$SKIP_FILES3$SKIP_FILES4$SKIP_FILES5$SKIP_FILES6
+ export SKIP_CI=false;
+ if [[ $(git diff --name-only HEAD HEAD~1 | grep -vE "$SKIP_FILES" | cat | wc -c) > 0 ]];
+ then
+ SKIP_CI=false;
+ else
+ SKIP_CI=true;
+ fi
+ echo "SKIP_CI="$SKIP_CI
+ if [[ $SKIP_CI == 'false' ]]; then
+ cd sevntu-checks
+ mvn -e clean install -Pno-validations
+ cd ..
+ else
+ echo "build is skipped ..."
+ fi
From dd3f2dc56922111ccb88d380848500508c329ad6 Mon Sep 17 00:00:00 2001
From: rnveach
Date: Sat, 9 Jun 2018 15:51:38 -0400
Subject: [PATCH 195/208] Issue #691: added verification of contribution
checks-sevntu-error.xml
---
.ci/travis.sh | 14 ++++++++++++++
.travis.yml | 11 +++++++++++
2 files changed, 25 insertions(+)
diff --git a/.ci/travis.sh b/.ci/travis.sh
index 7637142550..fa5abbf353 100755
--- a/.ci/travis.sh
+++ b/.ci/travis.sh
@@ -59,6 +59,20 @@ sevntu-checks)
fi
;;
+all-sevntu-checks-contribution)
+ wget -q \
+ https://raw.githubusercontent.com/checkstyle/contribution/master/checkstyle-tester/checks-sevntu-error.xml
+ xmlstarlet sel --net --template -m .//module -v "@name" -n checks-sevntu-error.xml \
+ | grep -vE "Checker|TreeWalker|Filter|Holder" | grep -v "^$" \
+ | sed "s/com\.github\.sevntu\.checkstyle\.checks\..*\.//" \
+ | sort | uniq | sed "s/Check$//" > web.txt
+ xmlstarlet sel --net --template -m .//module -v "@name" -n sevntu-checks/sevntu-checks.xml \
+ | grep -vE "Checker|TreeWalker|Filter|Holder" | grep -v "^$" \
+ | sed "s/com\.github\.sevntu\.checkstyle\.checks\..*\.//" \
+ | sort | uniq | sed "s/Check$//" > file.txt
+ diff -u web.txt file.txt
+ ;;
+
checkstyle-regression)
git clone https://github.com/checkstyle/checkstyle
cd sevntu-checks
diff --git a/.travis.yml b/.travis.yml
index 46fe1c6f7d..ad00bba2ad 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,6 +5,11 @@ cache:
directories:
- ~/.m2
+addons:
+ apt:
+ packages:
+ - xmlstarlet
+
branches:
only:
- master
@@ -45,6 +50,12 @@ matrix:
- DESC="checks"
- CMD="./.ci/travis.sh sevntu-checks"
+ # Ensure that all sevntu checks are used in contribution
+ - jdk: oraclejdk8
+ env:
+ - DESC="All sevntu checks should be used in contribution"
+ - CMD="./.ci/travis.sh all-sevntu-checks-contribution"
+
# regression on checkstyle
- jdk: oraclejdk8
env:
From 8aea323d15265fb67f719acf59d0d01368cf8d6c Mon Sep 17 00:00:00 2001
From: rnveach
Date: Sat, 9 Jun 2018 14:15:25 -0400
Subject: [PATCH 196/208] Issue #644: added no exception testing to wercker
---
sevntu-checks/.ci/wercker.sh | 188 +++++++++++++++++++++++++++++++++++
wercker.yml | 108 ++++++++++++++++++++
2 files changed, 296 insertions(+)
create mode 100755 sevntu-checks/.ci/wercker.sh
diff --git a/sevntu-checks/.ci/wercker.sh b/sevntu-checks/.ci/wercker.sh
new file mode 100755
index 0000000000..218e0027cf
--- /dev/null
+++ b/sevntu-checks/.ci/wercker.sh
@@ -0,0 +1,188 @@
+#!/bin/bash
+# Attention, there is no "-x" to avoid problems on Wercker
+set -e
+
+function checkout_from {
+ CLONE_URL=$1
+ PROJECT=$(echo "$CLONE_URL" | sed -nE 's/.*\/(.*).git/\1/p')
+ mkdir -p .ci-temp
+ cd .ci-temp
+ if [ -d "$PROJECT" ]; then
+ echo "Target project $PROJECT is already cloned, latest changes will be fetched"
+ cd $PROJECT
+ git fetch
+ cd ../
+ else
+ for i in 1 2 3 4 5; do git clone $CLONE_URL && break || sleep 15; done
+ fi
+ cd ../
+}
+
+case $1 in
+
+no-exception-struts)
+ CS_POM_VERSION=$(mvn -e -q -Dexec.executable='echo' \
+ -Dexec.args='${checkstyle.eclipse-cs.version}' \
+ --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec)
+ SEVNTU_POM_VERSION=$(mvn -e -q -Dexec.executable='echo' -Dexec.args='${project.version}' \
+ --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec)
+ echo CS_version: ${CS_POM_VERSION}
+ echo SEVNTU_version: ${SEVNTU_POM_VERSION}
+ checkout_from https://github.com/checkstyle/contribution.git
+ cd .ci-temp/contribution/checkstyle-tester
+ sed -i'' 's/^guava/#guava/' projects-for-wercker.properties
+ sed -i'' 's/#apache-struts/apache-struts/' projects-for-wercker.properties
+ groovy ./launch.groovy --listOfProjects projects-for-wercker.properties \
+ --config checks-sevntu-error.xml --checkstyleVersion ${CS_POM_VERSION} \
+ --sevntuVersion ${SEVNTU_POM_VERSION}
+ cd ../../
+ rm -rf contribution
+ ;;
+
+no-exception-guava)
+ CS_POM_VERSION=$(mvn -e -q -Dexec.executable='echo' \
+ -Dexec.args='${checkstyle.eclipse-cs.version}' \
+ --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec)
+ SEVNTU_POM_VERSION=$(mvn -e -q -Dexec.executable='echo' -Dexec.args='${project.version}' \
+ --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec)
+ echo CS_version: ${CS_POM_VERSION}
+ echo SEVNTU_version: ${SEVNTU_POM_VERSION}
+ checkout_from https://github.com/checkstyle/contribution.git
+ cd .ci-temp/contribution/checkstyle-tester
+ sed -i'' 's/^guava/#guava/' projects-for-wercker.properties
+ sed -i'' 's/#guava/guava/' projects-for-wercker.properties
+ groovy ./launch.groovy --listOfProjects projects-for-wercker.properties \
+ --config checks-sevntu-error.xml --checkstyleVersion ${CS_POM_VERSION} \
+ --sevntuVersion ${SEVNTU_POM_VERSION}
+ cd ../../
+ rm -rf contribution
+ ;;
+
+no-exception-hibernate-orm)
+ CS_POM_VERSION=$(mvn -e -q -Dexec.executable='echo' \
+ -Dexec.args='${checkstyle.eclipse-cs.version}' \
+ --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec)
+ SEVNTU_POM_VERSION=$(mvn -e -q -Dexec.executable='echo' -Dexec.args='${project.version}' \
+ --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec)
+ echo CS_version: ${CS_POM_VERSION}
+ echo SEVNTU_version: ${SEVNTU_POM_VERSION}
+ checkout_from https://github.com/checkstyle/contribution.git
+ cd .ci-temp/contribution/checkstyle-tester
+ sed -i.'' 's/^guava/#guava/' projects-to-test-on.properties
+ sed -i.'' 's/#hibernate-orm/hibernate-orm/' projects-to-test-on.properties
+ groovy ./launch.groovy --listOfProjects projects-for-wercker.properties \
+ --config checks-sevntu-error.xml --checkstyleVersion ${CS_POM_VERSION} \
+ --sevntuVersion ${SEVNTU_POM_VERSION}
+ cd ../../
+ rm -rf contribution
+ ;;
+
+no-exception-spotbugs)
+ CS_POM_VERSION=$(mvn -e -q -Dexec.executable='echo' \
+ -Dexec.args='${checkstyle.eclipse-cs.version}' \
+ --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec)
+ SEVNTU_POM_VERSION=$(mvn -e -q -Dexec.executable='echo' -Dexec.args='${project.version}' \
+ --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec)
+ echo CS_version: ${CS_POM_VERSION}
+ echo SEVNTU_version: ${SEVNTU_POM_VERSION}
+ checkout_from https://github.com/checkstyle/contribution.git
+ cd .ci-temp/contribution/checkstyle-tester
+ sed -i.'' 's/^guava/#guava/' projects-to-test-on.properties
+ sed -i.'' 's/#spotbugs/spotbugs/' projects-to-test-on.properties
+ groovy ./launch.groovy --listOfProjects projects-to-test-on.properties \
+ --config checks-sevntu-error.xml --checkstyleVersion ${CS_POM_VERSION} \
+ --sevntuVersion ${SEVNTU_POM_VERSION}
+ cd ../../
+ rm -rf contribution
+ ;;
+
+no-exception-spring-framework)
+ CS_POM_VERSION=$(mvn -e -q -Dexec.executable='echo' \
+ -Dexec.args='${checkstyle.eclipse-cs.version}' \
+ --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec)
+ SEVNTU_POM_VERSION=$(mvn -e -q -Dexec.executable='echo' -Dexec.args='${project.version}' \
+ --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec)
+ echo CS_version: ${CS_POM_VERSION}
+ echo SEVNTU_version: ${SEVNTU_POM_VERSION}
+ checkout_from https://github.com/checkstyle/contribution.git
+ cd .ci-temp/contribution/checkstyle-tester
+ sed -i.'' 's/^guava/#guava/' projects-to-test-on.properties
+ sed -i.'' 's/#spring-framework/spring-framework/' projects-to-test-on.properties
+ groovy ./launch.groovy --listOfProjects projects-to-test-on.properties \
+ --config checks-sevntu-error.xml --checkstyleVersion ${CS_POM_VERSION} \
+ --sevntuVersion ${SEVNTU_POM_VERSION}
+ cd ../../
+ rm -rf contribution
+ ;;
+
+no-exception-hbase)
+ CS_POM_VERSION=$(mvn -e -q -Dexec.executable='echo' \
+ -Dexec.args='${checkstyle.eclipse-cs.version}' \
+ --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec)
+ SEVNTU_POM_VERSION=$(mvn -e -q -Dexec.executable='echo' -Dexec.args='${project.version}' \
+ --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec)
+ echo CS_version: ${CS_POM_VERSION}
+ echo SEVNTU_version: ${SEVNTU_POM_VERSION}
+ checkout_from https://github.com/checkstyle/contribution.git
+ cd .ci-temp/contribution/checkstyle-tester
+ sed -i.'' 's/^guava/#guava/' projects-to-test-on.properties
+ sed -i.'' 's/#Hbase/Hbase/' projects-to-test-on.properties
+ groovy ./launch.groovy --listOfProjects projects-to-test-on.properties \
+ --config checks-sevntu-error.xml --checkstyleVersion ${CS_POM_VERSION} \
+ --sevntuVersion ${SEVNTU_POM_VERSION}
+ cd ../../
+ rm -rf contribution
+ ;;
+
+no-exception-Pmd-elasticsearch-lombok-ast)
+ CS_POM_VERSION=$(mvn -e -q -Dexec.executable='echo' \
+ -Dexec.args='${checkstyle.eclipse-cs.version}' \
+ --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec)
+ SEVNTU_POM_VERSION=$(mvn -e -q -Dexec.executable='echo' -Dexec.args='${project.version}' \
+ --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec)
+ echo CS_version: ${CS_POM_VERSION}
+ echo SEVNTU_version: ${SEVNTU_POM_VERSION}
+ checkout_from https://github.com/checkstyle/contribution.git
+ cd .ci-temp/contribution/checkstyle-tester
+ sed -i.'' 's/^guava/#guava/' projects-to-test-on.properties
+ sed -i.'' 's/#pmd/pmd/' projects-to-test-on.properties
+ sed -i.'' 's/#elasticsearch/elasticsearch/' projects-to-test-on.properties
+ sed -i.'' 's/#lombok-ast/lombok-ast/' projects-to-test-on.properties
+ groovy ./launch.groovy --listOfProjects projects-to-test-on.properties \
+ --config checks-sevntu-error.xml --checkstyleVersion ${CS_POM_VERSION} \
+ --sevntuVersion ${SEVNTU_POM_VERSION}
+ cd ../../
+ rm -rf contribution
+ ;;
+
+no-exception-alot-of-projects)
+ CS_POM_VERSION=$(mvn -e -q -Dexec.executable='echo' \
+ -Dexec.args='${checkstyle.eclipse-cs.version}' \
+ --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec)
+ SEVNTU_POM_VERSION=$(mvn -e -q -Dexec.executable='echo' -Dexec.args='${project.version}' \
+ --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec)
+ echo CS_version: ${CS_POM_VERSION}
+ echo SEVNTU_version: ${SEVNTU_POM_VERSION}
+ checkout_from https://github.com/checkstyle/contribution.git
+ cd .ci-temp/contribution/checkstyle-tester
+ sed -i.'' 's/^guava/#guava/' projects-to-test-on.properties
+ sed -i.'' 's/#RxJava/RxJava/' projects-to-test-on.properties
+ sed -i.'' 's/#java-design-patterns/java-design-patterns/' projects-to-test-on.properties
+ sed -i.'' 's/#MaterialDesignLibrary/MaterialDesignLibrary/' projects-to-test-on.properties
+ sed -i.'' 's/#apache-ant/apache-ant/' projects-to-test-on.properties
+ sed -i.'' 's/#apache-jsecurity/apache-jsecurity/' projects-to-test-on.properties
+ sed -i.'' 's/#android-launcher/android-launcher/' projects-to-test-on.properties
+ groovy ./launch.groovy --listOfProjects projects-to-test-on.properties \
+ --config checks-sevntu-error.xml --checkstyleVersion ${CS_POM_VERSION} \
+ --sevntuVersion ${SEVNTU_POM_VERSION}
+ cd ../../
+ rm -rf contribution
+ ;;
+
+*)
+ echo "Unexpected argument: $1"
+ sleep 5s
+ false
+ ;;
+
+esac
diff --git a/wercker.yml b/wercker.yml
index bd4d76bd3c..8139b2aae0 100644
--- a/wercker.yml
+++ b/wercker.yml
@@ -50,3 +50,111 @@ build:
else
echo "build is skipped ..."
fi
+
+ - script:
+ name: NoExceptiontest - Apache Struts
+ code: |
+ if [[ $SKIP_CI == 'false' ]]; then
+ cd sevntu-checks
+ echo "Command: ./.ci/wercker.sh no-exception-struts"
+ ./.ci/wercker.sh no-exception-struts
+ cd ..
+ else
+ echo "build is skipped ..."
+ fi
+
+ - script:
+ name: NoExceptiontest - Guava
+ code: |
+ if [[ $SKIP_CI == 'false' ]]; then
+ cd sevntu-checks
+ echo "Command: ./.ci/wercker.sh ./.ci/wercker.sh no-exception-guava"
+ ./.ci/wercker.sh no-exception-guava
+ cd ..
+ else
+ echo "build is skipped ..."
+ fi
+
+ - script:
+ name: NoExceptiontest - Hibernate
+ code: |
+ if [[ $SKIP_CI == 'false' ]]; then
+ cd sevntu-checks
+ echo "Command: ./.ci/wercker.sh no-exception-hibernate-orm"
+ ./.ci/wercker.sh no-exception-hibernate-orm
+ cd ..
+ else
+ echo "build is skipped ..."
+ fi
+
+
+ - script:
+ name: NoExceptiontest - spotbugs
+ code: |
+ if [[ $SKIP_CI == 'false' ]]; then
+ cd sevntu-checks
+ echo "Command: ./.ci/wercker.sh no-exception-spotbugs"
+ ./.ci/wercker.sh no-exception-spotbugs
+ cd ..
+ else
+ echo "build is skipped ..."
+ fi
+
+ - script:
+ name: NoExceptiontest - spring-framework
+ code: |
+ if [[ $SKIP_CI == 'false' ]]; then
+ cd sevntu-checks
+ echo "Command: ./.ci/wercker.sh no-exception-spring-framework"
+ ./.ci/wercker.sh no-exception-spring-framework
+ cd ..
+ else
+ echo "build is skipped ..."
+ fi
+
+ - script:
+ name: NoExceptiontest - Hbase
+ code: |
+ if [[ $SKIP_CI == 'false' ]]; then
+ cd sevntu-checks
+ echo "Command: ./.ci/wercker.sh no-exception-hbase"
+ ./.ci/wercker.sh no-exception-hbase
+ cd ..
+ else
+ echo "build is skipped ..."
+ fi
+
+ - script:
+ name: NoExceptiontest - pmd elasticsearch lombok-ast
+ code: |
+ if [[ $SKIP_CI == 'false' ]]; then
+ cd sevntu-checks
+ echo "Command: ./.ci/wercker.sh no-exception-Pmd-elasticsearch-lombok-ast"
+ ./.ci/wercker.sh no-exception-Pmd-elasticsearch-lombok-ast
+ cd ..
+ else
+ echo "build is skipped ..."
+ fi
+
+ - script:
+ name: NoExceptiontest - RxJava apache-ant apache-jsecurity android-launcher ....
+ code: |
+ if [[ $SKIP_CI == 'false' ]]; then
+ cd sevntu-checks
+ echo "Command: ./.ci/wercker.sh no-exception-alot-of-projects"
+ ./.ci/wercker.sh no-exception-alot-of-projects
+ cd ..
+ else
+ echo "build is skipped ..."
+ fi
+
+ - script:
+ name: Cleanup maven local repo
+ code: |
+ find ${WERCKER_CACHE_DIR} -type d -name "*SNAPSHOT" -ls -exec rm -rf {} +
+ echo "------"
+ du -hs ${WERCKER_CACHE_DIR}
+ echo "------"
+ du -hs ${WERCKER_CACHE_DIR}/* | sort -h
+ echo "------"
+ du -hs * | sort -h
From be4d20a669c560185617ccd7e60d710db5304284 Mon Sep 17 00:00:00 2001
From: rnveach
Date: Sat, 9 Jun 2018 19:08:38 -0400
Subject: [PATCH 197/208] Issue #525: removed javadoc variable suppression and
fixed violations
---
.../checks/coding/CustomDeclarationOrderCheck.java | 12 ++++++++++++
.../coding/TernaryPerExpressionCountCheck.java | 10 ++++++++++
sevntu-checks/suppressions.xml | 1 -
3 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheck.java
index 605ad50745..badb7bc553 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/CustomDeclarationOrderCheck.java
@@ -193,28 +193,40 @@ public class CustomDeclarationOrderCheck extends AbstractCheck {
*/
public static final String MSG_KEY_INVALID_SETTER = "custom.declaration.order.invalid.setter";
+ /** Macro string for inner enumeration. */
private static final String INNER_ENUM_MACRO = "InnerEnum";
+ /** Macro string for inner interface. */
private static final String INNER_INTERFACE_MACRO = "InnerInterface";
+ /** Macro string for inner class. */
private static final String INNER_CLASS_MACRO = "InnerClass";
+ /** Macro string for constructor. */
private static final String CTOR_MACRO = "Ctor";
+ /** Macro string for method. */
private static final String METHOD_MACRO = "Method";
+ /** Macro string for anonymous class field. */
private static final String ANON_CLASS_FIELD_MACRO = "DeclareAnonClassField";
+ /** Macro string for field. */
private static final String FIELD_MACRO = "Field";
+ /** Macro string for getter and setter. */
private static final String GETTER_SETTER_MACRO = "GetterSetter";
+ /** Macro string for main method. */
private static final String MAIN_METHOD_MACRO = "MainMethod";
+ /** Prefix for boolean getter method name. */
private static final String BOOLEAN_GETTER_PREFIX = "is";
+ /** Prefix for getter method name. */
private static final String GETTER_PREFIX = "get";
+ /** Prefix for setter method name. */
private static final String SETTER_PREFIX = "set";
/** Default format for custom declaration check. */
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/TernaryPerExpressionCountCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/TernaryPerExpressionCountCheck.java
index 9daf80f195..9a77168678 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/TernaryPerExpressionCountCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/TernaryPerExpressionCountCheck.java
@@ -93,12 +93,22 @@ public class TernaryPerExpressionCountCheck extends AbstractCheck {
*/
public static final String MSG_KEY = "ternary.per.expression.count";
+ /** Default limit of ternary operators per expression. */
private static final int DEFAULT_MAX_TERNARY_PER_EXPRESSION_COUNT = 1;
+ /** Limit of ternary operators per expression. */
private int maxTernaryPerExpressionCount = DEFAULT_MAX_TERNARY_PER_EXPRESSION_COUNT;
+ /**
+ * If true Check will ignore ternary operators in braces (braces explicitly
+ * set priority level).
+ */
private boolean ignoreTernaryOperatorsInBraces = true;
+ /**
+ * If true Check will ignore one line ternary operators, if only it is
+ * places in line alone.
+ */
private boolean ignoreIsolatedTernaryOnLine = true;
@Override
diff --git a/sevntu-checks/suppressions.xml b/sevntu-checks/suppressions.xml
index ac0070eeba..658d3cb89d 100644
--- a/sevntu-checks/suppressions.xml
+++ b/sevntu-checks/suppressions.xml
@@ -9,7 +9,6 @@
-
From e1103ab90f413accfff49e4515ad3440ab242d96 Mon Sep 17 00:00:00 2001
From: rnveach
Date: Sat, 9 Jun 2018 19:29:13 -0400
Subject: [PATCH 198/208] Issue #525: removed javadoc paragraph suppression and
fixed violations
---
.../checks/coding/AvoidModifiersForTypesCheck.java | 13 ++++++++++++-
.../checks/coding/CustomDeclarationOrderCheck.java | 4 ++++
.../checks/coding/EitherLogOrThrowCheck.java | 4 ++++
.../checks/coding/EmptyPublicCtorInClassCheck.java | 7 +++++++
.../coding/ForbidThrowAnonymousExceptionsCheck.java | 3 ++-
.../coding/MapIterationInForEachLoopCheck.java | 7 ++++++-
.../MultipleVariableDeclarationsExtendedCheck.java | 2 --
.../NameConventionForJunit4TestClassesCheck.java | 3 +++
.../coding/NoNullForCollectionReturnCheck.java | 4 ----
.../coding/OverridableMethodInConstructorCheck.java | 2 ++
.../coding/TernaryPerExpressionCountCheck.java | 13 +++++++++----
.../checks/coding/UselessSuperCtorCallCheck.java | 5 +++++
.../WhitespaceBeforeArrayInitializerCheck.java | 4 ++++
.../checkstyle/checks/design/NestedSwitchCheck.java | 11 +++++++----
.../design/PublicReferenceToPrivateTypeCheck.java | 1 -
sevntu-checks/suppressions.xml | 1 -
16 files changed, 65 insertions(+), 19 deletions(-)
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidModifiersForTypesCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidModifiersForTypesCheck.java
index 8a7a28f0c3..867024edc0 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidModifiersForTypesCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/AvoidModifiersForTypesCheck.java
@@ -35,9 +35,11 @@
/**
*
* Disallow some set of modifiers for Java types specified by regexp.
+ *
*
* Field modifiers types according to Java Spec:
* (https://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.3.1)
+ *
*
*
Annotation: using the 'forbiddenClassesRegexpAnnotation' option.
*
final: using the 'forbiddenClassesRegexpFinal' option.
@@ -52,16 +54,20 @@
*
* Example 1: Forbid use of 'static' modifiers for 'ULCComponents'
* (http://ulc.canoo.com/ulccommunity/Contributions/Extensions/GoodPractices.html)
+ *
*
*
* Never keep instances of ULC classes in static variables (ULCIcons neither!). They cannot be
* shared between different sessions.
+ *
*
* So we can disallow "static" modifier for all ULC* components by setting up an
* "forbiddenClassesRegexpStatic" option to "ULC.+" regexp String.
+ *
*
*
* Configuration:
+ *
*
* <module name="TreeWalker">
* <module name="AvoidModifiersForTypesCheck">
@@ -74,9 +80,11 @@
* Example 2: Forbid using annotation for fields: (e.g. @Autowired ). This
* can be done by setting up the "forbiddenClassesRegexpAnnotation" option to "Person" regexp
* String.
+ *
*
*
* Configuration:
+ *
*
* <module name="TreeWalker">
* <module name="AvoidModifiersForTypesCheck">
@@ -102,13 +110,16 @@
* produce logs that are hard to investigate as logging class does not contains that code and search
* should be done in other classes or in hierarchy (if filed is public or accessible by other
* protected or package).
+ *
*
* This check can be activated by setting up the "forbiddenClassesRegexpPublic",
* "forbiddenClassesRegexpPackagePrivate" and "forbiddenClassesRegexpProtected" options to "Logger"
* regexp String.
+ *
* Checks that the parts of a class(main, nested, member inner) declaration
* appear in the rules order set by user using regular expressions.
+ *
*
* The check forms line which consists of class member annotations, modifiers,
* type and name from your code and compares it with your RegExp.
@@ -114,8 +115,11 @@
*
*
*
What is group of getters and setters(GetterSetter)?
+ *
*
* It is ordered sequence of getters and setters like:
+ *
+ *
*
* public int getValue() {
* log.info("Getting value");
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EitherLogOrThrowCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EitherLogOrThrowCheck.java
index 6c42e30655..7c6ac3c9a5 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EitherLogOrThrowCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EitherLogOrThrowCheck.java
@@ -41,6 +41,7 @@
*
*
* This check can help you to write the whole for-each map iteration more
- * correctly:
+ * correctly.
*
*
* 1. If you iterate over a map using map.keySet() or map.entrySet(), but your
* code uses only map values, Check will propose you to use map.values() instead
* of map.keySet() or map.entrySet(). Replacing map.keySet() or map.entrySet()
* with map.values() for such cases can a bit improve an iteration performance.
+ *
*
* Bad:
*
@@ -71,9 +72,11 @@
* }
*
*
+ *
* 2. If you iterate over a map using map.entrySet(), but never call
* entry.getValue(), Check will propose you to use map.keySet() instead of
* map.entrySet(). to iterate over map keys only.
+ *
*
* Bad:
*
@@ -95,10 +98,12 @@
* }
*
*
+ *
* 3. If you iterate over a map with map.keySet() and use both keys and values,
* check will propose you to use map.entrySet() to improve an iteration
* performance by avoiding search operations inside a map. For this case,
* iteration can significantly grow up a performance.
+ *
*
* Bad:
*
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MultipleVariableDeclarationsExtendedCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MultipleVariableDeclarationsExtendedCheck.java
index 357c44fcec..b26f7f13ec 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MultipleVariableDeclarationsExtendedCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MultipleVariableDeclarationsExtendedCheck.java
@@ -40,8 +40,6 @@
* <module name="MultipleVariableDeclarations"/>
*
*
- * *
- *
* @author o_sukhodolsky
*/
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NameConventionForJunit4TestClassesCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NameConventionForJunit4TestClassesCheck.java
index 1a17b47ed6..c5c13ded1e 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NameConventionForJunit4TestClassesCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NameConventionForJunit4TestClassesCheck.java
@@ -53,6 +53,7 @@
* considered to be a test. This option defaults to empty regex(one that matches
* nothing). If for example this option set to "RunWith", then class "SomeClass"
* is considered to be a test:
+ *
*
*
*
@@ -69,6 +70,7 @@
* matching annotation, it is considered to be a test. This option defaults to
* "Test|org.junit.Test". For example, if this option set to "Test", then class
* "SomeClass" is considered to be a test.
+ *
*
*
*
@@ -95,6 +97,7 @@
* Following configuration will adjust Check to look for classes annotated with
* annotation "RunWith" or classes with methods annotated with "Test" and verify
* that classes names end with "Test" or "Tests".
+ *
*
*
* <module name="NameConventionForJUnit4TestClassesCheck">
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NoNullForCollectionReturnCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NoNullForCollectionReturnCheck.java
index 3c118ee7f3..23d8842689 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NoNullForCollectionReturnCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NoNullForCollectionReturnCheck.java
@@ -58,9 +58,7 @@ public class NoNullForCollectionReturnCheck extends AbstractCheck {
public static final String MSG_KEY = "no.null.for.collections";
/**
- *
* Default list of collection implementing classes.
- *
*/
private Set collectionList = new HashSet<>();
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/OverridableMethodInConstructorCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/OverridableMethodInConstructorCheck.java
index 89d6b74fb8..b0853a779b 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/OverridableMethodInConstructorCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/OverridableMethodInConstructorCheck.java
@@ -32,6 +32,7 @@
* Detects overridable methods in constructors.
*
* This check prevents any calls to overridable methods that are take place in:
+ *
*
* Any constructor body (verification is always done by default and not
* configurable).
@@ -82,6 +83,7 @@
*
* Notes:
This check doesn`t handle the situation when there
* is a call to an overloaded method(s). Here`s an example:
+ *
*
*
public class Test {
*
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/TernaryPerExpressionCountCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/TernaryPerExpressionCountCheck.java
index 9a77168678..faafe7b6f4 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/TernaryPerExpressionCountCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/TernaryPerExpressionCountCheck.java
@@ -44,9 +44,12 @@
* System.out.println(x);
*
*
- * Output for code above is "D", but more obvious would be "BC".
- *
- * Check has following properties:
+ *
+ * Output for code above is "D", but more obvious would be "BC".
+ *
+ *
+ * Check has following properties:
+ *
*
*
maxTernaryPerExpressionCount - limit of ternary operators per
* expression
@@ -73,8 +76,10 @@
* procedureNameToUse + "(";
*
*
+ *
* When using ignoreIsolatedTernaryOnLine (value = true), even without
- * ignoreTernaryOperatorsInBraces option Check won't warn on code below:
+ * ignoreTernaryOperatorsInBraces option Check won't warn on code below:
+ *
*
*
* int a = (d == 5) ? d : f
diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UselessSuperCtorCallCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UselessSuperCtorCallCheck.java
index 14507bae97..4bb0e9f8ec 100644
--- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UselessSuperCtorCallCheck.java
+++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/UselessSuperCtorCallCheck.java
@@ -32,6 +32,7 @@
*
*
* Case 1. no-argument "super()" is called from class ctor if class is not derived, for example:
+ *
*
*
* class Dummy {
@@ -45,6 +46,7 @@
*
* Case 2. no-argument "super()" is called without parameters from class ctor if class is
* derived, for example:
+ *
*
*
* class Derived extends Base {
@@ -67,6 +69,7 @@
* violations when "super()" called inside derived class. This option defaults to "false".
* If for example this option set to "true", then Check will not generate violation for
* cases like following:
+ *
*
*
* class Base {
@@ -90,6 +93,7 @@
* This option may be useful for cases in which class`s ctors just forward its arguments to
* super ctors, thus removing "super()" in this case will make default ctors look not like
* others. For example:
+ *
*
*
* class Base {
@@ -128,6 +132,7 @@
*
* Checkstyle configuration example with options "allowCallToNoArgsSuperCtor" and
* "allowCallToNoArgsSuperCtorIfMultiplePublicCtor" set to true.
+ *
* Nested switch block that checks type parameter should be converted into separate
* method.
- * To enable this check use following configuration:
- *
- * <module name="NestedSwitchCheck"/>
- *
+ * To enable this check use following configuration:
+ *