From 7e3948d5bbbeefd29a9f435c1fdd12c4e0226e80 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 f7e92f14055233dfc9944ebd2602287f72ce9079 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 9b7f99876fd49a84907157ab3cb123c3c8910e22 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 methodWithThreeReturnInLambda(int number) { + return Optional.of(number).map(i -> { + if (i == 42) return true; + else if (i == 7) return true; + else return false; + }); + } + + int methodWithTwoReturnWithLambdas(final int number) { + if (hashCode() > 0) { + new Thread( + () -> { + } + ).start(); + return number; + } else { + return Optional.of(hashCode()).orElseGet(() -> { + if (number > 0) return number; + else return 0; + }); + } + } + + Supplier> methodWithOneReturnPerLambda() { + return () -> { + return () -> { + return 1; + }; + }; + } +} \ No newline at end of file From f078b5cfb3ed99a4bf31ad1b2d3c01bdcfeb1102 Mon Sep 17 00:00:00 2001 From: rnveach Date: Mon, 5 Dec 2016 12:48:47 -0500 Subject: [PATCH 004/208] Issue #520: 100% coverage for Utils --- sevntu-checks/pom.xml | 1 - .../github/sevntu/checkstyle/UtilsTest.java | 44 +++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 sevntu-checks/src/test/java/com/github/sevntu/checkstyle/UtilsTest.java diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml index a08f27cc5f..5ae6200a17 100644 --- a/sevntu-checks/pom.xml +++ b/sevntu-checks/pom.xml @@ -188,7 +188,6 @@ .*.checks.design.PublicReferenceToPrivateTypeCheck9790 .*.checks.naming.EnumValueNameCheck86100 .*.checks.sizes.LineLengthExtendedCheck1006 - com.github.sevntu.checkstyle.Utils00 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 new file mode 100644 index 0000000000..737ae2f4a2 --- /dev/null +++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/UtilsTest.java @@ -0,0 +1,44 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2016 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 com.puppycrawl.tools.checkstyle.internal.TestUtils.assertUtilsClassHasPrivateConstructor; + +import org.junit.Assert; +import org.junit.Test; + +import com.puppycrawl.tools.checkstyle.api.TokenTypes; + +public class UtilsTest { + @Test + public void testIsProperUtilsClass() throws ReflectiveOperationException { + assertUtilsClassHasPrivateConstructor(Utils.class); + } + + @Test + public void testReportInvalidToken() { + try { + Utils.reportInvalidToken(TokenTypes.CLASS_DEF); + } + catch (IllegalArgumentException ex) { + Assert.assertEquals("Found unsupported token: CLASS_DEF", ex.getMessage()); + } + } +} From b7e38131b7dcec66fa63115b92d9b77d2f05313b Mon Sep 17 00:00:00 2001 From: rnveach Date: Mon, 5 Dec 2016 12:59:34 -0500 Subject: [PATCH 005/208] Issue #520: 100% coverage for ForbidAnnotationCheck --- sevntu-checks/pom.xml | 1 - .../annotation/ForbidAnnotationCheck.java | 3 +-- .../annotation/ForbidAnnotationTest.java | 23 +++++++++++++++++++ .../annotation/InputForbidAnnotation2.java | 8 +++---- 4 files changed, 28 insertions(+), 7 deletions(-) diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml index 5ae6200a17..01f0ad506c 100644 --- a/sevntu-checks/pom.xml +++ b/sevntu-checks/pom.xml @@ -155,7 +155,6 @@ 88 96 - .*.checks.annotation.ForbidAnnotationCheck7096 .*.checks.coding.AvoidConstantAsFirstOperandInConditionCheck87100 .*.checks.coding.ConfusingConditionCheck82100 .*.checks.coding.CustomDeclarationOrderCheck.*8183 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 a1fc4bf525..9f602940e1 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 @@ -130,8 +130,7 @@ private static String getAnnotationName(DetailAST annotation) { * @return boolean */ private boolean isRequiredAnnotationName(String annotationName) { - return annotationName != null - && annotationNames.contains(annotationName); + return annotationNames.contains(annotationName); } /** diff --git a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationTest.java index 4651dffd54..ef64053e0a 100644 --- a/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationTest.java +++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/annotation/ForbidAnnotationTest.java @@ -34,10 +34,33 @@ */ public class ForbidAnnotationTest extends BaseCheckTestSupport { + @Test + public void testDefaultCheck() throws Exception { + final DefaultConfiguration checkConfig = createCheckConfig(ForbidAnnotationCheck.class); + + final String[] expected1 = {}; + + verify(checkConfig, getPath("InputForbidAnnotation2.java"), expected1); + } + + @Test + public void testNullProperties() throws Exception { + final DefaultConfiguration checkConfig = createCheckConfig(ForbidAnnotationCheck.class); + + checkConfig.addAttribute("annotationNames", null); + checkConfig.addAttribute("annotationTargets", null); + + final String[] expected1 = {}; + + verify(checkConfig, getPath("InputForbidAnnotation2.java"), expected1); + } + @Test public void testFullAnnotationName() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(ForbidAnnotationCheck.class); + checkConfig.addAttribute("annotationNames", "Test"); + final String[] expected1 = {}; verify(checkConfig, getPath("InputForbidAnnotation2.java"), expected1); diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/annotation/InputForbidAnnotation2.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/annotation/InputForbidAnnotation2.java index 69e4c7a66f..7949156e4e 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/annotation/InputForbidAnnotation2.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/annotation/InputForbidAnnotation2.java @@ -1,7 +1,7 @@ package com.github.sevntu.checkstyle.checks.annotation; -import java.awt.Component; - -public class InputForbidAnnotation2 extends Component { - private static final long serialVersionUID = 1L; +public class InputForbidAnnotation2 { + @org.junit.Test + public void method() { + } } From 944d033ef13a342c9ac5576204ab40b7fcbc8a43 Mon Sep 17 00:00:00 2001 From: rnveach Date: Mon, 5 Dec 2016 14:12:13 -0500 Subject: [PATCH 006/208] Issue #520: 100% coverage for ConfusingConditionCheck --- sevntu-checks/pom.xml | 1 - .../coding/ConfusingConditionCheck.java | 2 +- .../coding/ConfusingConditionCheckTest.java | 66 ++++++++++++++++++- 3 files changed, 65 insertions(+), 4 deletions(-) diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml index 01f0ad506c..b3710208c2 100644 --- a/sevntu-checks/pom.xml +++ b/sevntu-checks/pom.xml @@ -156,7 +156,6 @@ 96 .*.checks.coding.AvoidConstantAsFirstOperandInConditionCheck87100 - .*.checks.coding.ConfusingConditionCheck82100 .*.checks.coding.CustomDeclarationOrderCheck.*8183 .*.checks.coding.DiamondOperatorForVariableDefinitionCheck90100 .*.checks.coding.EitherLogOrThrowCheck8899 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 4f1a893b79..4e1b9d61da 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 @@ -250,7 +250,7 @@ private static int getAmounOfCodeRowsInBlock(DetailAST detailAST) { if (detailAST.getType() == TokenTypes.LITERAL_ELSE) { firstBrace = detailAST.getFirstChild(); } - else if (detailAST.getType() == TokenTypes.LITERAL_IF) { + else { firstBrace = detailAST.getFirstChild().getNextSibling() .getNextSibling().getNextSibling(); } 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 21a0942293..531f326538 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 @@ -33,10 +33,10 @@ public class ConfusingConditionCheckTest extends BaseCheckTestSupport { private final String warningMessage = getCheckMessage(MSG_KEY); - private final DefaultConfiguration checkConfig = createCheckConfig(ConfusingConditionCheck.class); - @Test public void testDefault() throws Exception { + final DefaultConfiguration checkConfig = createCheckConfig(ConfusingConditionCheck.class); + checkConfig.addAttribute("ignoreInnerIf", "true"); checkConfig.addAttribute("ignoreNullCaseInIf", "true"); checkConfig.addAttribute("ignoreSequentialIf", "true"); @@ -64,4 +64,66 @@ public void testDefault() throws Exception { verify(checkConfig, getPath("InputConfusingConditionCheck.java"), expected); } + + @Test + public void testFalseProperties() throws Exception { + final DefaultConfiguration checkConfig = createCheckConfig(ConfusingConditionCheck.class); + + checkConfig.addAttribute("ignoreInnerIf", "false"); + checkConfig.addAttribute("ignoreNullCaseInIf", "false"); + checkConfig.addAttribute("ignoreSequentialIf", "false"); + checkConfig.addAttribute("ignoreThrowInElse", "false"); + + final String[] expected = { + "10: " + warningMessage, + "13: " + warningMessage, + "16: " + warningMessage, + "19: " + warningMessage, + "22: " + warningMessage, + "105: " + warningMessage, + "108: " + warningMessage, + "111: " + warningMessage, + "127: " + warningMessage, + "134: " + warningMessage, + "138: " + warningMessage, + "145: " + warningMessage, + "149: " + warningMessage, + "157: " + warningMessage, + "160: " + warningMessage, + "162: " + warningMessage, + "166: " + warningMessage, + "177: " + warningMessage, + "181: " + warningMessage, + "199: " + warningMessage, + "200: " + warningMessage, + "215: " + warningMessage, + "227: " + warningMessage, + "231: " + warningMessage, + }; + + verify(checkConfig, getPath("InputConfusingConditionCheck.java"), + expected); + } + + @Test + public void testMultiplyFactor() throws Exception { + final DefaultConfiguration checkConfig = createCheckConfig(ConfusingConditionCheck.class); + + checkConfig.addAttribute("multiplyFactorForElseBlocks", "0"); + + final String[] expected = { + "10: " + warningMessage, + "13: " + warningMessage, + "16: " + warningMessage, + "19: " + warningMessage, + "22: " + warningMessage, + "105: " + warningMessage, + "108: " + warningMessage, + "111: " + warningMessage, + "177: " + warningMessage, + }; + + verify(checkConfig, getPath("InputConfusingConditionCheck.java"), + expected); + } } From e4a02fc0d1c86b89bb2d5eab48b756f827670cf1 Mon Sep 17 00:00:00 2001 From: Roman Ivanov Date: Mon, 5 Dec 2016 13:48:06 -0800 Subject: [PATCH 007/208] Issue #496: MultipleStringLiteralsExtended, ChildBlockLength, LineLengthExtended are activated --- sevntu-checks/sevntu-checks.xml | 3 --- sevntu-checks/sevntu-suppressions.xml | 8 ++++++++ sevntu-checks/suppressions.xml | 5 ++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/sevntu-checks/sevntu-checks.xml b/sevntu-checks/sevntu-checks.xml index 6285c6af0c..8e9d7039ba 100644 --- a/sevntu-checks/sevntu-checks.xml +++ b/sevntu-checks/sevntu-checks.xml @@ -51,7 +51,6 @@ - @@ -158,7 +157,6 @@ - @@ -205,7 +203,6 @@ - diff --git a/sevntu-checks/sevntu-suppressions.xml b/sevntu-checks/sevntu-suppressions.xml index cbae892d82..f9d655405f 100644 --- a/sevntu-checks/sevntu-suppressions.xml +++ b/sevntu-checks/sevntu-suppressions.xml @@ -7,4 +7,12 @@ + + + + + + + + \ No newline at end of file diff --git a/sevntu-checks/suppressions.xml b/sevntu-checks/suppressions.xml index 1ca95a8e50..75029cae89 100644 --- a/sevntu-checks/suppressions.xml +++ b/sevntu-checks/suppressions.xml @@ -24,7 +24,7 @@ - + @@ -37,8 +37,7 @@ - - + " + map.get(key)); } - for (MyMap.Entry entry : myMap.entrySet()) + for (InputMyMap.Entry entry : myMap.entrySet()) { System.out.println(entry.getValue() + " --> "); } diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMapIterationInForEachLoopSkipIf.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMapIterationInForEachLoopCheckSkipIf.java similarity index 84% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMapIterationInForEachLoopSkipIf.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMapIterationInForEachLoopCheckSkipIf.java index f273f11c26..ce4497fbe2 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMapIterationInForEachLoopSkipIf.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMapIterationInForEachLoopCheckSkipIf.java @@ -1,14 +1,14 @@ package com.github.sevntu.checkstyle.checks.coding; -import com.github.sevntu.checkstyle.checks.coding.MyMap; +import com.github.sevntu.checkstyle.checks.coding.external.InputMyMap; import java.util.*; import java.util.Map.Entry; -public class InputMapIterationInForEachLoopSkipIf +public class InputMapIterationInForEachLoopCheckSkipIf { public static void main(String[] args) { Map map = new HashMap(); - MyMap myMap = new MyMap(); + InputMyMap myMap = new InputMyMap(); int counter = 0; for (String key : map.keySet()) @@ -41,7 +41,7 @@ public static void main(String[] args) } } - for (MyMap.Entry entry : myMap.entrySet()) + for (InputMyMap.Entry entry : myMap.entrySet()) { System.out.println(entry.getKey()); if (entry.getValue() != "value") { diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMultipleStringLiterals.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMultipleStringLiteralsExtendedCheck.java old mode 100755 new mode 100644 similarity index 93% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMultipleStringLiterals.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMultipleStringLiteralsExtendedCheck.java index 5ff3917a47..31f281024e --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMultipleStringLiterals.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMultipleStringLiteralsExtendedCheck.java @@ -1,6 +1,6 @@ package com.github.sevntu.checkstyle.checks.coding; -public class InputMultipleStringLiterals +public class InputMultipleStringLiteralsExtendedCheck { String m = "StringContents"; String m1 = "SingleString"; diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMultipleVariableDeclarations.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMultipleVariableDeclarationsExtendedCheck.java similarity index 90% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMultipleVariableDeclarations.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMultipleVariableDeclarationsExtendedCheck.java index 07e0f50934..a83593a2e9 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMultipleVariableDeclarations.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMultipleVariableDeclarationsExtendedCheck.java @@ -1,5 +1,5 @@ package com.github.sevntu.checkstyle.checks.coding; -public class InputMultipleVariableDeclarations { +public class InputMultipleVariableDeclarationsExtendedCheck { int i, j; int i1; int j1; @@ -24,4 +24,4 @@ void method2() { int k = 7; } } -} \ No newline at end of file +} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForTest1.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForJunit4TestClassesCheck1.java similarity index 84% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForTest1.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForJunit4TestClassesCheck1.java index 3e9498948d..fe983b711f 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForTest1.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForJunit4TestClassesCheck1.java @@ -6,7 +6,7 @@ import org.junit.runners.Suite.SuiteClasses; -public class InputNameConventionForTest1 +public class InputNameConventionForJunit4TestClassesCheck1 { @RunWith(Suite.class) diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForTest2.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForJunit4TestClassesCheck2.java similarity index 79% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForTest2.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForJunit4TestClassesCheck2.java index f597a5ae81..b058081def 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForTest2.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForJunit4TestClassesCheck2.java @@ -3,7 +3,7 @@ import org.junit.Test; import org.junit.runner.RunWith; -public class InputNameConventionForTest2 +public class InputNameConventionForJunit4TestClassesCheck2 { public class InnerTestClass { diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForTest3.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForJunit4TestClassesCheck3.java similarity index 81% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForTest3.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForJunit4TestClassesCheck3.java index 02e56d2d6e..8688bc6210 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForTest3.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForJunit4TestClassesCheck3.java @@ -1,6 +1,6 @@ package com.github.sevntu.checkstyle.checks.coding; -public class InputNameConventionForTest3 +public class InputNameConventionForJunit4TestClassesCheck3 { public class InnerNotTestClass { diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForTest4.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForJunit4TestClassesCheck4.java similarity index 90% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForTest4.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForJunit4TestClassesCheck4.java index 7ed343c7ab..5e2b448f9c 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForTest4.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForJunit4TestClassesCheck4.java @@ -2,7 +2,7 @@ import org.junit.Test; -public class InputNameConventionForTest4 +public class InputNameConventionForJunit4TestClassesCheck4 { public class NestedNotTestClass { diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForTest5.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForJunit4TestClassesCheck5.java similarity index 79% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForTest5.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForJunit4TestClassesCheck5.java index 41c030b4b0..3fd34cf32c 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForTest5.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForJunit4TestClassesCheck5.java @@ -3,7 +3,7 @@ import java.awt.Component; import java.io.IOException; -public class InputNameConventionForTest5 +public class InputNameConventionForJunit4TestClassesCheck5 { public class InnerTestClass { diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForTest6.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForJunit4TestClassesCheck6.java similarity index 73% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForTest6.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForJunit4TestClassesCheck6.java index f18eb6b656..a2b251061a 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForTest6.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForJunit4TestClassesCheck6.java @@ -1,7 +1,7 @@ package com.github.sevntu.checkstyle.checks.coding; -public class InputNameConventionForTest6 +public class InputNameConventionForJunit4TestClassesCheck6 { @SomeTestAnnotation public class InnerTestClass @@ -13,4 +13,4 @@ public class InnerTestClass @interface SomeTestAnnotation { -} \ No newline at end of file +} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForTest7.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForJunit4TestClassesCheck7.java similarity index 79% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForTest7.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForJunit4TestClassesCheck7.java index 17c31b8510..eaf82c4137 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForTest7.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForJunit4TestClassesCheck7.java @@ -1,7 +1,7 @@ package com.github.sevntu.checkstyle.checks.coding; -public class InputNameConventionForTest7 +public class InputNameConventionForJunit4TestClassesCheck7 { public class InnerTestClass { diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForTest8.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForJunit4TestClassesCheck8.java similarity index 68% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForTest8.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForJunit4TestClassesCheck8.java index c2923a69bf..71f558ff2c 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForTest8.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNameConventionForJunit4TestClassesCheck8.java @@ -2,7 +2,7 @@ import org.junit.Test; -public class InputNameConventionForTest8 +public class InputNameConventionForJunit4TestClassesCheck8 { @Test public void test() diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNumericLiteralNeedUnderscoreCheck.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNumericLiteralNeedsUnderscoreCheck.java similarity index 98% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNumericLiteralNeedUnderscoreCheck.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNumericLiteralNeedsUnderscoreCheck.java index d04cf9e4d9..c869e4b8e1 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNumericLiteralNeedUnderscoreCheck.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNumericLiteralNeedsUnderscoreCheck.java @@ -1,6 +1,6 @@ package com.github.sevntu.checkstyle.checks.coding; -public class InputNumericLiteralNeedUnderscoreCheck { +public class InputNumericLiteralNeedsUnderscoreCheck { public void goodNumericLiterals() { int goodInt1 = 1234; diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNumericLiteralNeedUnderscoreCheck2.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNumericLiteralNeedsUnderscoreCheck2.java similarity index 98% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNumericLiteralNeedUnderscoreCheck2.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNumericLiteralNeedsUnderscoreCheck2.java index bcef7dd957..9111ae10bd 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNumericLiteralNeedUnderscoreCheck2.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNumericLiteralNeedsUnderscoreCheck2.java @@ -1,6 +1,6 @@ package com.github.sevntu.checkstyle.checks.coding; -public class InputNumericLiteralNeedUnderscoreCheck2 { +public class InputNumericLiteralNeedsUnderscoreCheck2 { public void goodNumericLiterals() { int goodInt1 = 12; diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor1.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck1.java similarity index 92% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor1.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck1.java index 505ce5ea0a..0d92ad3bc9 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor1.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck1.java @@ -1,6 +1,6 @@ package com.github.sevntu.checkstyle.checks.coding; -public class InputOverridableMethodInConstructor1 { +public class InputOverridableMethodInConstructorCheck1 { public static void main(String[] args) { @@ -31,4 +31,4 @@ public void overrideMe() { new Child1(999); // will not print x =) } -} \ No newline at end of file +} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor10.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck10.java similarity index 88% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor10.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck10.java index 387799b021..b686322bf2 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor10.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck10.java @@ -8,7 +8,7 @@ import java.io.ObjectOutputStream; import java.io.Serializable; -public class InputOverridableMethodInConstructor10 { +public class InputOverridableMethodInConstructorCheck10 { public static void main(String args[]) throws IOException, ClassNotFoundException { @@ -38,7 +38,7 @@ private void doSmth() { } - static class Object2 extends com.github.sevntu.checkstyle.checks.coding.InputOverridableMethodInConstructor10.Object1 implements java.io.Serializable { + static class Object2 extends com.github.sevntu.checkstyle.checks.coding.InputOverridableMethodInConstructorCheck10.Object1 implements java.io.Serializable { String value; @@ -53,4 +53,4 @@ public void readObject(java.io.ObjectInputStream in)throws IOException, ClassNot } -} \ No newline at end of file +} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor11.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck11.java similarity index 95% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor11.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck11.java index f42ab2c028..77b02d82a6 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor11.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck11.java @@ -8,7 +8,7 @@ import java.io.ObjectOutputStream; import java.io.Serializable; -public class InputOverridableMethodInConstructor11 { +public class InputOverridableMethodInConstructorCheck11 { public static void main(String args[]) throws IOException, ClassNotFoundException { @@ -52,4 +52,4 @@ public void readObject(java.io.ObjectInputStream in)throws IOException, ClassNot } -} \ No newline at end of file +} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor12.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck12.java similarity index 97% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor12.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck12.java index 1413a8253e..b0517203c6 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor12.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck12.java @@ -6,7 +6,7 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; -public class InputOverridableMethodInConstructor12 { +public class InputOverridableMethodInConstructorCheck12 { public static void main(String args[]) throws IOException, ClassNotFoundException { diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor13.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck13.java similarity index 96% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor13.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck13.java index 6f03fa5d5f..1b8be6ffaa 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor13.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck13.java @@ -6,7 +6,7 @@ import javax.xml.crypto.Data; -public class InputOverridableMethodInConstructor13 { +public class InputOverridableMethodInConstructorCheck13 { public static void main(String args[]) throws IOException, ClassNotFoundException, CloneNotSupportedException { diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor14.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck14.java similarity index 97% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor14.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck14.java index 8845ea563e..0ee08e62d3 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor14.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck14.java @@ -8,7 +8,7 @@ import java.io.ObjectOutputStream; import java.io.Serializable; -public class InputOverridableMethodInConstructor14 { +public class InputOverridableMethodInConstructorCheck14 { public static void main(String args[]) throws IOException, ClassNotFoundException { @@ -84,4 +84,4 @@ public void readObject(java.io.ObjectInputStream in)throws IOException, ClassNot } } -} \ No newline at end of file +} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor15.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck15.java similarity index 95% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor15.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck15.java index cc1b229abd..039cf01f42 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor15.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck15.java @@ -1,6 +1,6 @@ package com.github.sevntu.checkstyle.checks.coding; -public class InputOverridableMethodInConstructor15 { +public class InputOverridableMethodInConstructorCheck15 { public static void main(String[] args) { @@ -47,4 +47,4 @@ public void overrideMe() { new Child1(999); // will not print x =) } -} \ No newline at end of file +} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor16.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck16.java similarity index 90% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor16.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck16.java index ad100214aa..6957397d93 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor16.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck16.java @@ -8,7 +8,7 @@ import java.io.ObjectOutputStream; import java.io.Serializable; -public class InputOverridableMethodInConstructor16 { +public class InputOverridableMethodInConstructorCheck16 { private class Object1 implements Serializable { @@ -26,4 +26,4 @@ public final void doSmth(String value) { } } -} \ No newline at end of file +} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor17.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck17.java similarity index 92% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor17.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck17.java index 354b2fd0ac..3288d0b1e1 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor17.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck17.java @@ -8,7 +8,7 @@ import java.io.ObjectOutputStream; import java.io.Serializable; -public class InputOverridableMethodInConstructor17 { +public class InputOverridableMethodInConstructorCheck17 { private class Object1 implements Serializable { @@ -33,4 +33,4 @@ public void readObject(java.io.ObjectInputStream in) throws IOException, ClassNo } } -} \ No newline at end of file +} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor18.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck18.java similarity index 88% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor18.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck18.java index d9fda58fe9..b7b59a3682 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor18.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck18.java @@ -4,7 +4,7 @@ import com.puppycrawl.tools.checkstyle.gui.Main; -public class InputOverridableMethodInConstructor18 { +public class InputOverridableMethodInConstructorCheck18 { private class Object1 implements Serializable { @@ -22,4 +22,4 @@ private void registerColumnType(int i, String string) { } -} \ No newline at end of file +} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor19.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck19.java similarity index 92% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor19.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck19.java index 772ea72e6e..a2ff757516 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor19.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck19.java @@ -30,12 +30,12 @@ * * @author Gavin King */ -public abstract class InputOverridableMethodInConstructor19 { +public abstract class InputOverridableMethodInConstructorCheck19 { private String persister; private Object alias; - public InputOverridableMethodInConstructor19( + public InputOverridableMethodInConstructorCheck19( String persister, String factory, String loadQueryInfluencers, diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor2.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck2.java old mode 100755 new mode 100644 similarity index 95% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor2.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck2.java index 074cfc0fce..ad3ed4f8f7 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor2.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck2.java @@ -1,6 +1,6 @@ package com.github.sevntu.checkstyle.checks.coding; -public class InputOverridableMethodInConstructor2 { +public class InputOverridableMethodInConstructorCheck2 { public static void main(String[] args) { diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor20.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck20.java similarity index 64% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor20.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck20.java index ff5e26c476..825670b265 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor20.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck20.java @@ -1,7 +1,7 @@ package com.github.sevntu.checkstyle.checks.coding; -public interface InputOverridableMethodInConstructor20 { +public interface InputOverridableMethodInConstructorCheck20 { Object readObject(Object obj, String name, Object oldValue); -} \ No newline at end of file +} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor21.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck21.java similarity index 63% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor21.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck21.java index 13fb7a49ea..69360d805b 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor21.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck21.java @@ -1,7 +1,7 @@ package com.github.sevntu.checkstyle.checks.coding; -public class InputOverridableMethodInConstructor21 { +public class InputOverridableMethodInConstructorCheck21 { - public InputOverridableMethodInConstructor21() { + public InputOverridableMethodInConstructorCheck21() { doSmth(); } @@ -17,4 +17,4 @@ private void doSmth3() { doSmth(); } -} \ No newline at end of file +} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor22.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck22.java similarity index 74% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor22.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck22.java index 7bc8fc6335..afd078f438 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor22.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck22.java @@ -1,7 +1,7 @@ package com.github.sevntu.checkstyle.checks.coding; -public class InputOverridableMethodInConstructor22 { +public class InputOverridableMethodInConstructorCheck22 { - InputOverridableMethodInConstructor22() { + InputOverridableMethodInConstructorCheck22() { doSMTH(); // a warning here! } @@ -25,4 +25,4 @@ private void doSMTH4() { public void doPublic() { } -} \ No newline at end of file +} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor23.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck23.java similarity index 96% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor23.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck23.java index 884543c915..922d09b303 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor23.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck23.java @@ -12,10 +12,10 @@ * * @author Emmanuel Bernard */ -public class InputOverridableMethodInConstructor23 { +public class InputOverridableMethodInConstructorCheck23 { private Set associations; - public InputOverridableMethodInConstructor23( + public InputOverridableMethodInConstructorCheck23( String[] persister, HashMap> associationsPerEntityPersister, String factory) { diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor24.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck24.java similarity index 60% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor24.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck24.java index fab44088bf..cd1a56735c 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor24.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck24.java @@ -2,11 +2,11 @@ import java.lang.reflect.Method; import java.util.Iterator; -public abstract class InputOverridableMethodInConstructor24 { +public abstract class InputOverridableMethodInConstructorCheck24 { protected abstract String buildGetter(String component, String prop); - protected InputOverridableMethodInConstructor24(String component, String prop) { + protected InputOverridableMethodInConstructorCheck24(String component, String prop) { buildGetter(component, prop); diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor25.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck25.java similarity index 69% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor25.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck25.java index 37d0196dd0..66fe7b3599 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor25.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck25.java @@ -1,5 +1,5 @@ package com.github.sevntu.checkstyle.checks.coding; -public class InputOverridableMethodInConstructor25 { +public class InputOverridableMethodInConstructorCheck25 { final class A { A() { @@ -7,4 +7,4 @@ final class A { } void doSmth() {} } -} \ No newline at end of file +} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor26.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck26.java similarity index 87% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor26.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck26.java index 4dce70dec5..d8d74399cd 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor26.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck26.java @@ -1,6 +1,6 @@ package com.github.sevntu.checkstyle.checks.coding; -public class InputOverridableMethodInConstructor26 +public class InputOverridableMethodInConstructorCheck26 { class ULCWorkbenchPartSite diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor27.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck27.java similarity index 95% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor27.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck27.java index 3849feb1cc..55ba8b2e18 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor27.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck27.java @@ -1,6 +1,6 @@ package com.github.sevntu.checkstyle.checks.coding; -public class InputOverridableMethodInConstructor27 +public class InputOverridableMethodInConstructorCheck27 { public static void main(String[] args) diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor3.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck3.java old mode 100755 new mode 100644 similarity index 94% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor3.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck3.java index 9194b32e0e..88791d41d8 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor3.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck3.java @@ -1,6 +1,6 @@ package com.github.sevntu.checkstyle.checks.coding; -public class InputOverridableMethodInConstructor3 { +public class InputOverridableMethodInConstructorCheck3 { public static void main(String[] args) { @@ -37,4 +37,4 @@ public void overrideMe() { new Child3(999); // will print "0" } -} \ No newline at end of file +} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor4.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck4.java old mode 100755 new mode 100644 similarity index 95% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor4.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck4.java index f2ba4a9446..dbcca08b92 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor4.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck4.java @@ -1,6 +1,6 @@ package com.github.sevntu.checkstyle.checks.coding; -public class InputOverridableMethodInConstructor4 { +public class InputOverridableMethodInConstructorCheck4 { public static void main(String[] args) { diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor5.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck5.java old mode 100755 new mode 100644 similarity index 96% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor5.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck5.java index 46274ffa9c..aba0375b55 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor5.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck5.java @@ -1,6 +1,6 @@ package com.github.sevntu.checkstyle.checks.coding; -public class InputOverridableMethodInConstructor5 { +public class InputOverridableMethodInConstructorCheck5 { public static void main(String[] args) { diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor6.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck6.java old mode 100755 new mode 100644 similarity index 90% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor6.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck6.java index ea617d6abb..d4a05a3902 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor6.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck6.java @@ -1,6 +1,6 @@ package com.github.sevntu.checkstyle.checks.coding; import java.io.IOException; -public class InputOverridableMethodInConstructor6 { +public class InputOverridableMethodInConstructorCheck6 { public static void main(String args[]) throws IOException, ClassNotFoundException, CloneNotSupportedException { diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor7.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck7.java old mode 100755 new mode 100644 similarity index 93% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor7.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck7.java index 2ffa0258f2..62d2b286c2 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor7.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck7.java @@ -1,6 +1,6 @@ package com.github.sevntu.checkstyle.checks.coding; import java.io.IOException; -public class InputOverridableMethodInConstructor7 { +public class InputOverridableMethodInConstructorCheck7 { public static void main(String args[]) throws IOException, ClassNotFoundException, CloneNotSupportedException { diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor8.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck8.java old mode 100755 new mode 100644 similarity index 93% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor8.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck8.java index a351c92cd5..186a983e11 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor8.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck8.java @@ -1,6 +1,6 @@ package com.github.sevntu.checkstyle.checks.coding; import java.io.IOException; -public class InputOverridableMethodInConstructor8 { +public class InputOverridableMethodInConstructorCheck8 { public static void main(String args[]) throws IOException, ClassNotFoundException, CloneNotSupportedException { @@ -38,4 +38,4 @@ public Object clone() throws CloneNotSupportedException { return clone; } } -} \ No newline at end of file +} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor9.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck9.java similarity index 94% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor9.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck9.java index 2047ef7ddf..0bd8c5a5e3 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructor9.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck9.java @@ -1,6 +1,6 @@ package com.github.sevntu.checkstyle.checks.coding; import java.io.IOException; -public class InputOverridableMethodInConstructor9 { +public class InputOverridableMethodInConstructorCheck9 { public static void main(String args[]) throws IOException, ClassNotFoundException, CloneNotSupportedException { diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRedundantReturn.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRedundantReturnCheck.java similarity index 94% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRedundantReturn.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRedundantReturnCheck.java index 38e658712f..d401ce7b2f 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRedundantReturn.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRedundantReturnCheck.java @@ -1,16 +1,16 @@ package com.github.sevntu.checkstyle.checks.coding; -public class InputRedundantReturn { +public class InputRedundantReturnCheck { /** * @param args */ - public InputRedundantReturn(){ + public InputRedundantReturnCheck(){ //allowed/not empty c-tor return; //WARNING if option 'allowReturnInEmptyMethodsAndConstructors' is off }//c-tor - public InputRedundantReturn(String s){ + public InputRedundantReturnCheck(String s){ //non empty constructor boolean b = true; b = b ? true: false; @@ -166,7 +166,7 @@ public void setFormats3() { public int getRandomNumber() { return 4; } - public InputRedundantReturn(double content) { + public InputRedundantReturnCheck(double content) { } public void setFormat() { @@ -195,4 +195,4 @@ private static void foo1() { } } -} \ No newline at end of file +} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRedundantReturnFalsePositive.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRedundantReturnCheckFalsePositive.java similarity index 91% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRedundantReturnFalsePositive.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRedundantReturnCheckFalsePositive.java index 3fcdcd51b7..e868da31fd 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRedundantReturnFalsePositive.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRedundantReturnCheckFalsePositive.java @@ -2,9 +2,9 @@ import java.util.StringTokenizer; -public class InputRedundantReturnFalsePositive +public class InputRedundantReturnCheckFalsePositive { - public InputRedundantReturnFalsePositive(String text) { + public InputRedundantReturnCheckFalsePositive(String text) { try { StringTokenizer toks = new StringTokenizer(text, ";\n\r"); while (toks.hasMoreTokens()) { diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRedundantReturnMethodInInterface.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRedundantReturnCheckMethodInInterface.java similarity index 60% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRedundantReturnMethodInInterface.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRedundantReturnCheckMethodInInterface.java index 3155c125cd..8bce668d40 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRedundantReturnMethodInInterface.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRedundantReturnCheckMethodInInterface.java @@ -1,6 +1,6 @@ package com.github.sevntu.checkstyle.checks.coding; -public interface InputRedundantReturnMethodInInterface +public interface InputRedundantReturnCheckMethodInInterface { void applyContent(String content); } diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputReturnBooleanFromTernary.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputReturnBooleanFromTernaryCheck.java similarity index 89% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputReturnBooleanFromTernary.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputReturnBooleanFromTernaryCheck.java index 19eacd2387..d2453b217d 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputReturnBooleanFromTernary.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputReturnBooleanFromTernaryCheck.java @@ -1,6 +1,6 @@ package com.github.sevntu.checkstyle.checks.coding; -public class InputReturnBooleanFromTernary{ +public class InputReturnBooleanFromTernaryCheck{ public void logged() { boolean i1 = true ? false : true; diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputReturnNullInsteadOfBoolean.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputReturnNullInsteadOfBooleanCheck.java similarity index 90% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputReturnNullInsteadOfBoolean.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputReturnNullInsteadOfBooleanCheck.java index 3cb5513323..69096d6a8e 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputReturnNullInsteadOfBoolean.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputReturnNullInsteadOfBooleanCheck.java @@ -1,6 +1,6 @@ package com.github.sevntu.checkstyle.checks.coding; -public class InputReturnNullInsteadOfBoolean{ +public class InputReturnNullInsteadOfBooleanCheck{ public Boolean test1() { int i = 1; @@ -25,7 +25,7 @@ public Boolean testMethod(){ }; } - public InputReturnNullInsteadOfBoolean(){ + public InputReturnNullInsteadOfBooleanCheck(){ return; //here was NPE once apon a time } diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotation.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotationCheck.java similarity index 94% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotation.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotationCheck.java index 4bcbbf0808..f428b4500c 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotation.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotationCheck.java @@ -1,5 +1,5 @@ package com.github.sevntu.checkstyle.checks.coding; -public class InputSimpleAccessorNameNotation { +public class InputSimpleAccessorNameNotationCheck { private int mFirst; private int mSecond; private int mA; @@ -77,7 +77,7 @@ int getTest2() { } private static Object sfield; public void setTest3(int test) throws Exception { - InputSimpleAccessorNameNotation.sfield = sfield; + InputSimpleAccessorNameNotationCheck.sfield = sfield; } } interface InnerIterface { diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotation1.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotationCheck1.java similarity index 90% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotation1.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotationCheck1.java index 3b02a33f32..40dd1577b3 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotation1.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotationCheck1.java @@ -1,5 +1,5 @@ package com.github.sevntu.checkstyle.checks.coding; -public class InputSimpleAccessorNameNotation1 +public class InputSimpleAccessorNameNotationCheck1 { private String field1; private int mField2; diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotation2.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotationCheck2.java similarity index 94% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotation2.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotationCheck2.java index 52bb9bc169..f62544083c 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotation2.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotationCheck2.java @@ -1,5 +1,5 @@ package com.github.sevntu.checkstyle.checks.coding; -public class InputSimpleAccessorNameNotation2 +public class InputSimpleAccessorNameNotationCheck2 { private String field1; private int field2; diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotation3.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotationCheck3.java similarity index 90% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotation3.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotationCheck3.java index 5ff459c584..db1e7ac9ff 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotation3.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotationCheck3.java @@ -1,5 +1,5 @@ package com.github.sevntu.checkstyle.checks.coding; -public class InputSimpleAccessorNameNotation3 +public class InputSimpleAccessorNameNotationCheck3 { private String field1; private int mField2; diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotation4.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotationCheck4.java similarity index 90% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotation4.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotationCheck4.java index 84ccbe0749..4ca280db5a 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotation4.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotationCheck4.java @@ -1,5 +1,5 @@ package com.github.sevntu.checkstyle.checks.coding; -public class InputSimpleAccessorNameNotation4 +public class InputSimpleAccessorNameNotationCheck4 { private String field1; private int mField2; diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotation5.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotationCheck5.java similarity index 92% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotation5.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotationCheck5.java index f99e9c7bb9..50e0c34bb3 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotation5.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotationCheck5.java @@ -1,5 +1,5 @@ package com.github.sevntu.checkstyle.checks.coding; -public class InputSimpleAccessorNameNotation5 +public class InputSimpleAccessorNameNotationCheck5 { private boolean field1; private boolean field2; diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotation6.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotationCheck6.java similarity index 88% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotation6.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotationCheck6.java index 904ff02f1d..436c317ba4 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotation6.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotationCheck6.java @@ -1,6 +1,6 @@ package com.github.sevntu.checkstyle.checks.coding; -public class InputSimpleAccessorNameNotation6 +public class InputSimpleAccessorNameNotationCheck6 { public static void updateCheckSum(final String metadataFile, String metadataFileSum, String hashFunction) diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotation7.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotationCheck7.java similarity index 58% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotation7.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotationCheck7.java index 2af00e7da3..f44d4ee20c 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotation7.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputSimpleAccessorNameNotationCheck7.java @@ -1,6 +1,6 @@ package com.github.sevntu.checkstyle.checks.coding; -public interface InputSimpleAccessorNameNotation7 +public interface InputSimpleAccessorNameNotationCheck7 { String getSmth(); } diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUnnecessaryParentheses.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUnnecessaryParenthesesExtendedCheck.java old mode 100755 new mode 100644 similarity index 97% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUnnecessaryParentheses.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUnnecessaryParenthesesExtendedCheck.java index 580f47a4e3..fd8bab2ce4 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUnnecessaryParentheses.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUnnecessaryParenthesesExtendedCheck.java @@ -1,5 +1,5 @@ package com.github.sevntu.checkstyle.checks.coding; -public class InputUnnecessaryParentheses { +public class InputUnnecessaryParenthesesExtendedCheck { int f1() { int x = 0; for (int i = (0+1); ((i) < (6+6)); i += (1+0)) { diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/Input15Extensions.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUnnecessaryParenthesesExtendedCheck2.java old mode 100755 new mode 100644 similarity index 90% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/Input15Extensions.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUnnecessaryParenthesesExtendedCheck2.java index 7e27230792..dfffb0671a --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/Input15Extensions.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUnnecessaryParenthesesExtendedCheck2.java @@ -6,7 +6,7 @@ } @MyAnnotation1(name = "ABC", version = 1) -public class Input15Extensions +public class InputUnnecessaryParenthesesExtendedCheck2 { } diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUnnecessaryParenthesesUbv.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUnnecessaryParenthesesExtendedCheckUbv.java similarity index 97% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUnnecessaryParenthesesUbv.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUnnecessaryParenthesesExtendedCheckUbv.java index 634c2e89c4..f2a1707bbc 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUnnecessaryParenthesesUbv.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUnnecessaryParenthesesExtendedCheckUbv.java @@ -1,5 +1,5 @@ package com.github.sevntu.checkstyle.checks.coding; -public class InputUnnecessaryParenthesesUbv { +public class InputUnnecessaryParenthesesExtendedCheckUbv { int f1() { int x = 0; for (int i = (0+1); ((i) < (6+6)); i += (1+0)) { diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCall1.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCall1.java deleted file mode 100644 index 6bec1fd301..0000000000 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCall1.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.github.sevntu.checkstyle.checks.coding; - -public class InputUselessSuperCtorCall1 -{ - public InputUselessSuperCtorCall1() - { - super(); - } -} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCall2.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCall2.java deleted file mode 100644 index aee4f08b37..0000000000 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCall2.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.github.sevntu.checkstyle.checks.coding; - -public class InputUselessSuperCtorCall2 extends java.lang.Object -{ - public InputUselessSuperCtorCall2() - { - super(); - } -} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCall3.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCall3.java deleted file mode 100644 index 1690147724..0000000000 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCall3.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.github.sevntu.checkstyle.checks.coding; - -public class InputUselessSuperCtorCall3 -{ - public InputUselessSuperCtorCall3() - { - super(); - } - - public InputUselessSuperCtorCall3(int i) - { - super(); - } -} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCall6.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCall6.java deleted file mode 100644 index f9f8776654..0000000000 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCall6.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.github.sevntu.checkstyle.checks.coding; - -public class InputUselessSuperCtorCall6 extends java.lang.Object -{ - public InputUselessSuperCtorCall6() { - super(); - } -} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCallCheck1.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCallCheck1.java new file mode 100644 index 0000000000..d83a4bdd53 --- /dev/null +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCallCheck1.java @@ -0,0 +1,9 @@ +package com.github.sevntu.checkstyle.checks.coding; + +public class InputUselessSuperCtorCallCheck1 +{ + public InputUselessSuperCtorCallCheck1() + { + super(); + } +} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCallCheck2.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCallCheck2.java new file mode 100644 index 0000000000..e3b5db6103 --- /dev/null +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCallCheck2.java @@ -0,0 +1,9 @@ +package com.github.sevntu.checkstyle.checks.coding; + +public class InputUselessSuperCtorCallCheck2 extends java.lang.Object +{ + public InputUselessSuperCtorCallCheck2() + { + super(); + } +} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCallCheck3.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCallCheck3.java new file mode 100644 index 0000000000..cca876ca9f --- /dev/null +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCallCheck3.java @@ -0,0 +1,14 @@ +package com.github.sevntu.checkstyle.checks.coding; + +public class InputUselessSuperCtorCallCheck3 +{ + public InputUselessSuperCtorCallCheck3() + { + super(); + } + + public InputUselessSuperCtorCallCheck3(int i) + { + super(); + } +} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCall4.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCallCheck4.java similarity index 69% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCall4.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCallCheck4.java index fca2f2f4e6..c17ca27c7a 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCall4.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCallCheck4.java @@ -1,6 +1,6 @@ package com.github.sevntu.checkstyle.checks.coding; -public class InputUselessSuperCtorCall4 extends java.lang.Object +public class InputUselessSuperCtorCallCheck4 extends java.lang.Object { public class Inner { diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCall5.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCallCheck5.java similarity index 88% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCall5.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCallCheck5.java index 88b10c0020..e822d2ebfe 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCall5.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCallCheck5.java @@ -3,7 +3,7 @@ import java.io.File; import java.io.PrintWriter; -public class InputUselessSuperCtorCall5 +public class InputUselessSuperCtorCallCheck5 { private static class Base { diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCallCheck6.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCallCheck6.java new file mode 100644 index 0000000000..6dd096ce84 --- /dev/null +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCallCheck6.java @@ -0,0 +1,8 @@ +package com.github.sevntu.checkstyle.checks.coding; + +public class InputUselessSuperCtorCallCheck6 extends java.lang.Object +{ + public InputUselessSuperCtorCallCheck6() { + super(); + } +} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCall7.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCallCheck7.java similarity index 92% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCall7.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCallCheck7.java index 1b32c0044f..bebe958384 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCall7.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputUselessSuperCtorCallCheck7.java @@ -1,6 +1,6 @@ package com.github.sevntu.checkstyle.checks.coding; -public class InputUselessSuperCtorCall7 +public class InputUselessSuperCtorCallCheck7 { class Base { diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputWhitespaceBeforeArrayIntializer.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputWhitespaceBeforeArrayInitializerCheck.java similarity index 93% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputWhitespaceBeforeArrayIntializer.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputWhitespaceBeforeArrayInitializerCheck.java index b56fa76b7f..cec4281504 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputWhitespaceBeforeArrayIntializer.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputWhitespaceBeforeArrayInitializerCheck.java @@ -1,6 +1,6 @@ package com.github.sevntu.checkstyle.checks.coding; -public class InputWhitespaceBeforeArrayIntializer { +public class InputWhitespaceBeforeArrayInitializerCheck { public void check(String[] args) { calculate(new int[]{1,2,3,4}); int[] ints0 = {1,2,3,4}; diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/MyMap.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/external/InputMyMap.java similarity index 87% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/MyMap.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/external/InputMyMap.java index b8ac165500..822b218737 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/MyMap.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/external/InputMyMap.java @@ -1,10 +1,10 @@ -package com.github.sevntu.checkstyle.checks.coding; +package com.github.sevntu.checkstyle.checks.coding.external; import java.util.Collection; import java.util.Map; import java.util.Iterator; import java.util.Set; -public class MyMap implements Iterable, Map +public class InputMyMap implements Iterable, Map { @@ -93,7 +93,7 @@ public Collection values() } - public Set> entrySet() + public Set> entrySet() { return null; } diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputAvoidConditionInversion.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputAvoidConditionInversionCheck.java similarity index 97% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputAvoidConditionInversion.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputAvoidConditionInversionCheck.java index 263cb3b32e..4afee0e74f 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputAvoidConditionInversion.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputAvoidConditionInversionCheck.java @@ -1,6 +1,6 @@ package com.github.sevntu.checkstyle.checks.design; import java.util.*; -public class InputAvoidConditionInversion +public class InputAvoidConditionInversionCheck { private boolean flag = false; private boolean isDifferent(int a, int b) { diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCauseParameterInException3.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCauseParameterInException3.java deleted file mode 100644 index 0dcb2ee361..0000000000 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCauseParameterInException3.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.github.sevntu.checkstyle.checks.design; -@SuppressWarnings("serial") -public class InputCauseParameterInException3 extends RuntimeException { - - public InputCauseParameterInException3() { - super(); - } - - public InputCauseParameterInException3(String message) { - super(message); - } - - public InputCauseParameterInException3(Throwable cause) { - super(cause); - } - - public InputCauseParameterInException3(String message, Throwable cause) { - super(message, cause); - } - -} \ No newline at end of file diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCauseParameterInException4.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCauseParameterInException4.java deleted file mode 100644 index 26b6063032..0000000000 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCauseParameterInException4.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.github.sevntu.checkstyle.checks.design; -public class InputCauseParameterInException4 extends Exception { - -public InputCauseParameterInException4(Exception cause) { - super(cause); - } -} - diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCauseParameterInException5.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCauseParameterInException5.java deleted file mode 100644 index 1fe289c55e..0000000000 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCauseParameterInException5.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.github.sevntu.checkstyle.checks.design; -public enum InputCauseParameterInException5{ - B; - private InputCauseParameterInException5() {} -} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCauseParameterInException.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCauseParameterInExceptionCheck.java similarity index 69% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCauseParameterInException.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCauseParameterInExceptionCheck.java index d87a63786a..cb30e55347 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCauseParameterInException.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCauseParameterInExceptionCheck.java @@ -1,9 +1,9 @@ package com.github.sevntu.checkstyle.checks.design; -public class InputCauseParameterInException extends Exception +public class InputCauseParameterInExceptionCheck { - - public InputCauseParameterInException(String str) + private class TestException extends Exception { + public TestException(String str) { super(str, null); } @@ -28,9 +28,9 @@ public MyException(String str, Exception ex) // Exception | Throwable only! } - public InputCauseParameterInException(String str, int integer) + public TestException(String str, int integer) { super(str, null); } - -} \ No newline at end of file + } +} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCauseParameterInException2.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCauseParameterInExceptionCheck2.java similarity index 65% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCauseParameterInException2.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCauseParameterInExceptionCheck2.java index 29b88cc5e8..b0aaab7e6a 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCauseParameterInException2.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCauseParameterInExceptionCheck2.java @@ -1,14 +1,14 @@ package com.github.sevntu.checkstyle.checks.design; -public class InputCauseParameterInException2 extends Exception +public class InputCauseParameterInExceptionCheck2 { - - public InputCauseParameterInException2(String str) + private class TestException2 extends Exception { + public TestException2(String str) { super(str, null); } - public InputCauseParameterInException2(String str, int integer) + public TestException2(String str, int integer) { super(str, null); } @@ -28,5 +28,5 @@ public MyException2(String str, int integer) } } - -} \ No newline at end of file + } +} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCauseParameterInExceptionCheck3.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCauseParameterInExceptionCheck3.java new file mode 100644 index 0000000000..a42343aa80 --- /dev/null +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCauseParameterInExceptionCheck3.java @@ -0,0 +1,21 @@ +package com.github.sevntu.checkstyle.checks.design; +@SuppressWarnings("serial") +public class InputCauseParameterInExceptionCheck3 extends RuntimeException { + + public InputCauseParameterInExceptionCheck3() { + super(); + } + + public InputCauseParameterInExceptionCheck3(String message) { + super(message); + } + + public InputCauseParameterInExceptionCheck3(Throwable cause) { + super(cause); + } + + public InputCauseParameterInExceptionCheck3(String message, Throwable cause) { + super(message, cause); + } + +} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCauseParameterInExceptionCheck4.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCauseParameterInExceptionCheck4.java new file mode 100644 index 0000000000..dd22cb6212 --- /dev/null +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCauseParameterInExceptionCheck4.java @@ -0,0 +1,8 @@ +package com.github.sevntu.checkstyle.checks.design; +public class InputCauseParameterInExceptionCheck4 extends Exception { + +public InputCauseParameterInExceptionCheck4(Exception cause) { + super(cause); + } +} + diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCauseParameterInExceptionCheck5.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCauseParameterInExceptionCheck5.java new file mode 100644 index 0000000000..8ff924d2d3 --- /dev/null +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCauseParameterInExceptionCheck5.java @@ -0,0 +1,5 @@ +package com.github.sevntu.checkstyle.checks.design; +public enum InputCauseParameterInExceptionCheck5{ + B; + private InputCauseParameterInExceptionCheck5() {} +} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputForbidWildcardAsReturnType.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputForbidWildcardAsReturnTypeCheck.java similarity index 99% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputForbidWildcardAsReturnType.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputForbidWildcardAsReturnTypeCheck.java index 925644cb0f..b09d629ad6 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputForbidWildcardAsReturnType.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputForbidWildcardAsReturnTypeCheck.java @@ -335,7 +335,7 @@ class MyClass {} class A extends MyClass{} class B extends A{} -public class InputForbidWildcardAsReturnType +public class InputForbidWildcardAsReturnTypeCheck { public static void main(String args[]) { A objA = max(new ArrayList()); diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputArrayTypeStyle.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputHideUtilityClassConstructorCheck.java old mode 100755 new mode 100644 similarity index 95% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputArrayTypeStyle.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputHideUtilityClassConstructorCheck.java index ab74fe4b42..b75ecd111f --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputArrayTypeStyle.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputHideUtilityClassConstructorCheck.java @@ -8,7 +8,7 @@ * Test case for ArrayTypeStyle (Java vs C) * @author lkuehne **/ -public class InputArrayTypeStyle +public class InputHideUtilityClassConstructorCheck { private int[] javaStyle = new int[0]; private int cStyle[] = new int[0]; diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputHideUtilityClassContructor1.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputHideUtilityClassConstructorCheck1.java similarity index 61% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputHideUtilityClassContructor1.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputHideUtilityClassConstructorCheck1.java index cd9ad96095..396d9b1377 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputHideUtilityClassContructor1.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputHideUtilityClassConstructorCheck1.java @@ -2,7 +2,7 @@ import java.io.Serializable; -public abstract class InputHideUtilityClassContructor1 implements Serializable { +public abstract class InputHideUtilityClassConstructorCheck1 implements Serializable { private static final long serialVersionUID = 1L; } diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputHideUtilityClassContructor2.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputHideUtilityClassConstructorCheck2.java similarity index 64% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputHideUtilityClassContructor2.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputHideUtilityClassConstructorCheck2.java index b2467eb8fb..4d13e2f663 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputHideUtilityClassContructor2.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputHideUtilityClassConstructorCheck2.java @@ -2,7 +2,7 @@ import java.io.Serializable; -public class InputHideUtilityClassContructor2 implements Serializable { +public class InputHideUtilityClassConstructorCheck2 implements Serializable { private static final long serialVersionUID = 1L; } diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputHideUtilityClassContructor3.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputHideUtilityClassConstructorCheck3.java similarity index 88% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputHideUtilityClassContructor3.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputHideUtilityClassConstructorCheck3.java index 089f1aac23..98d893e807 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputHideUtilityClassContructor3.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputHideUtilityClassConstructorCheck3.java @@ -2,10 +2,10 @@ import java.io.Serializable; -public class InputHideUtilityClassContructor3 implements Serializable { +public class InputHideUtilityClassConstructorCheck3 implements Serializable { private static final long serialVersionUID = 1L; - public InputHideUtilityClassContructor3(int i) { + public InputHideUtilityClassConstructorCheck3(int i) { // no code } diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputDesignForExtension.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputHideUtilityClassConstructorCheck4.java old mode 100755 new mode 100644 similarity index 96% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputDesignForExtension.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputHideUtilityClassConstructorCheck4.java index 994ae6f12d..82194b8b04 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputDesignForExtension.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputHideUtilityClassConstructorCheck4.java @@ -8,7 +8,7 @@ * Test case for the "design for inheritance" check. * @author Lars Kühne **/ -public abstract class InputDesignForExtension +public abstract class InputHideUtilityClassConstructorCheck4 { // some methods that are OK diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputNonUtilityClass.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputHideUtilityClassConstructorCheck5.java old mode 100755 new mode 100644 similarity index 77% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputNonUtilityClass.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputHideUtilityClassConstructorCheck5.java index 1eac488937..1e5b57a27c --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputNonUtilityClass.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputHideUtilityClassConstructorCheck5.java @@ -6,10 +6,10 @@ /** * Not a util class because it's not directly derived from java.lang.Object. */ -public class InputNonUtilityClass extends JPanel +public class InputHideUtilityClassConstructorCheck5 extends JPanel { /** HideUtilityClassConstructorCheck should not report this */ - public InputNonUtilityClass() + public InputHideUtilityClassConstructorCheck5() { this.setPreferredSize(new Dimension(100, 100)); } diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputRegression.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputHideUtilityClassConstructorCheck6.java old mode 100755 new mode 100644 similarity index 56% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputRegression.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputHideUtilityClassConstructorCheck6.java index e37b5cd153..875ee8867f --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputRegression.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputHideUtilityClassConstructorCheck6.java @@ -5,12 +5,12 @@ * * @author lkuehne */ -public class InputRegression +public class InputHideUtilityClassConstructorCheck6 { public long constructionTime = System.currentTimeMillis(); - public static InputRegression create() + public static InputHideUtilityClassConstructorCheck6 create() { - return new InputRegression(); + return new InputHideUtilityClassConstructorCheck6(); } -} \ No newline at end of file +} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputStaticMethodCandidate.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputStaticMethodCandidateCheck.java similarity index 96% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputStaticMethodCandidate.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputStaticMethodCandidateCheck.java index 02aed24769..70c895c9e4 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputStaticMethodCandidate.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputStaticMethodCandidateCheck.java @@ -8,7 +8,7 @@ import com.puppycrawl.tools.checkstyle.utils.ScopeUtils; -public class InputStaticMethodCandidate extends ClassB { +public class InputStaticMethodCandidateCheck extends ClassB { protected int instanceField; private static int classField; @@ -54,8 +54,8 @@ private static class Nested { private static int nestedClassField; private void nestedFoo1() { //violation - InputStaticMethodCandidate local = new InputStaticMethodCandidate(); - InputStaticMethodCandidate.classField = local.instanceField; + InputStaticMethodCandidateCheck local = new InputStaticMethodCandidateCheck(); + InputStaticMethodCandidateCheck.classField = local.instanceField; Nested nested = new Nested(); nested.nestedClassField = nestedClassField + local.classField; nested.nestedFoo4(); @@ -154,7 +154,7 @@ public void foo(String i) { } // ok, as only private methods are checked } -class TestExtended extends InputStaticMethodCandidate { +class TestExtended extends InputStaticMethodCandidateCheck { static {int i = 1;} {int i = 2;} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputStaticMethodCandidateSkippedMethods.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputStaticMethodCandidateCheckSkippedMethods.java similarity index 74% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputStaticMethodCandidateSkippedMethods.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputStaticMethodCandidateCheckSkippedMethods.java index a5e6c3f59b..0b5f87095f 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputStaticMethodCandidateSkippedMethods.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputStaticMethodCandidateCheckSkippedMethods.java @@ -3,7 +3,7 @@ /** * */ -public class InputStaticMethodCandidateSkippedMethods { +public class InputStaticMethodCandidateCheckSkippedMethods { private void foo() {} private void foo(int i) {} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/naming/InputAbstractClassName.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/naming/InputAbstractClassName.java deleted file mode 100644 index ea90eaf87a..0000000000 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/naming/InputAbstractClassName.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.github.sevntu.checkstyle.checks.naming; - -abstract public class InputAbstractClassName { -} -// abstract --> ^Abstract.*$|^.*Factory$ -abstract class NonAbstractClassName { -} - -abstract class FactoryWithBadName { -} - -abstract class AbstractClassName { - abstract class NonAbstractInnerClass { - } -} - -abstract class ClassFactory { - abstract class WellNamedFactory { - } -} - -class NonAbstractClass { -} - -//^Abstract.*$|^.*Factory$ --> abstract -class AbstractClass { -} - -class Class1Factory { -} - -abstract class AbstractClassName2 { - class AbstractInnerClass { - } -} - -abstract class Class2Factory { - class WellNamedFactory { - } -} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/naming/InputInterfaceTypeParameterName.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/naming/InputInterfaceTypeParameterNameCheck.java similarity index 80% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/naming/InputInterfaceTypeParameterName.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/naming/InputInterfaceTypeParameterNameCheck.java index 6d63e4d22e..33abda0fe3 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/naming/InputInterfaceTypeParameterName.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/naming/InputInterfaceTypeParameterNameCheck.java @@ -2,7 +2,7 @@ import java.util.List; -public interface InputInterfaceTypeParameterName { +public interface InputInterfaceTypeParameterNameCheck { } @@ -17,4 +17,4 @@ interface ThirdInterface { class OuterClass { interface InnerInterface { } -} \ No newline at end of file +} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/sizes/InputLineLengthCheck.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/sizes/InputLineLengthCheck.java deleted file mode 100644 index b2121b758e..0000000000 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/sizes/InputLineLengthCheck.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.github.sevntu.checkstyle.checks.sizes; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -public class InputLineLengthCheck { - - public InputLineLengthCheck() { - - } - - Map> mTempVariableForCheck = new HashMap>(); - - public static HashMap newInstance(int mParametr1, int mParametr2, int mParametr3) throws IndexOutOfBoundsException, InstantiationException, IllegalMonitorStateException { - String str = "This InputLineLengthCheck contains declaration of class, constructor, field and method. Their length is more then 120 characters, but it should be ignored"; - System.out.println(str); - return new HashMap(); - } - - class InnerClassCheck - { - Map> mTempVariableForInnerClass = new HashMap>(); - - public HashMap newInstanceForInnerClass(int mParametr1, int mParametr2, int mParametr3) throws IndexOutOfBoundsException, InstantiationException, IllegalMonitorStateException { - String str = "This InputLineLengthCheck contains declaration of class, constructor, field and method in Inner Class. Their length is more then 120 characters, but it should be ignored"; - System.out.println(str); - return new HashMap(); - } - } -} - -abstract class AbstractTreeNodeEntityModel, N extends InputLineLengthCheck> -extends InputLineLengthCheck { - /* (non-Javadoc) - * @see com.revere.ria.workbench.spring.config.xml.AbstractDescriptorDefinitionParser#parseDescriptorAttributes(org.w3c.dom.Element, org.springframework.beans.factory.support.BeanDefinitionBuilder, org.springframework.beans.factory.xml.ParserContext) - */ - protected void parseDescriptorAttributes(String element, - Integer beanBuilder, Double parserContext) { - } - //This is a vary long coment, This is a vary long coment, This is a vary long coment, This is a vary long coment, This is a vary long coment, This is a vary long coment, This is a vary long coment, This is a vary long coment, This is a vary long coment! - - /* Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text - * Some text Some text Some text Some text Some text Some text Some text Some text - * Some text*/ -} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/sizes/InputSimple.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/sizes/InputLineLengthExtendedCheck.java similarity index 98% rename from sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/sizes/InputSimple.java rename to sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/sizes/InputLineLengthExtendedCheck.java index a6d62b291f..68ce0d507c 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/sizes/InputSimple.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/sizes/InputLineLengthExtendedCheck.java @@ -13,7 +13,7 @@ * - Order of modifiers * @author Oliver Burn **/ -final class InputSimple +final class InputLineLengthExtendedCheck { // Long line ---------------------------------------------------------------- // Contains a tab -> <- @@ -99,7 +99,7 @@ private void longMethod() } /** constructor that is 10 lines long **/ - private InputSimple() + private InputLineLengthExtendedCheck() { // a line // a line diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/test/utils/File.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/test/utils/File.java deleted file mode 100644 index 897511e15f..0000000000 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/test/utils/File.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.github.sevntu.checkstyle.checks.test.utils; - -public class File -{ - - public File(String string) - { - } - -} From 00d5853db7607a24bcc92342c5126782326353ae Mon Sep 17 00:00:00 2001 From: rnveach Date: Thu, 8 Dec 2016 21:22:25 -0500 Subject: [PATCH 039/208] Issue #551: verify inputs named after tests --- .../checkstyle/internal/AllChecksTest.java | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) 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 b3e0f5ae26..0f3be5a0b8 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 @@ -20,9 +20,13 @@ package com.github.sevntu.checkstyle.internal; import java.io.File; +import java.io.IOException; import java.lang.reflect.Field; import java.lang.reflect.Modifier; +import java.nio.file.Files; +import java.nio.file.Paths; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; @@ -103,6 +107,24 @@ public void testAllCheckstyleMessages() throws Exception { } } + @Test + public void testAllInputsHaveTest() throws Exception { + final Map> allTests = new HashMap<>(); + + Files.walk(Paths.get("src/test/java/com/github/sevntu/checkstyle")) + .forEach(filePath -> { + grabAllTests(allTests, filePath.toFile()); + }); + Files.walk(Paths.get("src/test/resources/com/github/sevntu/checkstyle")) + .forEach(filePath -> { + verifyInputFile(allTests, filePath.toFile()); + }); + Files.walk(Paths.get("src/test/resources-noncompilable/com/github/sevntu/checkstyle")) + .forEach(filePath -> { + verifyInputFile(allTests, filePath.toFile()); + }); + } + private static void verifyCheckstyleMessage(Map> usedMessages, Class module, Field message) throws Exception { final String messageString = message.get(null).toString(); @@ -141,6 +163,76 @@ private static void verifyCheckstyleMessage(Map> usedMessag result.trim().startsWith("TODO")); } + private static void grabAllTests(Map> allTests, File file) { + if (file.isFile() && file.getName().endsWith("Test.java")) { + String path = null; + + try { + path = getSimplePath(file.getCanonicalPath()).replace("Test.java", ""); + } + catch (IOException ex) { + throw new IllegalStateException(ex); + } + + final int slash = path.lastIndexOf(File.separatorChar); + final String packge = path.substring(0, slash); + + List classes = allTests.get(packge); + + if (classes == null) { + classes = new ArrayList(); + + allTests.put(packge, classes); + } + + classes.add(path.substring(slash + 1)); + } + } + + private static void verifyInputFile(Map> allTests, File file) { + if (file.isFile()) { + String fileName = file.getName().toString(); + String path = null; + + try { + path = getSimplePath(file.getCanonicalPath()); + } + catch (IOException ex) { + throw new IllegalStateException(ex); + } + + Assert.assertTrue("Resource must start with 'Input': " + path, + fileName.startsWith("Input")); + + final int period = fileName.lastIndexOf("."); + + Assert.assertTrue("Resource must have an extension: " + path, period > 0); + + 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); + + if (classes != null || !packge.endsWith("external")) { + Assert.assertNotNull("Resource must be in a package that has tests: " + path, + classes); + + boolean found = false; + + for (String clss : classes) { + if (fileName.startsWith(clss)) { + found = true; + break; + } + } + + Assert.assertTrue("Resource must be named after a Test like 'InputMyCheck.java' " + + "and be in the same package as the test: " + path, found); + } + } + } + /** * Removes 'Check' suffix from each class name in the set. * @param checks class instances. @@ -150,4 +242,8 @@ private static Set getFullNames(Set> checks) { return checks.stream().map(check -> check.getName().replace("Check", "")) .collect(Collectors.toSet()); } + + private static String getSimplePath(String path) { + return path.substring(path.lastIndexOf("com" + File.separator + "github")); + } } From d661971373b04af97e19991432e38aa4ebd434ce Mon Sep 17 00:00:00 2001 From: rnveach Date: Fri, 9 Dec 2016 10:10:51 -0500 Subject: [PATCH 040/208] Issue #550: added dynamic checkstyle regression --- .travis.yml | 10 + .../sevntu/checkstyle/internal/CheckUtil.java | 2 +- .../internal/CheckstyleRegressionTest.java | 177 ++++++++++++++++++ 3 files changed, 188 insertions(+), 1 deletion(-) create mode 100644 sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckstyleRegressionTest.java diff --git a/.travis.yml b/.travis.yml index 2f4757a258..9064505e25 100644 --- a/.travis.yml +++ b/.travis.yml @@ -58,6 +58,16 @@ matrix: - CMD3="&& mvn jacoco:report coveralls:jacoco" - 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 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" + - CMD=$CMD0$CMD1$CMD2$CMD3 + # testing of PR format - env: - DESC="test Issue ref in PR description" 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 182a361e74..1d440c41b8 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 @@ -58,7 +58,7 @@ public static Set getConfigCheckStyleChecks() { * file path of checkstyle_checks.xml. * @return names of checkstyle's checks which are referenced in checkstyle_checks.xml. */ - private static Set getCheckStyleChecksReferencedInConfig(String configFilePath) { + public static Set getCheckStyleChecksReferencedInConfig(String configFilePath) { try { final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); 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 new file mode 100644 index 0000000000..8eb2b1b6fc --- /dev/null +++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/internal/CheckstyleRegressionTest.java @@ -0,0 +1,177 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2016 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.internal; + +import static java.nio.charset.StandardCharsets.UTF_8; + +import java.io.File; +import java.nio.file.Files; +import java.nio.file.StandardOpenOption; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import java.util.Set; + +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"); + + // -@cs[CyclomaticComplexity] Can't split + @Test + public void setupFiles() throws Exception { + final String regressionPath = System.getProperty("regression-path"); + + if (regressionPath != null) { + final File path = new File(regressionPath); + + if (!path.exists()) { + throw new IllegalStateException("Invalid path: " + path.getAbsolutePath()); + } + + System.out.println("Working Path: " + path.getCanonicalPath()); + + final File project = new File(path, "checkstyle"); + + if (!project.exists() || !project.isDirectory()) { + throw new IllegalStateException("Can't find project: " + project.getAbsolutePath()); + } + + final File config = new File(project, "config/checkstyle_sevntu_checks.xml"); + + if (!config.exists() || !config.isFile() || !config.canRead() || !config.canWrite()) { + throw new IllegalStateException("Can't read config: " + config.getAbsolutePath()); + } + + System.out.println("Config Path: " + config.getCanonicalPath()); + + final File suppression = new File(project, "config/sevntu_suppressions.xml"); + + if (!suppression.exists() || !suppression.isFile() || !suppression.canRead() + || !suppression.canWrite()) { + throw new IllegalStateException("Can't read suppression: " + + suppression.getAbsolutePath()); + } + + System.out.println("Suppression Path: " + suppression.getCanonicalPath()); + + work(config, suppression); + + System.out.println("Done"); + } + } + + private static void work(File config, File suppression) throws Exception { + final Set configChecks = CheckUtil.getCheckStyleChecksReferencedInConfig(config + .getAbsolutePath()); + final List> sevntuChecks = new ArrayList<>(CheckUtil.getCheckstyleModules()); + + trimSevntuChecksNotReferenced(configChecks, sevntuChecks); + + String configContents = new String(Files.readAllBytes(config.toPath()), UTF_8); + String suppressionContents = new String(Files.readAllBytes(suppression.toPath()), UTF_8); + + if (sevntuChecks.size() > 0) { + System.out.println("Adding " + sevntuChecks.size() + " missing check(s)"); + + String configAdditions = ""; + String suppressionAdditions = ""; + + for (Class sevntuCheck : sevntuChecks) { + final String name = sevntuCheck.getName(); + final String simpleName = sevntuCheck.getSimpleName(); + + System.out.println("-- Adding Check: " + name); + + configAdditions += "\r\n"; + + if (ADD_CHECK_SUPPRESSIONS.contains(simpleName)) { + System.out.println("-- Adding Suppression: " + simpleName); + + suppressionAdditions += "\r\n"; + } + } + + int treeWalkerPosition = configContents.lastIndexOf(""); + treeWalkerPosition = configContents.indexOf('\n', treeWalkerPosition) + 1; + + configContents = configContents.substring(0, treeWalkerPosition) + configAdditions + + configContents.substring(treeWalkerPosition); + + Files.write(config.toPath(), configContents.getBytes(UTF_8), StandardOpenOption.CREATE); + + if (!suppressionAdditions.isEmpty()) { + final int position = suppressionContents.lastIndexOf(" configChecks, + List> sevntuChecks) { + for (String configCheck : configChecks) { + final int position = findCheck(sevntuChecks, configCheck); + + if (position == -1) { + System.err.println("Found module not in sevntu: " + configCheck); + } + else { + sevntuChecks.remove(position); + } + } + } + + // -@cs[ReturnCount] Not simple to reduce returns + private static int findCheck(Collection> checks, String findCheck) { + int position = 0; + + for (Class check : checks) { + final String simpleName = check.getSimpleName(); + + if (findCheck.endsWith("Check")) { + if (simpleName.equals(findCheck) || check.getName().equals(findCheck)) { + return position; + } + } + else { + if (simpleName.replaceAll("Check$", "").equals(findCheck) + || check.getName().replaceAll("Check$", "").equals(findCheck)) { + return position; + } + } + + position++; + } + + return -1; + } +} From 47129fb664747f0c1d301202ce2ff9f71207d2c8 Mon Sep 17 00:00:00 2001 From: rnveach Date: Fri, 9 Dec 2016 11:04:49 -0500 Subject: [PATCH 041/208] Pull #557: fixed exception in ConstructorWithoutParamsCheck --- .../design/ConstructorWithoutParamsCheck.java | 26 ++++++++++--------- .../ConstructorWithoutParamsCheckTest.java | 6 ++--- .../InputConstructorWithoutParamsCheck.java | 7 +++++ 3 files changed, 24 insertions(+), 15 deletions(-) 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 3f8ca02a9d..fdd5f1bdd3 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 @@ -149,23 +149,25 @@ public int[] getAcceptableTokens() { @Override public void visitToken(DetailAST ast) { + final DetailAST firstChild = ast.getFirstChild(); + if (firstChild != null) { + final String className = firstChild.getText(); - final String className = ast.getFirstChild().getText(); + // The "new" keyword either creates objects or declares arrays. + // In the case of arrays, no objects (array elements) are automatically created, + // and this check does not apply. + if (regexp.matcher(className).find() + && !ignoredRegexp.matcher(className).find() + && !ast.branchContains(TokenTypes.ARRAY_DECLARATOR)) { - // The "new" keyword either creates objects or declares arrays. - // In the case of arrays, no objects (array elements) are automatically created, - // and this check does not apply. - 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(); - final DetailAST parameterListAST = ast.findFirstToken(TokenTypes.ELIST); - final int numberOfParameters = parameterListAST.getChildCount(); + if (numberOfParameters == 0) { + log(ast, MSG_KEY, className); + } - if (numberOfParameters == 0) { - log(ast, MSG_KEY, className); } - } } } 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 a18a70371d..119e7257e4 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,7 +39,7 @@ public void getDefaultConfiguration() { @Test public void testDefaultConfigProhibitsExceptionsWithoutParams() throws Exception { - final String[] expectedViolationMsg = {"30:37: " + getCheckMessage(MSG_KEY, "RuntimeException")}; + final String[] expectedViolationMsg = {"35:37: " + getCheckMessage(MSG_KEY, "RuntimeException")}; verify(defaultConfig, getPath("InputConstructorWithoutParamsCheck.java"), expectedViolationMsg); } @@ -48,8 +48,8 @@ public void testUserDefinedConfigProhibitsCustomClasses() throws Exception { defaultConfig.addAttribute("classNameFormat", "Clazz[1-9]"); defaultConfig.addAttribute("ignoredClassNameFormat", "Clazz4"); final String[] expectedViolationMsg = { - "64:27: " + getCheckMessage(MSG_KEY, "Clazz1"), - "67:27: " + getCheckMessage(MSG_KEY, "Clazz2"), + "69:27: " + getCheckMessage(MSG_KEY, "Clazz1"), + "72:27: " + getCheckMessage(MSG_KEY, "Clazz2"), }; verify(defaultConfig, getPath("InputConstructorWithoutParamsCheck.java"), expectedViolationMsg); } 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 34f02d3407..1c3c075f13 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 @@ -20,7 +20,12 @@ package com.github.sevntu.checkstyle.checks.design; import java.util.Arrays; +import java.util.Collections; import java.util.List; +import java.util.Set; +import java.util.TreeSet; +import java.util.stream.Collectors; +import java.util.stream.Stream; public class InputConstructorWithoutParamsCheck { @@ -111,4 +116,6 @@ class MockExceptionHandler { } + private static final Set TEST = Collections.unmodifiableSortedSet(Stream.of("test") + .collect(Collectors.toCollection(TreeSet::new))); } From 863f1bf315d0df3d0bae9baa870af4f6a73341a9 Mon Sep 17 00:00:00 2001 From: Roman Ivanov Date: Sat, 10 Dec 2016 06:44:37 -0800 Subject: [PATCH 042/208] minor: fix non valid xml in javadoc --- .../checkstyle/checks/coding/AvoidModifiersForTypesCheck.java | 4 ++-- 1 file changed, 2 insertions(+), 2 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 4a9b705094..eb29437490 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 @@ -82,7 +82,7 @@ * <module name="AvoidModifiersForTypesCheck"> * <property name="forbiddenClassesRegexpAnnotation" value="Person"/> * </module> - * <module> + * </module> * * *
    @@ -116,7 +116,7 @@
      *          <property name="forbiddenClassesRegexpPublic" value="Logger"/>
      *          <property name="forbiddenClassesRegexpPackagePrivate" value="Logger"/>
      *      <module>
    - * <module>
    + * </module>
      * 
    * *
    
    From 3410d8163ef0989b327088508d65ba5fd1f25675 Mon Sep 17 00:00:00 2001
    From: Roman Ivanov 
    Date: Sat, 10 Dec 2016 07:06:08 -0800
    Subject: [PATCH 043/208] version bump to 1.23.0
    
    ---
     eclipse-pom.xml                              | 5 ++---
     eclipsecs-sevntu-plugin-feature/feature.xml  | 4 ++--
     eclipsecs-sevntu-plugin-feature/pom.xml      | 5 ++---
     eclipsecs-sevntu-plugin/META-INF/MANIFEST.MF | 2 +-
     eclipsecs-sevntu-plugin/pom.xml              | 5 ++---
     sevntu-checks/pom.xml                        | 5 ++---
     sevntu-checkstyle-idea-extension/pom.xml     | 5 ++---
     sevntu-checkstyle-maven-plugin/pom.xml       | 7 +++----
     sevntu-checkstyle-sonar-plugin/pom.xml       | 7 +++----
     update-site/pom.xml                          | 5 ++---
     10 files changed, 21 insertions(+), 29 deletions(-)
    
    diff --git a/eclipse-pom.xml b/eclipse-pom.xml
    index daf1f68323..99aa4691c7 100644
    --- a/eclipse-pom.xml
    +++ b/eclipse-pom.xml
    @@ -1,12 +1,11 @@
     
    -
    +
     
       4.0.0
     
       com.github.sevntu.checkstyle
       parent
    -  1.22.0
    +  1.23.0
       pom
     
       
    diff --git a/eclipsecs-sevntu-plugin-feature/feature.xml b/eclipsecs-sevntu-plugin-feature/feature.xml
    index 20e36f294f..e6c38f6c3a 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 dbd76812ee..0673f246ff 100644
    --- a/eclipsecs-sevntu-plugin-feature/pom.xml
    +++ b/eclipsecs-sevntu-plugin-feature/pom.xml
    @@ -1,6 +1,5 @@
     
    -
    +
     
       4.0.0
     
    @@ -8,7 +7,7 @@
         ../eclipse-pom.xml
         com.github.sevntu.checkstyle
         parent
    -    1.22.0
    +    1.23.0
       
     
       com.github.sevntu.checkstyle
    diff --git a/eclipsecs-sevntu-plugin/META-INF/MANIFEST.MF b/eclipsecs-sevntu-plugin/META-INF/MANIFEST.MF
    index d43188284e..51b3c5c325 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.22.0
    +Bundle-Version: 1.23.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 aaac8586ff..7e6ac8fda4 100644
    --- a/eclipsecs-sevntu-plugin/pom.xml
    +++ b/eclipsecs-sevntu-plugin/pom.xml
    @@ -1,6 +1,5 @@
     
    -
    +
     
       4.0.0
     
    @@ -10,7 +9,7 @@
         ../eclipse-pom.xml
         com.github.sevntu.checkstyle
         parent
    -    1.22.0
    +    1.23.0
       
     
       com.github.sevntu.checkstyle
    diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml
    index e228c7eb96..5ba815b6d2 100644
    --- a/sevntu-checks/pom.xml
    +++ b/sevntu-checks/pom.xml
    @@ -1,11 +1,10 @@
     
    -
    +
     
       4.0.0
       com.github.sevntu.checkstyle
       sevntu-checks
    -  1.22.0
    +  1.23.0
     
       
         iso-8859-1
    diff --git a/sevntu-checkstyle-idea-extension/pom.xml b/sevntu-checkstyle-idea-extension/pom.xml
    index ca06c41857..d497ed9f2d 100644
    --- a/sevntu-checkstyle-idea-extension/pom.xml
    +++ b/sevntu-checkstyle-idea-extension/pom.xml
    @@ -1,12 +1,11 @@
     
    -
    +
     
       4.0.0
     
       com.github.sevntu.checkstyle
       sevntu-checkstyle-idea-extension
    -  1.22.0
    +  1.23.0
       jar
     
       Sevntu Checkstyle Idea extension
    diff --git a/sevntu-checkstyle-maven-plugin/pom.xml b/sevntu-checkstyle-maven-plugin/pom.xml
    index a6a640cc47..5c026ffb44 100644
    --- a/sevntu-checkstyle-maven-plugin/pom.xml
    +++ b/sevntu-checkstyle-maven-plugin/pom.xml
    @@ -1,18 +1,17 @@
     
    -
    +
     
       4.0.0
       com.github.sevntu.checkstyle
       sevntu-checkstyle-maven-plugin
       Sevntu Checkstyle Maven Plugin
    -  1.22.0
    +  1.23.0
     
       
         
           com.github.sevntu.checkstyle
           sevntu-checks
    -      1.22.0
    +      1.23.0
         
         
           org.apache.maven.plugins
    diff --git a/sevntu-checkstyle-sonar-plugin/pom.xml b/sevntu-checkstyle-sonar-plugin/pom.xml
    index 2775b6a849..69d0d5e235 100644
    --- a/sevntu-checkstyle-sonar-plugin/pom.xml
    +++ b/sevntu-checkstyle-sonar-plugin/pom.xml
    @@ -1,11 +1,10 @@
     
    -
    +
     
       4.0.0
       com.github.sevntu.checkstyle
       sevntu-checkstyle-sonar-plugin
    -  1.22.0
    +  1.23.0
       sonar-plugin
     
       SevNTU Checkstyle Sonar Extension Plugin
    @@ -238,7 +237,7 @@
                             
                           
                           
    -                        
    +                        
                           
                         
                       
    diff --git a/update-site/pom.xml b/update-site/pom.xml
    index b30e27b106..a7ae4136fe 100644
    --- a/update-site/pom.xml
    +++ b/update-site/pom.xml
    @@ -1,6 +1,5 @@
     
    -
    +
     
       4.0.0
     
    @@ -8,7 +7,7 @@
         ../eclipse-pom.xml
         com.github.sevntu.checkstyle
         parent
    -    1.22.0
    +    1.23.0
       
     
       com.github.sevntu.checkstyle.p2updatesite
    
    From 9e79905b745c6de35e1c6843da9c720a584d1e94 Mon Sep 17 00:00:00 2001
    From: Roman Ivanov 
    Date: Sat, 31 Dec 2016 07:52:30 -0800
    Subject: [PATCH 044/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 5ba815b6d2..c29fab2808 100644
    --- a/sevntu-checks/pom.xml
    +++ b/sevntu-checks/pom.xml
    @@ -8,7 +8,7 @@
     
       
         iso-8859-1
    -    7.3
    +    7.4
         
         7.2
         2.17
    
    From 4719c10803592101f2667cd973de662a4baf49a0 Mon Sep 17 00:00:00 2001
    From: Roman Ivanov 
    Date: Sat, 31 Dec 2016 08:02:44 -0800
    Subject: [PATCH 045/208] minor: fix for violtion from checkstyle 7.4
     (ImportOrder: Extra separation in import group before)
    
    ---
     .../checks/design/ForbidWildcardAsReturnTypeCheck.java           | 1 -
     1 file changed, 1 deletion(-)
    
    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 ea59c4e7ac..043b0315c4 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
    @@ -26,7 +26,6 @@
     import java.util.regex.Pattern;
     
     import antlr.collections.AST;
    -
     import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
     import com.puppycrawl.tools.checkstyle.api.DetailAST;
     import com.puppycrawl.tools.checkstyle.api.TokenTypes;
    
    From 529dbd0fabd4dc549b8f14ab89a2281132140636 Mon Sep 17 00:00:00 2001
    From: rnveach 
    Date: Wed, 7 Dec 2016 13:18:14 -0500
    Subject: [PATCH 046/208] Issue #520: 100% coverage for ChildBlockLengthCheck
    
    ---
     sevntu-checks/pom.xml                             |  1 -
     .../checks/design/ChildBlockLengthCheck.java      | 15 ++++-----------
     .../checks/design/InputChildBlockLengthCheck.java | 13 +++++++++++--
     .../InputChildBlockLengthCheckDoubleNested.java   |  9 +++++++++
     ...ChildBlockLengthCheckManyBlocksOnOneScope.java | 11 +++++++++++
     5 files changed, 35 insertions(+), 14 deletions(-)
    
    diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml
    index c29fab2808..c76ff5a98b 100644
    --- a/sevntu-checks/pom.xml
    +++ b/sevntu-checks/pom.xml
    @@ -160,7 +160,6 @@
                   .*.checks.coding.MapIterationInForEachLoopCheck9098
                   .*.checks.coding.NoNullForCollectionReturnCheck8596
                   .*.checks.coding.OverridableMethodInConstructorCheck8899
    -              .*.checks.design.ChildBlockLengthCheck89100
                   .*.checks.design.HideUtilityClassConstructorCheck94100
                   .*.checks.naming.EnumValueNameCheck86100
                 
    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 bac66d4095..63fd14ac25 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
    @@ -186,16 +186,9 @@ private List getChildBlocks(DetailAST blockOpeningBrace,
     
             DetailAST curNode = blockOpeningBrace;
     
    -        while (curNode != null) {
    -            // before node visiting
    -            if (curNode == blockClosingBrace) {
    -                // stop at closing brace
    -                break;
    -            }
    -            else {
    -                if (isAllowedBlockType(curNode.getType())) {
    -                    childBlocks.add(curNode);
    -                }
    +        while (curNode != blockClosingBrace) {
    +            if (isAllowedBlockType(curNode.getType())) {
    +                childBlocks.add(curNode);
                 }
                 // before node leaving
                 DetailAST nextNode = curNode.getFirstChild();
    @@ -207,7 +200,7 @@ private List getChildBlocks(DetailAST blockOpeningBrace,
                     nextNode = curNode.getNextSibling();
                 }
     
    -            while ((curNode != null) && (nextNode == null)) {
    +            while (nextNode == null) {
                     // leave the visited node
                     nextNode = curNode.getNextSibling();
                     if (nextNode == null) {
    diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputChildBlockLengthCheck.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputChildBlockLengthCheck.java
    index 495a29681e..c0d7d9f56e 100644
    --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputChildBlockLengthCheck.java
    +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputChildBlockLengthCheck.java
    @@ -14,7 +14,7 @@ public static void main(String[] args)
               if (isTrue()) { // 2: simple if with braces
                   number = 2;
               }
    -                    
    +
               if (isTrue()) { // 3: if-else     
                   number = 3; 
               } else {
    @@ -57,8 +57,17 @@ public static void main(String[] args)
               default:
                   number = 15;
                   break;          
    -          }        
    +          }
    +
    +          try {
    +          } 
    +          catch (Exception e) {
    +          }
    +          finally
    +          {
    +          }
     
    +          if (isTrue()) {}
             }
     
         }
    diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputChildBlockLengthCheckDoubleNested.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputChildBlockLengthCheckDoubleNested.java
    index 0b6db7fb33..265b7a7451 100644
    --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputChildBlockLengthCheckDoubleNested.java
    +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputChildBlockLengthCheckDoubleNested.java
    @@ -49,4 +49,13 @@ public void nestedForFiveLevel() {
           }
         }
       }
    +
    +  public void inClass(int type) {
    +    switch (type) {
    +    case 3:
    +      new Object() {
    +        public void anonymousMethod() {}
    +      };
    +    }
    +  }
     }
    \ No newline at end of file
    diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputChildBlockLengthCheckManyBlocksOnOneScope.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputChildBlockLengthCheckManyBlocksOnOneScope.java
    index 4c6339ed61..aceb86c7ea 100644
    --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputChildBlockLengthCheckManyBlocksOnOneScope.java
    +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputChildBlockLengthCheckManyBlocksOnOneScope.java
    @@ -42,6 +42,17 @@ public static void main(String[] args)
     
         }
     
    +    public void test() {
    +        int number;
    +
    +        if (isTrue()) {
    +            if (isTrue())
    +                number = 3;
    +            else
    +                number = 3;
    +        }
    +    }
    +
         public static boolean isTrue() {
             return Boolean.TRUE;
         }
    
    From 1dcc6885540e150801b24f99cff5a01009cb0611 Mon Sep 17 00:00:00 2001
    From: rnveach 
    Date: Mon, 23 Jan 2017 17:13:08 -0500
    Subject: [PATCH 047/208] Issue #520: 100% coverage for EnumValueNameCheck
    
    ---
     sevntu-checks/pom.xml                                           | 1 -
     .../sevntu/checkstyle/checks/naming/EnumValueNameCheck.java     | 2 --
     2 files changed, 3 deletions(-)
    
    diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml
    index c76ff5a98b..b305a1153e 100644
    --- a/sevntu-checks/pom.xml
    +++ b/sevntu-checks/pom.xml
    @@ -161,7 +161,6 @@
                   .*.checks.coding.NoNullForCollectionReturnCheck8596
                   .*.checks.coding.OverridableMethodInConstructorCheck8899
                   .*.checks.design.HideUtilityClassConstructorCheck94100
    -              .*.checks.naming.EnumValueNameCheck86100
                 
               
             
    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 46589c9734..9980bb555f 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
    @@ -236,7 +236,6 @@ private boolean isClassEnumeration(DetailAST ast) {
         private static boolean
                 hasMembers(DetailAST ast, List excludes) {
             final DetailAST objBlock = ast.getParent();
    -        assert objBlock.getType() == TokenTypes.OBJBLOCK;
             boolean memberFound = false;
             for (DetailAST member = objBlock.getFirstChild(); member != null; member = member
                     .getNextSibling()) {
    @@ -244,7 +243,6 @@ private boolean isClassEnumeration(DetailAST ast) {
                         || member.getType() == TokenTypes.VARIABLE_DEF) {
                     final DetailAST memberIdent = member
                             .findFirstToken(TokenTypes.IDENT);
    -                assert memberIdent != null;
                     final String identifierStr = memberIdent.getText();
                     if (!isAnyMatched(excludes, identifierStr)) {
                         memberFound = true;
    
    From 514f257072dcaec2859ab67e1aac6996be511c38 Mon Sep 17 00:00:00 2001
    From: Roman Ivanov 
    Date: Wed, 25 Jan 2017 18:04:51 -0800
    Subject: [PATCH 048/208] config: define license version in pom.xml as
     LGPL-2.1+
    
    ---
     eclipse-pom.xml                          | 7 +++++++
     eclipsecs-sevntu-plugin-feature/pom.xml  | 7 +++++++
     eclipsecs-sevntu-plugin/pom.xml          | 7 +++++++
     sevntu-checks/pom.xml                    | 9 ++++++++-
     sevntu-checkstyle-idea-extension/pom.xml | 7 +++++++
     sevntu-checkstyle-maven-plugin/pom.xml   | 7 +++++++
     sevntu-checkstyle-sonar-plugin/pom.xml   | 9 ++++++++-
     update-site/pom.xml                      | 7 +++++++
     8 files changed, 58 insertions(+), 2 deletions(-)
    
    diff --git a/eclipse-pom.xml b/eclipse-pom.xml
    index 99aa4691c7..cbdf332fa8 100644
    --- a/eclipse-pom.xml
    +++ b/eclipse-pom.xml
    @@ -8,6 +8,13 @@
       1.23.0
       pom
     
    +  
    +    
    +      LGPL-2.1+
    +      http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
    +    
    +  
    +
       
         eclipsecs-sevntu-plugin
         eclipsecs-sevntu-plugin-feature
    diff --git a/eclipsecs-sevntu-plugin-feature/pom.xml b/eclipsecs-sevntu-plugin-feature/pom.xml
    index 0673f246ff..92978c10b0 100644
    --- a/eclipsecs-sevntu-plugin-feature/pom.xml
    +++ b/eclipsecs-sevntu-plugin-feature/pom.xml
    @@ -15,4 +15,11 @@
       eclipse-feature
       Extension for eclipse-cs Plugin with additional Checks
     
    +  
    +    
    +      LGPL-2.1+
    +      http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
    +    
    +  
    +
     
    diff --git a/eclipsecs-sevntu-plugin/pom.xml b/eclipsecs-sevntu-plugin/pom.xml
    index 7e6ac8fda4..1eb13345cd 100644
    --- a/eclipsecs-sevntu-plugin/pom.xml
    +++ b/eclipsecs-sevntu-plugin/pom.xml
    @@ -18,6 +18,13 @@
     
       eclipse-cs Sevntu Checkstyle Plugin
     
    +  
    +    
    +      LGPL-2.1+
    +      http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
    +    
    +  
    +
       
         7.2.0-SNAPSHOT
       
    diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml
    index b305a1153e..5ba4632d01 100644
    --- a/sevntu-checks/pom.xml
    +++ b/sevntu-checks/pom.xml
    @@ -15,6 +15,13 @@
         RELEASE
       
     
    +  
    +    
    +      LGPL-2.1+
    +      http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
    +    
    +  
    +
       
         
           com.puppycrawl.tools
    @@ -147,7 +154,7 @@
             
               
                 true
    -            
                 100
                 100
    diff --git a/sevntu-checkstyle-idea-extension/pom.xml b/sevntu-checkstyle-idea-extension/pom.xml
    index d497ed9f2d..ef4e84ab1c 100644
    --- a/sevntu-checkstyle-idea-extension/pom.xml
    +++ b/sevntu-checkstyle-idea-extension/pom.xml
    @@ -10,6 +10,13 @@
     
       Sevntu Checkstyle Idea extension
     
    +  
    +    
    +      LGPL-2.1+
    +      http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
    +    
    +  
    +
       
         
           com.github.sevntu.checkstyle
    diff --git a/sevntu-checkstyle-maven-plugin/pom.xml b/sevntu-checkstyle-maven-plugin/pom.xml
    index 5c026ffb44..09459015d8 100644
    --- a/sevntu-checkstyle-maven-plugin/pom.xml
    +++ b/sevntu-checkstyle-maven-plugin/pom.xml
    @@ -7,6 +7,13 @@
       Sevntu Checkstyle Maven Plugin
       1.23.0
     
    +  
    +    
    +      LGPL-2.1+
    +      http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
    +    
    +  
    +
       
         
           com.github.sevntu.checkstyle
    diff --git a/sevntu-checkstyle-sonar-plugin/pom.xml b/sevntu-checkstyle-sonar-plugin/pom.xml
    index 69d0d5e235..0fdb13aba1 100644
    --- a/sevntu-checkstyle-sonar-plugin/pom.xml
    +++ b/sevntu-checkstyle-sonar-plugin/pom.xml
    @@ -10,6 +10,13 @@
       SevNTU Checkstyle Sonar Extension Plugin
       SevNTU Checkstyle extension plugin for Sonar
     
    +  
    +    
    +      LGPL-2.1+
    +      http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
    +    
    +  
    +
       
         UTF-8
         7.2
    @@ -137,7 +144,7 @@
         
       
     
    -  
       
         
    diff --git a/update-site/pom.xml b/update-site/pom.xml
    index a7ae4136fe..241672e91f 100644
    --- a/update-site/pom.xml
    +++ b/update-site/pom.xml
    @@ -14,6 +14,13 @@
       eclipse-repository
       Tycho Test Build
     
    +  
    +    
    +      LGPL-2.1+
    +      http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
    +    
    +  
    +
       
         
           
    
    From 8eaf52dc3041198758e25bd15e8dc9185dbdd254 Mon Sep 17 00:00:00 2001
    From: Roman Ivanov 
    Date: Sun, 29 Jan 2017 06:56:00 -0800
    Subject: [PATCH 049/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 5ba4632d01..b4f6ab6cf6 100644
    --- a/sevntu-checks/pom.xml
    +++ b/sevntu-checks/pom.xml
    @@ -8,7 +8,7 @@
     
       
         iso-8859-1
    -    7.4
    +    7.5
         
         7.2
         2.17
    
    From e4c0c29b80b66742c6603daaf96734ad2ce5f050 Mon Sep 17 00:00:00 2001
    From: Roman Ivanov 
    Date: Sun, 29 Jan 2017 07:26:00 -0800
    Subject: [PATCH 050/208] minor: year number bump in headers
    
    ---
     .../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 +-
     .../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 +-
     .../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 +-
     .../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 +-
     .../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 +-
     .../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/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/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 +-
     .../sevntu/checkstyle/sonar/CheckstyleExtensionPlugin.java      | 2 +-
     .../sevntu/checkstyle/sonar/CheckstyleExtensionRepository.java  | 2 +-
     .../java/com/github/sevntu/checkstyle/sonar/package-info.java   | 2 +-
     128 files changed, 128 insertions(+), 128 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 eb11c22945..10d94d2e1d 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-2016 the original author or authors.
    +// 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
    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 9f602940e1..404d6d5cee 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-2016 the original author or authors.
    +// 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
    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 3747633bbb..d22a9f42a1 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-2016 the original author or authors.
    +// 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
    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 02b3533382..909ef8beba 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-2016 the original author or authors.
    +// 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
    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 6649775703..d27f315296 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-2016 the original author or authors.
    +// 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
    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 0ba39bc39e..8c56dcafa9 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-2016 the original author or authors.
    +// 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
    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 5cfd82fb2b..0c5b7b3580 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-2016 the original author or authors.
    +// 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
    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 970933cea9..daa60774ab 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-2016 the original author or authors.
    +// 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
    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 eb29437490..cc4fac9361 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-2016 the original author or authors.
    +// 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
    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 489f7d6532..3a112a539b 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-2016 the original author or authors.
    +// 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
    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 e187e29619..c245a75da4 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-2016 the original author or authors.
    +// 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
    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 e95b2e7635..094e9d28dc 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-2016 the original author or authors.
    +// 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
    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 157cd9feb0..9499bafc33 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-2016 the original author or authors.
    +// 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
    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 2e6e402957..d741ceb5ff 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-2016 the original author or authors.
    +// 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
    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 6cc4c4f67a..efa2064a9a 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-2016 the original author or authors.
    +// 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
    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 c7f1802080..c64cd1f4ce 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-2016 the original author or authors.
    +// 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
    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 8a92114b3f..b21b15bb29 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-2016 the original author or authors.
    +// 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
    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 a25dd6abca..e3a5061472 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-2016 the original author or authors.
    +// 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
    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 228a26b5b3..62f473693d 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-2016 the original author or authors.
    +// 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
    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 ef7b1a7a3d..619626eeb7 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-2016 the original author or authors.
    +// 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
    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 743d0f0423..55011c7519 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-2016 the original author or authors.
    +// 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
    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 d07cf8c389..2ae4a78b81 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-2016 the original author or authors.
    +// 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
    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 4b150cbe52..33431a0942 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-2016 the original author or authors.
    +// 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
    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 d7d2519a51..cddf7d38f5 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-2016 the original author or authors.
    +// 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
    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 0fa59db06a..da2a16c543 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-2016 the original author or authors.
    +// 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
    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 3fd2a22bcd..f15daee212 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-2016 the original author or authors.
    +// 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
    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 1bbda5cd22..ac43bc8b08 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-2016 the original author or authors.
    +// 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
    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 88c21af32f..6c7708e773 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-2016 the original author or authors.
    +// 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
    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 9922d4bb4a..324fbe6a93 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-2016 the original author or authors.
    +// 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
    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 73daf0883c..c40a4bdc24 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-2016 the original author or authors.
    +// 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
    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 8d53df0422..2db7209b4d 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-2016 the original author or authors.
    +// 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
    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 7482b0038c..c7128688bd 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-2016 the original author or authors.
    +// 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
    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 7e71874b98..db906ff0d5 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-2016 the original author or authors.
    +// 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
    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 fff5b20827..213abeadf9 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-2016 the original author or authors.
    +// 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
    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 033df670f4..2ebd9db589 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-2016 the original author or authors.
    +// 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
    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 005580e175..8dbb2624e4 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-2016 the original author or authors.
    +// 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
    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 13403c5ca7..f05bbf9a16 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-2016 the original author or authors.
    +// 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
    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 0676ec0136..72efa5661f 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-2016 the original author or authors.
    +// 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
    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 15fdca1c05..d0e0546acd 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-2016 the original author or authors.
    +// 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
    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 97071f8372..5d2fdd2414 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-2016 the original author or authors.
    +// 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
    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 35a71938cc..6f8575a21d 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-2016 the original author or authors.
    +// 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
    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 13b3be2f81..29fea50baf 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-2016 the original author or authors.
    +// 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
    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 8a650787df..d1f78ec5d1 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-2016 the original author or authors.
    +// 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
    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 dd7794aec7..237cfd169e 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-2016 the original author or authors.
    +// 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
    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 63fd14ac25..90ea6bea95 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-2016 the original author or authors.
    +// 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
    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 fdd5f1bdd3..48924a86c2 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-2016 the original author or authors.
    +// 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
    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 043b0315c4..5f49a1ec32 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-2016 the original author or authors.
    +// 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
    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 db56df7693..38658fb169 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-2016 the original author or authors.
    +// 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
    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 e7e42ec32b..39a6d57920 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-2016 the original author or authors.
    +// 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
    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 5d2ea06bb5..3ee6d90171 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-2016 the original author or authors.
    +// 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
    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 e0419146a1..bb252f4983 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-2016 the original author or authors.
    +// 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
    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 4992c452ee..a8d13ff430 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-2016 the original author or authors.
    +// 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
    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 1b9536996f..b52b59136f 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-2016 the original author or authors.
    +// 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
    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 181310faee..84e6e5b994 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-2016 the original author or authors.
    +// 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
    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 9980bb555f..05d3554465 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-2016 the original author or authors.
    +// 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
    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 676a2a8a7d..eda4162042 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-2016 the original author or authors.
    +// 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
    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 598a5782e4..815646012f 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-2016 the original author or authors.
    +// 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
    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 4afeb328b3..0984104852 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-2016 the original author or authors.
    +// 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
    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 e0de1f6369..5199b1747e 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-2016 the original author or authors.
    +// 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
    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 c2600f8004..ed33d80388 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-2016 the original author or authors.
    +// 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
    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 737ae2f4a2..35bf245219 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-2016 the original author or authors.
    +// 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
    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 dbec76e426..233f9908b1 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-2016 the original author or authors.
    +// 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
    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 b521fb119f..b6eca0cedb 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-2016 the original author or authors.
    +// 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
    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 9345af0357..000675559e 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-2016 the original author or authors.
    +// 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
    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 2092937a1a..48f2287f3b 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-2016 the original author or authors.
    +// 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
    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 9188d65834..284d0e418f 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-2016 the original author or authors.
    +// 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
    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 be0bf6f7f4..e229b7375a 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-2016 the original author or authors.
    +// 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
    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 609a281043..49dee2b377 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-2016 the original author or authors.
    +// 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
    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 402db71962..bca10c449d 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-2016 the original author or authors.
    +// 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
    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 06a443fc6a..46a2c0e8c9 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-2016 the original author or authors.
    +// 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
    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 46b046d3ba..cf38233e94 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-2016 the original author or authors.
    +// 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
    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 a7d3c3d4b9..3f9f8a7ad9 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-2016 the original author or authors.
    +// 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
    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 adb45f6f96..708e13bca6 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-2016 the original author or authors.
    +// 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
    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 9365ef3d2f..ccb2c4c2c9 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-2016 the original author or authors.
    +// 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
    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 738f93bace..d6ea937506 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-2016 the original author or authors.
    +// 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
    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 2fa24a5732..d267b70b76 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-2016 the original author or authors.
    +// 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
    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 3092e8f1e2..c7e2ae3f3d 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-2016 the original author or authors.
    +// 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
    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 6f4faa3d71..36b4c6433a 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-2016 the original author or authors.
    +// 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
    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 d828d87b38..8999892db2 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-2016 the original author or authors.
    +// 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
    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 5fc45917db..971ca6a119 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-2016 the original author or authors.
    +// 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
    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 f9ad0cd828..e423670613 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-2016 the original author or authors.
    +// 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
    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 6a608c01da..eef12a11f0 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-2016 the original author or authors.
    +// 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
    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 f0ab6213dc..0715e35557 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-2016 the original author or authors.
    +// 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
    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 8ba93e8eff..4f8d088445 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-2016 the original author or authors.
    +// 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
    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 22e21b6654..11b11085b5 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-2016 the original author or authors.
    +// 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
    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 bce91a40be..d0bacd4d09 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-2016 the original author or authors.
    +// 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
    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 74793f9582..9abbb62d71 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-2016 the original author or authors.
    +// 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
    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 564bf99f31..0bc29ba103 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-2016 the original author or authors.
    +// 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
    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 adbfe93eb8..3c48382480 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-2016 the original author or authors.
    +// 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
    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 ce60243790..f3089e34ff 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-2016 the original author or authors.
    +// 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
    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 58319b483d..fb5217fdab 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-2016 the original author or authors.
    +// 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
    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 0ab78e1c74..67a8caaf8f 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-2016 the original author or authors.
    +// 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
    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 9f3457d0be..9787d776d9 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-2016 the original author or authors.
    +// 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
    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 d5715e0810..14c3016e25 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-2016 the original author or authors.
    +// 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
    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 ca73e80457..8bb1868dfb 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-2016 the original author or authors.
    +// 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
    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 7d08aec0d9..a1fc19b8df 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-2016 the original author or authors.
    +// 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
    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 7caa2d4c3d..e37a918fda 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-2016 the original author or authors.
    +// 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
    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 453e96c84d..4fe85020d8 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-2016 the original author or authors.
    +// 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
    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 69e8aa7b76..5bc40c2890 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-2016 the original author or authors.
    +// 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
    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 b4ca83a205..e2dee8be51 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-2016 the original author or authors.
    +// 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
    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 312fe8c369..ca025acdcf 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-2016 the original author or authors.
    +// 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
    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 f14aada995..775110e4be 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-2016 the original author or authors.
    +// 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
    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 385a0d60e3..28e685f1ab 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-2016 the original author or authors.
    +// 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
    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 119e7257e4..788d5605d8 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-2016 the original author or authors.
    +// 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
    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 bb8c019085..44d17e51a1 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-2016 the original author or authors.
    +// 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
    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 7f3c1acbfa..5208afcecc 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-2016 the original author or authors.
    +// 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
    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 23b6f34084..bef07ca609 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-2016 the original author or authors.
    +// 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
    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 1b665610d8..b96479c778 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-2016 the original author or authors.
    +// 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
    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 0478a8f297..8d2fda9bad 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-2016 the original author or authors.
    +// 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
    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 fad2e1cad9..539d45d37c 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-2016 the original author or authors.
    +// 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
    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 c058ec1fe2..d605e977a2 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-2016 the original author or authors.
    +// 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
    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 6cb8c847df..8b6ccb1304 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-2016 the original author or authors.
    +// 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
    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 c39a32477a..b01cec0f19 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-2016 the original author or authors.
    +// 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
    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 3ac421e3a6..c12c317997 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-2016 the original author or authors.
    +// 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
    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 bc4551efab..7c3d271990 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-2016 the original author or authors.
    +// 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
    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 0f3be5a0b8..d22a0c9e0b 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-2016 the original author or authors.
    +// 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
    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 1d440c41b8..01b628b795 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-2016 the original author or authors.
    +// 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
    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 3ed4d5ab10..447f347604 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-2016 the original author or authors.
    +// 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
    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 8eb2b1b6fc..234335dcb0 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-2016 the original author or authors.
    +// 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
    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 4ede43ccf8..1c9296efc7 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-2016 the original author or authors.
    +// 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
    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 f6d7615eb8..00a589a781 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-2016 the original author or authors.
    +// 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
    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 3d5198e450..006df3b8e2 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-2016 the original author or authors.
    +// 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
    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 1c3c075f13..27801d1a57 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-2016 the original author or authors.
    +// 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
    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 48a07c7a6d..e2c86f8ca9 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-2016 the original author or authors.
    +// 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
    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 3e4a999f1e..4089c31946 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-2016 the original author or authors.
    +// 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
    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 b6e07d0fe8..49704a952d 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-2016 the original author or authors.
    +// 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
    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 8694e86337..2a6da1aba9 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-2016 the original author or authors.
    +// 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
    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 50ee6373e5..c46c0a3232 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-2016 the original author or authors.
    +// 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
    
    From efc9d2b7c471b5af3fd499630156e133ed7f62ad Mon Sep 17 00:00:00 2001
    From: Roman Ivanov 
    Date: Sat, 4 Feb 2017 08:40:10 -0800
    Subject: [PATCH 051/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 b4f6ab6cf6..ca3d0e96a9 100644
    --- a/sevntu-checks/pom.xml
    +++ b/sevntu-checks/pom.xml
    @@ -8,7 +8,7 @@
     
       
         iso-8859-1
    -    7.5
    +    7.5.1
         
         7.2
         2.17
    
    From cc453308c0eb7d24be1449012a9cd9de07198848 Mon Sep 17 00:00:00 2001
    From: Roman Ivanov 
    Date: Sat, 4 Feb 2017 09:06:07 -0800
    Subject: [PATCH 052/208] infra: update in 'test Issue ref in PR description'
    
    ---
     .travis.yml | 8 ++++----
     1 file changed, 4 insertions(+), 4 deletions(-)
    
    diff --git a/.travis.yml b/.travis.yml
    index 9064505e25..64ea393dfc 100644
    --- a/.travis.yml
    +++ b/.travis.yml
    @@ -73,15 +73,15 @@ matrix:
             - 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 "
    +        - CMD1=" && LINK_COMMITS=https://api.github.com/repos/sevntu-checkstyle/sevntu.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})"
    +        - 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 $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 "
    
    From 9039bf6f9100d4c97c0ded0f93093cdf5675a01b Mon Sep 17 00:00:00 2001
    From: Roman Ivanov 
    Date: Sat, 4 Feb 2017 17:26:52 -0800
    Subject: [PATCH 053/208] minor: attempt to fix build failure
    
    ---
     .travis.yml | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/.travis.yml b/.travis.yml
    index 64ea393dfc..0e60b212db 100644
    --- a/.travis.yml
    +++ b/.travis.yml
    @@ -72,7 +72,7 @@ matrix:
         - env:
             - DESC="test Issue ref in PR description"
             - CMD_="set -e"
    -        - CMD0=" && if [[ ! $TRAVIS_PULL_REQUEST =~ ^([0-9]*)$ ]]; then exit 0; fi "
    +        - CMD0=" && if [[ ! \$TRAVIS_PULL_REQUEST =~ ^([0-9]*)$ ]]; 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 $GITHUB_AUTH_TOKEN' \$LINK_COMMITS | jq '.[0] | .commit.message') "
             - CMD3=" && echo 'Messages from github:'\${COMMITS:0:60}... "
    
    From 99fe5619f44e6bcca042f2ee7e9d92acbd3f8034 Mon Sep 17 00:00:00 2001
    From: Roman Ivanov 
    Date: Sat, 4 Feb 2017 17:41:39 -0800
    Subject: [PATCH 054/208] infra: new attempt to fix build
    
    ---
     .travis.yml | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/.travis.yml b/.travis.yml
    index 0e60b212db..cf5fbd34e9 100644
    --- a/.travis.yml
    +++ b/.travis.yml
    @@ -72,7 +72,7 @@ matrix:
         - env:
             - DESC="test Issue ref in PR description"
             - CMD_="set -e"
    -        - CMD0=" && if [[ ! \$TRAVIS_PULL_REQUEST =~ ^([0-9]*)$ ]]; then exit 0; fi "
    +        - 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 $GITHUB_AUTH_TOKEN' \$LINK_COMMITS | jq '.[0] | .commit.message') "
             - CMD3=" && echo 'Messages from github:'\${COMMITS:0:60}... "
    
    From 351a9a7b2866ff50fea9b144e3ac848aaab969d1 Mon Sep 17 00:00:00 2001
    From: Roman Ivanov 
    Date: Sun, 5 Feb 2017 06:57:14 -0800
    Subject: [PATCH 055/208] infra: update for github token in travis
    
    ---
     .travis.yml | 6 +++---
     1 file changed, 3 insertions(+), 3 deletions(-)
    
    diff --git a/.travis.yml b/.travis.yml
    index cf5fbd34e9..8fda9613b5 100644
    --- a/.travis.yml
    +++ b/.travis.yml
    @@ -74,7 +74,7 @@ matrix:
             - 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 $GITHUB_AUTH_TOKEN' \$LINK_COMMITS | jq '.[0] | .commit.message') "
    +        - 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"
    @@ -82,12 +82,12 @@ matrix:
             - 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 $GITHUB_AUTH_TOKEN' \$LINK_PR | jq '.body' | grep -E \$REGEXP | cat ) "
    +        - 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 $GITHUB_AUTH_TOKEN' \$LINK_ISSUE | jq '.labels [] | .name' | grep approved | cat | wc -l ) "
    +        - 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 "
    
    From cbdef2101764568e13cec4f823af669971996537 Mon Sep 17 00:00:00 2001
    From: Roman Ivanov 
    Date: Sat, 4 Feb 2017 17:56:54 -0800
    Subject: [PATCH 056/208] infra: attemps to fix build
    
    ---
     .travis.yml | 16 ++++++++--------
     1 file changed, 8 insertions(+), 8 deletions(-)
    
    diff --git a/.travis.yml b/.travis.yml
    index 8fda9613b5..f37eb217d3 100644
    --- a/.travis.yml
    +++ b/.travis.yml
    @@ -19,34 +19,35 @@ 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 .. "
             - 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
    +        - CMD=$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"
    +        - 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"
     
         # idea-extension
         - jdk: oraclejdk8
           env:
             - DESC="idea-extension"
    -        - CMD="cd sevntu-checkstyle-idea-extension && mvn verify && mvn javadoc:javadoc"
    -        - PREINSTALL="true"
    +        - 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"
     
         # sonar-plugin
         - jdk: oraclejdk8
           env:
             - DESC="sonar-plugin"
    -        - CMD="cd sevntu-checkstyle-sonar-plugin && mvn verify && mvn javadoc:javadoc"
    -        - PREINSTALL="true"
    +        - 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"
     
         # checks
         - jdk: oraclejdk8
    @@ -102,7 +103,6 @@ matrix:
     
     
     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 d52d714ab255d9a266bebd41e3784ba811f50e6f Mon Sep 17 00:00:00 2001
    From: Roman Ivanov 
    Date: Sat, 25 Feb 2017 07:33:04 -0800
    Subject: [PATCH 057/208] version bump to 1.23.1
    
    ---
     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 cbdf332fa8..aa10c7f818 100644
    --- a/eclipse-pom.xml
    +++ b/eclipse-pom.xml
    @@ -5,7 +5,7 @@
     
       com.github.sevntu.checkstyle
       parent
    -  1.23.0
    +  1.23.1
       pom
     
       
    diff --git a/eclipsecs-sevntu-plugin-feature/feature.xml b/eclipsecs-sevntu-plugin-feature/feature.xml
    index e6c38f6c3a..b5319db1e8 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 92978c10b0..45815f8fc7 100644
    --- a/eclipsecs-sevntu-plugin-feature/pom.xml
    +++ b/eclipsecs-sevntu-plugin-feature/pom.xml
    @@ -7,7 +7,7 @@
         ../eclipse-pom.xml
         com.github.sevntu.checkstyle
         parent
    -    1.23.0
    +    1.23.1
       
     
       com.github.sevntu.checkstyle
    diff --git a/eclipsecs-sevntu-plugin/META-INF/MANIFEST.MF b/eclipsecs-sevntu-plugin/META-INF/MANIFEST.MF
    index 51b3c5c325..c60b4b9e36 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.23.0
    +Bundle-Version: 1.23.1
     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 1eb13345cd..62ea11ec48 100644
    --- a/eclipsecs-sevntu-plugin/pom.xml
    +++ b/eclipsecs-sevntu-plugin/pom.xml
    @@ -9,7 +9,7 @@
         ../eclipse-pom.xml
         com.github.sevntu.checkstyle
         parent
    -    1.23.0
    +    1.23.1
       
     
       com.github.sevntu.checkstyle
    diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml
    index ca3d0e96a9..5a59024e15 100644
    --- a/sevntu-checks/pom.xml
    +++ b/sevntu-checks/pom.xml
    @@ -4,7 +4,7 @@
       4.0.0
       com.github.sevntu.checkstyle
       sevntu-checks
    -  1.23.0
    +  1.23.1
     
       
         iso-8859-1
    diff --git a/sevntu-checkstyle-idea-extension/pom.xml b/sevntu-checkstyle-idea-extension/pom.xml
    index ef4e84ab1c..0400d26599 100644
    --- a/sevntu-checkstyle-idea-extension/pom.xml
    +++ b/sevntu-checkstyle-idea-extension/pom.xml
    @@ -5,7 +5,7 @@
     
       com.github.sevntu.checkstyle
       sevntu-checkstyle-idea-extension
    -  1.23.0
    +  1.23.1
       jar
     
       Sevntu Checkstyle Idea extension
    diff --git a/sevntu-checkstyle-maven-plugin/pom.xml b/sevntu-checkstyle-maven-plugin/pom.xml
    index 09459015d8..fae4d0c7b1 100644
    --- a/sevntu-checkstyle-maven-plugin/pom.xml
    +++ b/sevntu-checkstyle-maven-plugin/pom.xml
    @@ -5,7 +5,7 @@
       com.github.sevntu.checkstyle
       sevntu-checkstyle-maven-plugin
       Sevntu Checkstyle Maven Plugin
    -  1.23.0
    +  1.23.1
     
       
         
    @@ -18,7 +18,7 @@
         
           com.github.sevntu.checkstyle
           sevntu-checks
    -      1.23.0
    +      1.23.1
         
         
           org.apache.maven.plugins
    diff --git a/sevntu-checkstyle-sonar-plugin/pom.xml b/sevntu-checkstyle-sonar-plugin/pom.xml
    index 0fdb13aba1..96e14fd32d 100644
    --- a/sevntu-checkstyle-sonar-plugin/pom.xml
    +++ b/sevntu-checkstyle-sonar-plugin/pom.xml
    @@ -4,7 +4,7 @@
       4.0.0
       com.github.sevntu.checkstyle
       sevntu-checkstyle-sonar-plugin
    -  1.23.0
    +  1.23.1
       sonar-plugin
     
       SevNTU Checkstyle Sonar Extension Plugin
    diff --git a/update-site/pom.xml b/update-site/pom.xml
    index 241672e91f..b1fccd34ba 100644
    --- a/update-site/pom.xml
    +++ b/update-site/pom.xml
    @@ -7,7 +7,7 @@
         ../eclipse-pom.xml
         com.github.sevntu.checkstyle
         parent
    -    1.23.0
    +    1.23.1
       
     
       com.github.sevntu.checkstyle.p2updatesite
    
    From 888981f0431b52eb7d91071d3b4ae81065f95d27 Mon Sep 17 00:00:00 2001
    From: Roman Ivanov 
    Date: Sun, 26 Feb 2017 05:59:51 -0800
    Subject: [PATCH 058/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 5a59024e15..dc2576e14d 100644
    --- a/sevntu-checks/pom.xml
    +++ b/sevntu-checks/pom.xml
    @@ -8,7 +8,7 @@
     
       
         iso-8859-1
    -    7.5.1
    +    7.6
         
         7.2
         2.17
    
    From 44493c2895a88dd3691e55e144d833f82f928d3a Mon Sep 17 00:00:00 2001
    From: Roman Ivanov 
    Date: Sun, 26 Feb 2017 06:20:09 -0800
    Subject: [PATCH 059/208] minor: fixes and suppressions for checkstyle 7.6 new
     violations
    
    ---
     .../com/github/sevntu/checkstyle/BaseCheckTestSupport.java    | 2 +-
     sevntu-checks/suppressions.xml                                | 4 +++-
     2 files changed, 4 insertions(+), 2 deletions(-)
    
    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 ed33d80388..22e58ce462 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
    @@ -159,7 +159,7 @@ public String getCheckMessage(String messageKey) {
          * @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) {
    +    public String getCheckMessage(String messageKey, Object... arguments) {
             return format(getCheckMessage(messageKey), arguments);
         }
     
    diff --git a/sevntu-checks/suppressions.xml b/sevntu-checks/suppressions.xml
    index 75029cae89..1bd0903fa3 100644
    --- a/sevntu-checks/suppressions.xml
    +++ b/sevntu-checks/suppressions.xml
    @@ -6,7 +6,7 @@
     
     
         
    -        
    +    
         
         
         
    @@ -35,6 +35,8 @@
         
         
     
    +    
    +    
     
         
         
    
    From 53213b97d5d6975f677f7d71c8dfbd51b89b9c7e Mon Sep 17 00:00:00 2001
    From: Roman Ivanov 
    Date: Wed, 15 Mar 2017 11:10:27 -0700
    Subject: [PATCH 060/208] Update ISSUE_TEMPLATE.md
    
    ---
     .github/ISSUE_TEMPLATE.md | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
    index f1135f424c..b21d58f62e 100644
    --- a/.github/ISSUE_TEMPLATE.md
    +++ b/.github/ISSUE_TEMPLATE.md
    @@ -10,7 +10,7 @@
     
     [[PLACE YOUR OUTPUT HERE]]
     
    -/var/tmp $ java -classpath sevntu-checks-X.XX.X.jar;checkstyle-X.XX-all.jar com.puppycrawl.tools.checkstyle.Main -c config.xml YOUR_FILE.java
    +/var/tmp $ java -classpath sevntu-checks-X.XX.X.jar:checkstyle-X.XX-all.jar com.puppycrawl.tools.checkstyle.Main -c config.xml YOUR_FILE.java
     
     [[PLACE YOUR OUTPUT HERE]]
     
    
    From d6c9dd0d3756c92629393a79f4aef9f74b6ab723 Mon Sep 17 00:00:00 2001
    From: Roman Ivanov 
    Date: Wed, 15 Mar 2017 11:25:47 -0700
    Subject: [PATCH 061/208] example is provided
    
    ---
     .github/ISSUE_TEMPLATE.md | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
    index b21d58f62e..6202f2c87c 100644
    --- a/.github/ISSUE_TEMPLATE.md
    +++ b/.github/ISSUE_TEMPLATE.md
    @@ -20,4 +20,4 @@ Describe what you expect in detail.
     
     --------------
     
    -Still not clear ??? - see example - http://checkstyle.sourceforge.net/report_issue.html#How_to_report_a_bug
    +Still not clear ??? - see example - https://github.com/sevntu-checkstyle/sevntu.checkstyle/wiki/How-to-report-the-issue-(example)
    
    From c46477255d22a6d6f6ebf4a507363b1bf41ea200 Mon Sep 17 00:00:00 2001
    From: Roman Ivanov 
    Date: Sun, 26 Mar 2017 07:30:23 -0700
    Subject: [PATCH 062/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 dc2576e14d..70d335aacc 100644
    --- a/sevntu-checks/pom.xml
    +++ b/sevntu-checks/pom.xml
    @@ -8,7 +8,7 @@
     
       
         iso-8859-1
    -    7.6
    +    7.6.1
         
         7.2
         2.17
    
    From 5b17b453e37a8016416b52ec326c8aee4ba15a20 Mon Sep 17 00:00:00 2001
    From: Roman Ivanov 
    Date: Sun, 26 Mar 2017 07:52:50 -0700
    Subject: [PATCH 063/208] minor: resolve checkstyle vilation,
     ConversionException is forbidden now
    
    ---
     .../checks/coding/CustomDeclarationOrderCheck.java        | 6 ++----
     .../checkstyle/checks/sizes/LineLengthExtendedCheck.java  | 8 +++-----
     2 files changed, 5 insertions(+), 9 deletions(-)
    
    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 094e9d28dc..6df860e705 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
    @@ -32,8 +32,6 @@
     import java.util.regex.Pattern;
     import java.util.regex.PatternSyntaxException;
     
    -import org.apache.commons.beanutils.ConversionException;
    -
     import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
     import com.puppycrawl.tools.checkstyle.api.DetailAST;
     import com.puppycrawl.tools.checkstyle.api.TokenTypes;
    @@ -418,7 +416,7 @@ private FormatMatcher parseInputDeclarationRule(final String currentState) {
             final int classMember = convertMacroToTokenType(macro);
             if (classMember == -1) {
                 // if Class Member has been specified wrong
    -            throw new ConversionException("Unable to parse " + macro);
    +            throw new IllegalArgumentException("Unable to parse " + macro);
             }
     
             // parse regExp
    @@ -1235,7 +1233,7 @@ private void updateRegexp(final String newFormat, final int compileFlags) {
                     this.format = newFormat;
                 }
                 catch (final PatternSyntaxException ex) {
    -                throw new ConversionException("unable to parse " + newFormat, ex);
    +                throw new IllegalArgumentException("unable to parse " + newFormat, ex);
                 }
             }
     
    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 5199b1747e..404b4909a7 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
    @@ -24,8 +24,6 @@
     import java.util.regex.Pattern;
     import java.util.regex.PatternSyntaxException;
     
    -import org.apache.commons.beanutils.ConversionException;
    -
     import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
     import com.puppycrawl.tools.checkstyle.api.DetailAST;
     import com.puppycrawl.tools.checkstyle.api.TokenTypes;
    @@ -251,15 +249,15 @@ public void setMax(int length) {
          *
          * @param format
          *            a String value
    -     * @throws ConversionException
    +     * @throws IllegalArgumentException
          *             unable to parse aFormat
          */
    -    public final void setIgnorePattern(String format) throws ConversionException {
    +    public final void setIgnorePattern(String format) {
             try {
                 ignorePattern = Pattern.compile(format);
             }
             catch (final PatternSyntaxException ex) {
    -            throw new ConversionException("unable to parse " + format, ex);
    +            throw new IllegalArgumentException("unable to parse " + format, ex);
             }
         }
     }
    
    From 10570897efb7e5235b01242afcd7a5c9348e9483 Mon Sep 17 00:00:00 2001
    From: Roman Ivanov 
    Date: Sun, 26 Mar 2017 08:01:11 -0700
    Subject: [PATCH 064/208] minor: fix sonar badge
    
    ---
     README.textile | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/README.textile b/README.textile
    index 16b23b159a..3e71bec7e3 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://img.shields.io/sonar/http/sonarqube.com/com.github.sevntu.checkstyle:sevntu-checks/tech_debt.svg?label=SonarQube%20tech%20debt!:https://sonarqube.com/overview?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
     
     Additional(non-standard) checks for Checkstyle that are compiled as:
     - extension to "maven-checkstyle-plugin":http://maven.apache.org/plugins/maven-checkstyle-plugin/ (how to use: "in general":http://maven.apache.org/plugins/maven-checkstyle-plugin/examples/custom-developed-checkstyle.html, "maven, ant, gradle example":https://github.com/sevntu-checkstyle/checkstyle-samples).
    
    From 6ea20209bb78146f32414ab21d3f8f3369aac5f5 Mon Sep 17 00:00:00 2001
    From: Roman Ivanov 
    Date: Sun, 30 Apr 2017 07:28:33 -0700
    Subject: [PATCH 065/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 70d335aacc..a23131c4e0 100644
    --- a/sevntu-checks/pom.xml
    +++ b/sevntu-checks/pom.xml
    @@ -8,7 +8,7 @@
     
       
         iso-8859-1
    -    7.6.1
    +    7.7
         
         7.2
         2.17
    
    From dbf1c67c7b6222d4a69de6e6a55711ee04ccf09c Mon Sep 17 00:00:00 2001
    From: Roman Ivanov 
    Date: Sun, 30 Apr 2017 10:37:22 -0700
    Subject: [PATCH 066/208] config: add suppression after bump to new checkstyle
     version
    
    ---
     sevntu-checks/suppressions.xml | 3 +++
     1 file changed, 3 insertions(+)
    
    diff --git a/sevntu-checks/suppressions.xml b/sevntu-checks/suppressions.xml
    index 1bd0903fa3..29a7191515 100644
    --- a/sevntu-checks/suppressions.xml
    +++ b/sevntu-checks/suppressions.xml
    @@ -46,4 +46,7 @@
              as visitToken() has cyclomatic complexity 14 now because of SWITCH  -->
         
     
    +    
    +    
    +
     
    
    From f2dd141c4c043fb03459920a96f83c3bc1c6f99d Mon Sep 17 00:00:00 2001
    From: rnveach 
    Date: Thu, 11 May 2017 17:31:12 -0400
    Subject: [PATCH 067/208] Issue #560: changed issue template to specify command
     based on OS
    
    ---
     .github/ISSUE_TEMPLATE.md | 8 +++++++-
     1 file changed, 7 insertions(+), 1 deletion(-)
    
    diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
    index 6202f2c87c..04fbe2217f 100644
    --- a/.github/ISSUE_TEMPLATE.md
    +++ b/.github/ISSUE_TEMPLATE.md
    @@ -10,7 +10,13 @@
     
     [[PLACE YOUR OUTPUT HERE]]
     
    -/var/tmp $ java -classpath sevntu-checks-X.XX.X.jar:checkstyle-X.XX-all.jar com.puppycrawl.tools.checkstyle.Main -c config.xml YOUR_FILE.java
    +For Linux users:
    +
    +`/var/tmp $ java -classpath sevntu-checks-X.XX.X.jar:checkstyle-X.XX-all.jar com.puppycrawl.tools.checkstyle.Main -c config.xml YOUR_FILE.java`
    +
    +For Windows users:
    +
    +`C:\tmp> java -classpath sevntu-checks-X.XX.X.jar;checkstyle-X.XX-all.jar com.puppycrawl.tools.checkstyle.Main -c config.xml YOUR_FILE.java`
     
     [[PLACE YOUR OUTPUT HERE]]
     
    
    From b3ba9cdf68f68c8cc6ddd8c7e0f37adbf05c9edb Mon Sep 17 00:00:00 2001
    From: rnveach 
    Date: Thu, 11 May 2017 17:07:46 -0400
    Subject: [PATCH 068/208] Issue #559: ignore object blocks for
     ShortCircuitOperator check
    
    ---
     ...idNotShortCircuitOperatorsForBooleanCheck.java |  4 ++++
     ...idNotShortCircuitOperatorsForBooleanCheck.java | 15 +++++++++++++++
     2 files changed, 19 insertions(+)
    
    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 3a112a539b..8dd06902f0 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
    @@ -107,6 +107,10 @@ public final void visitToken(final DetailAST detailAST) {
             // look for EXPR which is always around BOR/BAND... operators
             while (currentNode != null && currentNode.getType() != TokenTypes.EXPR) {
                 currentNode = currentNode.getParent();
    +
    +            if (currentNode.getType() == TokenTypes.OBJBLOCK) {
    +                currentNode = null;
    +            }
             }
     
             if (currentNode != null && isBooleanExpression(currentNode)) {
    diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputAvoidNotShortCircuitOperatorsForBooleanCheck.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputAvoidNotShortCircuitOperatorsForBooleanCheck.java
    index 48e7e5fec4..cd6017978b 100644
    --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputAvoidNotShortCircuitOperatorsForBooleanCheck.java
    +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputAvoidNotShortCircuitOperatorsForBooleanCheck.java
    @@ -160,4 +160,19 @@ class MyConstructor
         {
             boolean x = InputAvoidNotShortCircuitOperatorsForBooleanCheck.x | InputAvoidNotShortCircuitOperatorsForBooleanCheck.x;
         }
    +
    +    public void test() {
    +        new Runnable() {
    +            @Override
    +            public void run() {
    +            }
    +            public boolean test() {
    +                try {
    +                } catch (IllegalArgumentException | NullPointerException e) {
    +                    return false;
    +                }
    +                return true;
    +            }
    +        };
    +    }
     }
    
    From c456371085ac06eccc8142c5e9e96f2a6333d5c8 Mon Sep 17 00:00:00 2001
    From: rnveach 
    Date: Fri, 12 May 2017 09:32:39 -0400
    Subject: [PATCH 069/208] Issue #568: fixed NPE in non-classes for
     ShortCircuitOperators check
    
    ---
     ...voidNotShortCircuitOperatorsForBooleanCheck.java |  5 ++++-
     ...NotShortCircuitOperatorsForBooleanCheckTest.java |  8 ++++++++
     ...rtCircuitOperatorsForBooleanCheckNonClasses.java | 13 +++++++++++++
     3 files changed, 25 insertions(+), 1 deletion(-)
     create mode 100644 sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputAvoidNotShortCircuitOperatorsForBooleanCheckNonClasses.java
    
    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 8dd06902f0..53059cfe53 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
    @@ -148,7 +148,10 @@ public final boolean isBooleanExpression(final DetailAST node) {
     
             while (curNode.getType() != TokenTypes.CTOR_DEF
                     && curNode.getType() != TokenTypes.METHOD_DEF
    -                && curNode.getType() != TokenTypes.CLASS_DEF) {
    +                && curNode.getType() != TokenTypes.CLASS_DEF
    +                && curNode.getType() != TokenTypes.INTERFACE_DEF
    +                && curNode.getType() != TokenTypes.ANNOTATION_DEF
    +                && curNode.getType() != TokenTypes.ENUM_DEF) {
                 curNode = curNode.getParent();
             }
     
    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 bca10c449d..bca0349d60 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
    @@ -25,6 +25,7 @@
     
     import com.github.sevntu.checkstyle.BaseCheckTestSupport;
     import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
    +import com.puppycrawl.tools.checkstyle.utils.CommonUtils;
     
     public class AvoidNotShortCircuitOperatorsForBooleanCheckTest extends BaseCheckTestSupport {
     
    @@ -52,4 +53,11 @@ public final void testAll() throws Exception {
     
             verify(checkConfig, getPath("InputAvoidNotShortCircuitOperatorsForBooleanCheck.java"), expected);
         }
    +
    +    @Test
    +    public final void testNonClasses() throws Exception {
    +        verify(checkConfig,
    +                getPath("InputAvoidNotShortCircuitOperatorsForBooleanCheckNonClasses.java"),
    +                CommonUtils.EMPTY_STRING_ARRAY);
    +    }
     }
    diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputAvoidNotShortCircuitOperatorsForBooleanCheckNonClasses.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputAvoidNotShortCircuitOperatorsForBooleanCheckNonClasses.java
    new file mode 100644
    index 0000000000..9fd48f60da
    --- /dev/null
    +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputAvoidNotShortCircuitOperatorsForBooleanCheckNonClasses.java
    @@ -0,0 +1,13 @@
    +package com.github.sevntu.checkstyle.checks.coding;
    +
    +public interface InputAvoidNotShortCircuitOperatorsForBooleanCheckNonClasses {
    +    int field = 4 << 16 | 0;
    +}
    +enum TestEnum {
    +    ;
    +
    +    int field = 4 << 16 | 0;
    +}
    +@interface TestAnnotation {
    +    int field = 4 << 16 | 0;
    +}
    
    From 12483cf03b0164812d92a1e1d91c8631ee72f420 Mon Sep 17 00:00:00 2001
    From: rnveach 
    Date: Fri, 12 May 2017 11:32:11 -0400
    Subject: [PATCH 070/208] Issue #427: fixed NPE in
     MapIterationInForEachLoopCheck for map classes
    
    ---
     .../coding/MapIterationInForEachLoopCheck.java       |  8 +++++++-
     .../coding/MapIterationInForEachLoopCheckTest.java   | 12 ++++++++++++
     ...utMapIterationInForEachLoopCheckExtendingMap.java | 12 ++++++++++++
     3 files changed, 31 insertions(+), 1 deletion(-)
     create mode 100644 sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMapIterationInForEachLoopCheckExtendingMap.java
    
    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 cddf7d38f5..8c034e7a4c 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
    @@ -400,7 +400,13 @@ private DetailAST getKeySetOrEntrySetNode(DetailAST forEachNode) {
                         || ENTRY_SET_METHOD_NAME.equals(identNode.getText())) {
                     final String mapClassName;
                     if (isMapClassField) {
    -                    mapClassName = identNode.getPreviousSibling().getLastChild().getText();
    +                    final DetailAST lastChild = identNode.getPreviousSibling().getLastChild();
    +                    if (lastChild == null) {
    +                        mapClassName = null;
    +                    }
    +                    else {
    +                        mapClassName = lastChild.getText();
    +                    }
                     }
                     else {
                         mapClassName = identNode.getPreviousSibling().getText();
    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 0715e35557..bb795e340a 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
    @@ -27,6 +27,7 @@
     
     import com.github.sevntu.checkstyle.BaseCheckTestSupport;
     import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
    +import com.puppycrawl.tools.checkstyle.utils.CommonUtils;
     
     public class MapIterationInForEachLoopCheckTest extends BaseCheckTestSupport {
     
    @@ -95,4 +96,15 @@ public final void skipIfConditionTest() throws Exception {
                     expected);
         }
     
    +    @Test
    +    public final void testClassExtendingMap() throws Exception {
    +        checkConfig.addAttribute("proposeValuesUsage", "true");
    +        checkConfig.addAttribute("proposeKeySetUsage", "true");
    +        checkConfig.addAttribute("proposeEntrySetUsage", "true");
    +
    +        verify(checkConfig,
    +                getPath("InputMapIterationInForEachLoopCheckExtendingMap.java"),
    +                CommonUtils.EMPTY_STRING_ARRAY);
    +    }
    +
     }
    diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMapIterationInForEachLoopCheckExtendingMap.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMapIterationInForEachLoopCheckExtendingMap.java
    new file mode 100644
    index 0000000000..e981e7a122
    --- /dev/null
    +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMapIterationInForEachLoopCheckExtendingMap.java
    @@ -0,0 +1,12 @@
    +package com.github.sevntu.checkstyle.checks.coding;
    +
    +import java.util.HashMap;
    +
    +public class InputMapIterationInForEachLoopCheckExtendingMap {
    +    public static class TestMap extends HashMap {
    +        public void test() {
    +            for (Entry entry : this.entrySet()) {
    +            }
    +        }
    +    }
    +}
    
    From 00568c2edbef754dd9e41bd6df3e26ee2a66e182 Mon Sep 17 00:00:00 2001
    From: rnveach 
    Date: Fri, 12 May 2017 18:11:14 -0400
    Subject: [PATCH 071/208] Issue #573: fixed NPE in
     NoNullForCollectionReturnCheck for constructors
    
    ---
     .../coding/NoNullForCollectionReturnCheck.java      |  2 +-
     .../coding/NoNullForCollectionReturnCheckTest.java  | 11 +++++++++++
     ...utNoNullForCollectionReturnCheckConstructor.java | 13 +++++++++++++
     3 files changed, 25 insertions(+), 1 deletion(-)
     create mode 100644 sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNoNullForCollectionReturnCheckConstructor.java
    
    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 6c7708e773..cb867e2561 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
    @@ -352,7 +352,7 @@ private static List getChildren(DetailAST root, int type) {
          */
         private static DetailAST getMethodDef(DetailAST returnLit) {
             DetailAST methodDef = returnLit;
    -        while (methodDef.getType() != TokenTypes.METHOD_DEF) {
    +        while (methodDef != null && methodDef.getType() != TokenTypes.METHOD_DEF) {
                 methodDef = methodDef.getParent();
             }
             return methodDef;
    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 9abbb62d71..e869675545 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
    @@ -153,4 +153,15 @@ public void testIss148Deep()
     
             verify(checkConfig, getPath("InputNoNullForCollectionReturnCheck7.java"), expected);
         }
    +
    +    @Test
    +    public void testConstructor()
    +            throws Exception {
    +        final DefaultConfiguration checkConfig = createCheckConfig(NoNullForCollectionReturnCheck.class);
    +        final String[] expected = {
    +            "5: " + warningMessage,
    +        };
    +
    +        verify(checkConfig, getPath("InputNoNullForCollectionReturnCheckConstructor.java"), expected);
    +    }
     }
    diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNoNullForCollectionReturnCheckConstructor.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNoNullForCollectionReturnCheckConstructor.java
    new file mode 100644
    index 0000000000..753c63b4e6
    --- /dev/null
    +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputNoNullForCollectionReturnCheckConstructor.java
    @@ -0,0 +1,13 @@
    +package com.github.sevntu.checkstyle.checks.coding;
    +
    +public class InputNoNullForCollectionReturnCheckConstructor {
    +    public String[] method() {
    +        return null;
    +    }
    +
    +    InputNoNullForCollectionReturnCheckConstructor() {
    +        if (true) {
    +            return;
    +        }
    +    }
    +}
    
    From 32422a68891617dae62dfcbf1096febc8c41d302 Mon Sep 17 00:00:00 2001
    From: rnveach 
    Date: Fri, 12 May 2017 20:05:46 -0400
    Subject: [PATCH 072/208] Issue #575: fixed NPE in
     ForbidWildcardAsReturnTypeCheck
    
    ---
     .../ForbidWildcardAsReturnTypeCheck.java      | 45 ++++++++-----------
     .../ForbidWildcardAsReturnTypeCheckTest.java  | 12 +++++
     .../InputForbidWildcardAsReturnTypeCheck.java |  4 +-
     ...dAsReturnTypeCheckQualifiedAnnotation.java |  7 +++
     4 files changed, 40 insertions(+), 28 deletions(-)
     create mode 100644 sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputForbidWildcardAsReturnTypeCheckQualifiedAnnotation.java
    
    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 5f49a1ec32..d1c3a3291b 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
    @@ -29,6 +29,7 @@
     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.AnnotationUtility;
     
     /**
      * Prevents using wildcards as return type of methods.
    @@ -61,6 +62,19 @@ public class ForbidWildcardAsReturnTypeCheck extends AbstractCheck {
          */
         private static final int WILDCARD_SUPER_IDENT =
                 TokenTypes.TYPE_LOWER_BOUNDS;
    +
    +    /** {@link Deprecated Deprecated} annotation name. */
    +    private static final String DEPRECATED = "Deprecated";
    +
    +    /** Fully-qualified {@link Deprecated Deprecated} annotation name. */
    +    private static final String FQ_DEPRECATED = "java.lang." + DEPRECATED;
    +
    +    /** {@link Override Override} annotation name. */
    +    private static final String OVERRIDE = "Override";
    +
    +    /** Fully-qualified {@link Override Override} annotation name. */
    +    private static final String FQ_OVERRIDE = "java.lang." + OVERRIDE;
    +
         /**
          * Empty array of DetailAST.
          */
    @@ -191,9 +205,12 @@ public void visitToken(DetailAST methodDefAst) {
                     || (checkProtectedMethods && "protected".equals(methodScope))
                     || (checkPackageMethods && "package".equals(methodScope)))
                     && (checkOverrideMethods
    -                        || !hasAnnotation(methodDefAst, "Override"))
    +                        || (!AnnotationUtility.containsAnnotation(methodDefAst, OVERRIDE)
    +                            && !AnnotationUtility.containsAnnotation(methodDefAst, FQ_OVERRIDE)))
                     && (checkDeprecatedMethods
    -                        || !hasAnnotation(methodDefAst, "Deprecated"))) {
    +                        || (!AnnotationUtility.containsAnnotation(methodDefAst, DEPRECATED)
    +                            && !AnnotationUtility.containsAnnotation(methodDefAst,
    +                                FQ_DEPRECATED)))) {
                 final List wildcardTypeArguments =
                         getWildcardArgumentsAsMethodReturnType(methodDefAst);
                 if (!wildcardTypeArguments.isEmpty()
    @@ -270,30 +287,6 @@ private static String getIdentifier(final DetailAST ast) {
             return result;
         }
     
    -    /**
    -     * Verify that method definition contains specified annotation.
    -     * @param methodDefAst DetailAST of method definition.
    -     * @param annotationTitle Annotation title
    -     * @return true if method definition contains specified annotation.
    -     */
    -    private static boolean hasAnnotation(DetailAST methodDefAst,
    -            String annotationTitle) {
    -        boolean result = false;
    -        final DetailAST modifiersAst = methodDefAst.getFirstChild();
    -        if (hasChildToken(modifiersAst, TokenTypes.ANNOTATION)) {
    -            DetailAST modifierAst = modifiersAst.getFirstChild();
    -            while (modifierAst != null) {
    -                if (modifierAst.getType() == TokenTypes.ANNOTATION
    -                        && annotationTitle.equals(getIdentifier(modifierAst))) {
    -                    result = true;
    -                    break;
    -                }
    -                modifierAst = modifierAst.getNextSibling();
    -            }
    -        }
    -        return result;
    -    }
    -
         /**
          * Receive list of arguments(AST nodes) which have wildcard.
          * @param methodDefAst
    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 44d17e51a1..fd1728ff9f 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
    @@ -29,6 +29,7 @@
     
     import com.github.sevntu.checkstyle.BaseCheckTestSupport;
     import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
    +import com.puppycrawl.tools.checkstyle.utils.CommonUtils;
     
     /**
      * Test class for ForbidWildcardInReturnTypeCheck.
    @@ -422,6 +423,17 @@ public final void testAllExceptDeprecatedMethods()
                 expected);
         }
     
    +    @Test
    +    public final void testFullyQualifiedAnnotation()
    +            throws Exception {
    +        final DefaultConfiguration checkConfig =
    +                createCheckConfig(ForbidWildcardAsReturnTypeCheck.class);
    +
    +        verify(checkConfig,
    +            getPath("InputForbidWildcardAsReturnTypeCheckQualifiedAnnotation.java"),
    +            CommonUtils.EMPTY_STRING_ARRAY);
    +    }
    +
         /**
          * Create new set of line numbers.
          * @param aLines
    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 b09d629ad6..9da35e4f62 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
    @@ -310,8 +310,8 @@ class MethodsWithAnnotations extends SomeClass {
         @SuppressWarnings("unchecked") public List met3() {
             return null;
         }
    -    @Deprecated
    -    @Override
    +    @java.lang.Deprecated
    +    @java.lang.Override
         @SuppressWarnings("unused")
         public List met4() {
             return null;
    diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputForbidWildcardAsReturnTypeCheckQualifiedAnnotation.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputForbidWildcardAsReturnTypeCheckQualifiedAnnotation.java
    new file mode 100644
    index 0000000000..d3fc680ba7
    --- /dev/null
    +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputForbidWildcardAsReturnTypeCheckQualifiedAnnotation.java
    @@ -0,0 +1,7 @@
    +package com.github.sevntu.checkstyle.checks.design;
    +
    +public class InputForbidWildcardAsReturnTypeCheckQualifiedAnnotation {
    +    @org.junit.After
    +    public void doAfterTest() {
    +    }
    +}
    
    From d1a54b37104f5d2dd210278b91593cb093d50992 Mon Sep 17 00:00:00 2001
    From: rnveach 
    Date: Sun, 14 May 2017 12:54:03 -0400
    Subject: [PATCH 073/208] Issue #580: fixed NPE in MapIterationInForEachLoop
     for maps without this
    
    ---
     .../checks/coding/MapIterationInForEachLoopCheck.java     | 8 +++++++-
     .../InputMapIterationInForEachLoopCheckExtendingMap.java  | 4 ++++
     2 files changed, 11 insertions(+), 1 deletion(-)
    
    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 8c034e7a4c..8b5be02235 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
    @@ -409,7 +409,13 @@ private DetailAST getKeySetOrEntrySetNode(DetailAST forEachNode) {
                         }
                     }
                     else {
    -                    mapClassName = identNode.getPreviousSibling().getText();
    +                    final DetailAST previousSibling = identNode.getPreviousSibling();
    +                    if (previousSibling == null) {
    +                        mapClassName = null;
    +                    }
    +                    else {
    +                        mapClassName = previousSibling.getText();
    +                    }
                     }
                     if (mapNamesList.contains(mapClassName)) {
                         keySetOrEntrySetNode = identNode;
    diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMapIterationInForEachLoopCheckExtendingMap.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMapIterationInForEachLoopCheckExtendingMap.java
    index e981e7a122..b3724c1bdf 100644
    --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMapIterationInForEachLoopCheckExtendingMap.java
    +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMapIterationInForEachLoopCheckExtendingMap.java
    @@ -8,5 +8,9 @@ public void test() {
                 for (Entry entry : this.entrySet()) {
                 }
             }
    +        public void test2() {
    +            for (Entry entry : entrySet()) {
    +            }
    +        }
         }
     }
    
    From 7c8db6eada6ebd5d1a9be912a0568f6f401a8c1a Mon Sep 17 00:00:00 2001
    From: rnveach 
    Date: Sun, 14 May 2017 13:08:26 -0400
    Subject: [PATCH 074/208] Issue #578: fixed NPE in FinalizeImplementationCheck
    
    ---
     .../coding/FinalizeImplementationCheck.java   |  5 ++--
     .../FinalizeImplementationCheckTest.java      | 11 ++++++++
     ...putFinalizeImplementationCheckSpecial.java | 25 +++++++++++++++++++
     3 files changed, 39 insertions(+), 2 deletions(-)
     create mode 100644 sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputFinalizeImplementationCheckSpecial.java
    
    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 c64cd1f4ce..afc43f30bb 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
    @@ -208,9 +208,10 @@ private static int getParamsCount(DetailAST methodDefToken) {
          */
         private static boolean containsSuperFinalizeCall(DetailAST openingBrace) {
             final DetailAST methodCallToken = openingBrace.getFirstChild().getFirstChild();
    -        if (methodCallToken != null) {
    +        if (methodCallToken != null && methodCallToken.getType() == TokenTypes.METHOD_CALL) {
                 final DetailAST dotToken = methodCallToken.getFirstChild();
    -            if (dotToken.findFirstToken(TokenTypes.LITERAL_SUPER) != null) {
    +            if (dotToken.getType() == TokenTypes.DOT
    +                    && dotToken.findFirstToken(TokenTypes.LITERAL_SUPER) != null) {
                     return true;
                 }
             }
    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 d6ea937506..752ff7f52f 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
    @@ -51,4 +51,15 @@ public final void basicTest() throws Exception {
             verify(checkConfig,
                     getPath("InputFinalizeImplementationCheck.java"), expected);
         }
    +
    +    @Test
    +    public final void testSpecialFinalize() throws Exception {
    +        final String[] expected = {
    +            "5: " + getCheckMessage(MSG_KEY_MISSED_TRY_FINALLY),
    +            "18: " + getCheckMessage(MSG_KEY_MISSED_TRY_FINALLY),
    +        };
    +
    +        verify(checkConfig, getPath("InputFinalizeImplementationCheckSpecial.java"),
    +                expected);
    +    }
     }
    diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputFinalizeImplementationCheckSpecial.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputFinalizeImplementationCheckSpecial.java
    new file mode 100644
    index 0000000000..ededf30c16
    --- /dev/null
    +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputFinalizeImplementationCheckSpecial.java
    @@ -0,0 +1,25 @@
    +package com.github.sevntu.checkstyle.checks.coding;
    +
    +public class InputFinalizeImplementationCheckSpecial {
    +    private boolean condition;
    +    @Override
    +    protected void finalize() throws Throwable {
    +        if (condition) {
    +            method();
    +        }
    +        method();
    +        super.finalize();
    +    }
    +
    +    private void method() {
    +    }
    +}
    +class InputFinalizeImplementationCheckSpecial2 {
    +    @Override
    +    protected void finalize() throws Throwable {
    +        this.method();
    +    }
    +
    +    private void method() {
    +    }
    +}
    
    From 14398bd73212ff84def42c21f6f32a1248869014 Mon Sep 17 00:00:00 2001
    From: rnveach 
    Date: Mon, 15 May 2017 08:00:36 -0400
    Subject: [PATCH 075/208] Issue #577: fixed NPE in AvoidHidingCauseException on
     wrapping
    
    ---
     .../coding/AvoidHidingCauseExceptionCheck.java  |  4 +++-
     .../AvoidHidingCauseExceptionCheckTest.java     |  9 +++++++++
     ...tAvoidHidingCauseExceptionCheckWrapping.java | 17 +++++++++++++++++
     3 files changed, 29 insertions(+), 1 deletion(-)
     create mode 100644 sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputAvoidHidingCauseExceptionCheckWrapping.java
    
    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 daa60774ab..a2a5b5c1db 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
    @@ -211,7 +211,9 @@ private List makeExceptionsList(DetailAST currentCatchAST,
                         else {
                             convertedExc = temp.findFirstToken(TokenTypes.IDENT);
                         }
    -                    wrapExcNames.add(convertedExc.getText());
    +                    if (convertedExc != null) {
    +                        wrapExcNames.add(convertedExc.getText());
    +                    }
                     }
                 }
     
    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 e229b7375a..56d3d4a5cd 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
    @@ -25,6 +25,7 @@
     
     import com.github.sevntu.checkstyle.BaseCheckTestSupport;
     import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
    +import com.puppycrawl.tools.checkstyle.utils.CommonUtils;
     
     public class AvoidHidingCauseExceptionCheckTest extends BaseCheckTestSupport {
     
    @@ -63,5 +64,13 @@ public final void test() throws Exception {
             verify(checkConfig, getPath("InputAvoidHidingCauseExceptionCheck.java"), expected);
         }
     
    +    @Test
    +    public final void testWrappingException() throws Exception {
    +        final DefaultConfiguration checkConfig = createCheckConfig(AvoidHidingCauseExceptionCheck.class);
    +
    +        verify(checkConfig, getPath("InputAvoidHidingCauseExceptionCheckWrapping.java"),
    +                CommonUtils.EMPTY_STRING_ARRAY);
    +    }
    +
     }
     
    diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputAvoidHidingCauseExceptionCheckWrapping.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputAvoidHidingCauseExceptionCheckWrapping.java
    new file mode 100644
    index 0000000000..e318eea8ae
    --- /dev/null
    +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputAvoidHidingCauseExceptionCheckWrapping.java
    @@ -0,0 +1,17 @@
    +package com.github.sevntu.checkstyle.checks.coding;
    +
    +public class InputAvoidHidingCauseExceptionCheckWrapping {
    +    private Exception field;
    +
    +    public void executeLocal() {
    +        try {
    +        }
    +        catch (final Exception e) {
    +            this.field = InputAvoidHidingCauseExceptionCheckWrapping.method(new Exception(e));
    +        }
    +    }
    +
    +    private static Exception method(Exception exception) {
    +        return exception;
    +    }
    +}
    
    From 6954afe7021ac6cfbf3f52f25d3d7853c670471d Mon Sep 17 00:00:00 2001
    From: rnveach 
    Date: Tue, 9 May 2017 15:05:05 -0400
    Subject: [PATCH 076/208] Pull #565: fixed violations of
     MoveVariableInsideIfCheck
    
    ---
     .../coding/ConfusingConditionCheck.java       |  2 +-
     .../coding/CustomDeclarationOrderCheck.java   | 21 +++++++++----------
     .../MapIterationInForEachLoopCheck.java       | 10 ++++-----
     ...ipleVariableDeclarationsExtendedCheck.java |  6 ++++--
     .../SimpleAccessorNameNotationCheck.java      |  5 ++---
     .../PublicReferenceToPrivateTypeCheck.java    |  2 +-
     .../checks/sizes/LineLengthExtendedCheck.java |  3 ++-
     .../internal/CheckstyleRegressionTest.java    |  6 +++---
     .../internal/CommitValidationTest.java        |  2 +-
     9 files changed, 28 insertions(+), 29 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 c245a75da4..bdc8618893 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
    @@ -231,9 +231,9 @@ private boolean isRatioBetweenIfAndElseBlockSuitable(DetailAST literalIf) {
             boolean result = true;
     
             final DetailAST lastChildAfterIf = literalIf.getLastChild();
    -        final int linesOfCodeInIfBlock = getAmounOfCodeRowsInBlock(literalIf);
             final int linesOfCodeInElseBlock = getAmounOfCodeRowsInBlock(lastChildAfterIf);
             if (linesOfCodeInElseBlock > 0) {
    +            final int linesOfCodeInIfBlock = getAmounOfCodeRowsInBlock(literalIf);
                 result = linesOfCodeInIfBlock / linesOfCodeInElseBlock < multiplyFactorForElseBlocks;
             }
             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 6df860e705..886a43caad 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
    @@ -390,6 +390,8 @@ public void visitToken(DetailAST ast) {
         public void leaveToken(DetailAST ast) {
             if (ast.getType() == TokenTypes.CLASS_DEF
                     && !isClassDefInMethodDef(ast)) {
    +            // -@cs[MoveVariableInsideIf] assignment value is a modification
    +            // call so it can't be moved
                 final ClassDetail classDetail = classDetails.pop();
     
                 if (checkGettersSetters) {
    @@ -687,9 +689,6 @@ private static boolean isSetterName(String methodName) {
         private boolean isGetterCorrect(DetailAST methodDef, String methodPrefix) {
             boolean result = false;
     
    -        final String methodName = getIdentifier(methodDef);
    -        final String methodNameWithoutPrefix = getNameWithoutPrefix(methodName, methodPrefix);
    -
             final DetailAST parameters = methodDef.findFirstToken(TokenTypes.PARAMETERS);
     
             // no parameters
    @@ -703,6 +702,9 @@ private boolean isGetterCorrect(DetailAST methodDef, String methodPrefix) {
                     if (returnStatementAst != null) {
                         final DetailAST exprAst = returnStatementAst.getFirstChild();
                         final String returnedFieldName = getNameOfGetterField(exprAst);
    +                    final String methodName = getIdentifier(methodDef);
    +                    final String methodNameWithoutPrefix = getNameWithoutPrefix(methodName,
    +                            methodPrefix);
                         if (returnedFieldName != null
                                 && !localVariableHidesField(statementsAst, returnedFieldName)
                                 && verifyFieldAndMethodName(returnedFieldName,
    @@ -748,15 +750,14 @@ private static boolean localVariableHidesField(DetailAST slist,
         private boolean isSetterCorrect(DetailAST methodDefAst, String methodPrefix) {
             boolean result = false;
     
    -        final String methodName = getIdentifier(methodDefAst);
    -        final String setterFieldName = fieldPrefix
    -                + getNameWithoutPrefix(methodName, 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
    +                    + getNameWithoutPrefix(methodName, methodPrefix);
     
                 result = statementsAst != null
                         && !localVariableHidesField(statementsAst, setterFieldName)
    @@ -1066,9 +1067,8 @@ private static boolean isMainMethodModifiers(final DetailAST methodAST) {
          */
         private static boolean isVoidType(final DetailAST methodAST) {
             boolean result = true;
    -        DetailAST methodTypeAST = null;
             if (hasChildToken(methodAST, TokenTypes.TYPE)) {
    -            methodTypeAST = methodAST.findFirstToken(TokenTypes.TYPE);
    +            final DetailAST methodTypeAST = methodAST.findFirstToken(TokenTypes.TYPE);
                 result = hasChildToken(methodTypeAST, TokenTypes.LITERAL_VOID);
             }
             return result;
    @@ -1343,9 +1343,8 @@ else if (isBooleanGetterName(getterName)) {
                             // method is NOT getter
                             final DetailAST setterAst = allGettersSetters.get(j);
                             final String setterName = getIdentifier(setterAst);
    -                        String setterField = null;
                             if (isSetterName(setterName)) {
    -                            setterField = getNameWithoutPrefix(
    +                            final String setterField = getNameWithoutPrefix(
                                         getIdentifier(setterAst), SETTER_PREFIX);
     
                                 // if fields are same and setter is sibling with getter
    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 8b5be02235..f5b280e704 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
    @@ -330,14 +330,10 @@ private String validate(DetailAST forLiteralNode) {
             final DetailAST forEachNode = forLiteralNode.findFirstToken(TokenTypes.FOR_EACH_CLAUSE);
             final DetailAST keySetOrEntrySetNode =
                     getKeySetOrEntrySetNode(forEachNode);
    -        boolean isMapClassField = false;
             // Search for keySet or entrySet
             if (keySetOrEntrySetNode != null) {
    -            if (keySetOrEntrySetNode.getPreviousSibling().getChildCount() != 0) {
    -                isMapClassField = true;
    -            }
    -            final DetailAST variableDefNode = forEachNode.getFirstChild();
    -            final String keyOrEntryVariableName = variableDefNode.getLastChild().getText();
    +            final boolean isMapClassField = keySetOrEntrySetNode.getPreviousSibling()
    +                    .getChildCount() != 0;
     
                 final String currentMapVariableName;
     
    @@ -351,6 +347,8 @@ private String validate(DetailAST forLiteralNode) {
                 final DetailAST forEachOpeningBrace = forLiteralNode.getLastChild();
     
                 if (!isMapPassedIntoAnyMethod(forEachOpeningBrace)) {
    +                final DetailAST variableDefNode = forEachNode.getFirstChild();
    +                final String keyOrEntryVariableName = variableDefNode.getLastChild().getText();
     
                     if (proposeKeySetUsage
                             && KEY_SET_METHOD_NAME.equals(
    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 f15daee212..ba1995b267 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
    @@ -98,10 +98,12 @@ public int[] getDefaultTokens() {
         public void work(DetailAST ast) {
     
             DetailAST nextNode = ast.getNextSibling();
    -        final boolean isCommaSeparated = (nextNode != null)
    -                && (nextNode.getType() == TokenTypes.COMMA);
     
             if (nextNode != null) {
    +            // -@cs[MoveVariableInsideIf] assignment value is modified later so
    +            // it can't be moved
    +            final boolean isCommaSeparated = nextNode.getType() == TokenTypes.COMMA;
    +
                 if ((nextNode.getType() == TokenTypes.COMMA)
                         || (nextNode.getType() == TokenTypes.SEMI)) {
                     nextNode = nextNode.getNextSibling();
    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 2ebd9db589..00ffae7386 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
    @@ -93,8 +93,8 @@ public int[] getDefaultTokens() {
     
         @Override
         public void visitToken(DetailAST methodDef) {
    -        final String methodName = methodDef.findFirstToken(TokenTypes.IDENT).getText();
             if (hasBody(methodDef) && !isMethodAtAnonymousClass(methodDef)) {
    +            final String methodName = methodDef.findFirstToken(TokenTypes.IDENT).getText();
                 if (methodName.startsWith(BOOLEAN_GETTER_PREFIX)) {
                     if (!isGetterCorrect(methodDef,
                             methodName.substring(BOOLEAN_GETTER_PREFIX.length()))) {
    @@ -224,10 +224,9 @@ private static String getNameOfSettingField(DetailAST assign,
                 DetailAST parameters) {
             String nameOfSettingField = null;
     
    -        final DetailAST assigningFirstChild = assign.getFirstChild();
    -
             if (assign.getChildCount() == 2
                     && assign.getLastChild().getType() == TokenTypes.IDENT) {
    +            final DetailAST assigningFirstChild = assign.getFirstChild();
     
                 if (assigningFirstChild.getType() == TokenTypes.IDENT) {
     
    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 a8d13ff430..3ecf6ca03d 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
    @@ -214,11 +214,11 @@ private void addExternallyAccessibleFieldTypes(DetailAST fieldDefAst) {
          */
         private static List
                 getMethodParameterTypes(DetailAST parametersDefAst) {
    -        DetailAST parameterType = null;
             final List parameterTypes = new ArrayList<>();
     
             if (parametersDefAst.getFirstChild() != null) {
                 DetailAST currentNode = parametersDefAst;
    +            DetailAST parameterType = null;
     
                 while (currentNode != null) {
                     if (currentNode.getType() == TokenTypes.PARAMETER_DEF) {
    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 404b4909a7..602627382d 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
    @@ -194,11 +194,12 @@ public int[] getDefaultTokens() {
     
         @Override
         public void visitToken(DetailAST ast) {
    -        final DetailAST endOfIgnoreLine = ast.findFirstToken(TokenTypes.SLIST);
             if (ast.getParent() != null
                     && ast.getParent().getType() == TokenTypes.OBJBLOCK
                     || ast.getType() == TokenTypes.CLASS_DEF) {
                 final int mNumberOfLine = ast.getLineNo();
    +            final DetailAST endOfIgnoreLine = ast.findFirstToken(TokenTypes.SLIST);
    +
                 if (endOfIgnoreLine == null) {
                     lines[mNumberOfLine - 1] = null;
                 }
    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 234335dcb0..9249db4c96 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
    @@ -88,9 +88,6 @@ private static void work(File config, File suppression) throws Exception {
     
             trimSevntuChecksNotReferenced(configChecks, sevntuChecks);
     
    -        String configContents = new String(Files.readAllBytes(config.toPath()), UTF_8);
    -        String suppressionContents = new String(Files.readAllBytes(suppression.toPath()), UTF_8);
    -
             if (sevntuChecks.size() > 0) {
                 System.out.println("Adding " + sevntuChecks.size() + " missing check(s)");
     
    @@ -113,6 +110,8 @@ private static void work(File config, File suppression) throws Exception {
                     }
                 }
     
    +            String configContents = new String(Files.readAllBytes(config.toPath()), UTF_8);
    +
                 int treeWalkerPosition = configContents.lastIndexOf("");
                 treeWalkerPosition = configContents.indexOf('\n', treeWalkerPosition) + 1;
     
    @@ -122,6 +121,7 @@ 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);
                     final int position = suppressionContents.lastIndexOf("
    Date: Tue, 9 May 2017 10:06:17 -0400
    Subject: [PATCH 077/208] Pull #565: added new check MoveVariableInsideIfCheck
    
    ---
     .../coding/checkstyle-metadata.properties     |   3 +
     .../checks/coding/checkstyle-metadata.xml     |   7 +
     sevntu-checks/sevntu-checks.xml               |   1 +
     .../coding/MoveVariableInsideIfCheck.java     | 356 ++++++++++++++++++
     .../checks/coding/messages.properties         |   1 +
     .../coding/MoveVariableInsideIfCheckTest.java |  62 +++
     ...veVariableInsideIfCheckFalsePositives.java |  45 +++
     ...MoveVariableInsideIfCheckNoViolations.java | 119 ++++++
     ...utMoveVariableInsideIfCheckViolations.java |  51 +++
     .../sonar/checkstyle-extensions.xml           |   8 +
     10 files changed, 653 insertions(+)
     create mode 100644 sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/MoveVariableInsideIfCheck.java
     create mode 100644 sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MoveVariableInsideIfCheckTest.java
     create mode 100644 sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMoveVariableInsideIfCheckFalsePositives.java
     create mode 100644 sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMoveVariableInsideIfCheckNoViolations.java
     create mode 100644 sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputMoveVariableInsideIfCheckViolations.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 5000acc0a6..c68322df03 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
    @@ -177,3 +177,6 @@ EitherLogOrThrowCheck.loggingMethodNames = Logging method names separated with c
     
     WhitespaceBeforeArrayInitializerCheck.name = Whitespace Before Array Initializer
     WhitespaceBeforeArrayInitializerCheck.desc = This checks enforces whitespace before array initializer.
    +
    +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.
    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 1858e724bf..5e930c3902 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
    @@ -529,5 +529,12 @@
           
         
     
    +    
    +      
    +      %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: + *

    + *
    + * <module name="MoveVariableInsideIfCheck"/>
    + * 
    + *

    + * which will produce the following violation: + *

    + *
    + * String variable = input.substring(1); // violation - variable is only used inside if block
    + *
    + * if (condition) {
    + *     return method(variable);
    + * }
    + *
    + * return "";
    + * 
    + *

    + * The code can be written as the following to avoid a violation: + *

    + *
    + * if (condition) {
    + *     String variable = input.substring(1);
    + *     return method(variable);
    + * }
    + *
    + * return "";
    + * 
    + *

    + * No violations will be produced if a variable is used in same scope as declaration, condition of + * block, or if used in multiple blocks. + *

    + *
    + * String variable = input.substring(1);
    + *
    + * if (condition && variable.charAt(0) == 'T') {
    + *     return method(variable);
    + * }
    + * else {
    + *     return method2(variable);
    + * }
    + *
    + * return "";
    + * 
    + *

    + * 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 354a0d23e34ae9394b355573d2c33d2fe9e53540 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-checkstyle parent 1.23.1 pom 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-checkstyle parent 1.23.1 - com.github.sevntu.checkstyle + com.github.sevntu-checkstyle com.github.sevntu.checkstyle.checks.feature eclipse-feature Extension 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-checkstyle parent 1.23.1 - com.github.sevntu.checkstyle + com.github.sevntu-checkstyle eclipsecs-sevntu-plugin eclipse-plugin @@ -31,7 +31,7 @@ - com.github.sevntu.checkstyle + com.github.sevntu-checkstyle sevntu-checks ${project.version} @@ -85,7 +85,7 @@ - com.github.sevntu.checkstyle + com.github.sevntu-checkstyle sevntu-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-checkstyle sevntu-checks 1.23.1 @@ -70,7 +70,7 @@ - com.github.sevntu.checkstyle + com.github.sevntu-checkstyle sevntu-checks file://${basedir}/../gh-pages/maven2/ @@ -249,7 +249,7 @@
    - com.github.sevntu.checkstyle + com.github.sevntu-checkstyle sevntu-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-checkstyle sevntu-checkstyle-idea-extension 1.23.1 jar @@ -19,7 +19,7 @@ - com.github.sevntu.checkstyle + com.github.sevntu-checkstyle sevntu-checks ${project.version} @@ -27,7 +27,7 @@ - com.github.sevntu.checkstyle + com.github.sevntu-checkstyle Sevntu Checkstyle Idea extension file://${basedir}/../gh-pages/maven2/ @@ -54,7 +54,7 @@ - com.github.sevntu.checkstyle + com.github.sevntu-checkstyle sevntu-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-checkstyle sevntu-checkstyle-maven-plugin Sevntu Checkstyle Maven Plugin 1.23.1 @@ -16,7 +16,7 @@ - com.github.sevntu.checkstyle + com.github.sevntu-checkstyle sevntu-checks 1.23.1 @@ -29,7 +29,7 @@ - com.github.sevntu.checkstyle + com.github.sevntu-checkstyle Sevntu Checkstyle Maven Plugin file://${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-checkstyle sevntu-checkstyle-sonar-plugin 1.23.1 sonar-plugin @@ -31,7 +31,7 @@
    - com.github.sevntu.checkstyle + com.github.sevntu-checkstyle sevntu-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-checkstyle parent 1.23.1 From 6021e98de867e48893bc1318dcd009cfb24f149b 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-checkstyle sevntu-checks 1.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-checkstyle sevntu-checkstyle-idea-extension 1.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-checkstyle sevntu-checkstyle-maven-plugin Sevntu 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-checkstyle sevntu-checkstyle-sonar-plugin 1.23.1 From 91169117ebb3e86e594a42684850cead53f76ade 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.plugins maven-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.plugins maven-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.mojo xml-maven-plugin From 7bfc71de456d1518666c72b95d64aa994f44b513 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.4 attach-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 279b97b9123125c6496bf895974d8f940b021da0 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-staging https://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-staging https://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-staging https://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-staging https://oss.sonatype.org/ false + true From cdd0f1fbfb47733b1dae27b6c53bf0ad2e42ce0a 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:

    enum SimpleErrorEnum\n  {\n      FIRST_SIMPLE, SECOND_SIMPLE, THIRD_SIMPLE;\n  }

    While Class Enumeration has some methods, for example:

     enum SimpleErrorEnum\n   {\n       FIRST_SIMPLE, SECOND_SIMPLE, THIRD_SIMPLE;\n \n       public String toString() {\n           return Integer.toString(ordinal() + 10);\n       }\n   }

    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: + *

    + *
    + * <module name="EnumValueName">
    + *    <property name="format" value="^[a-z_0-9]+*$"/>
    + * </module>
    + * 
    * * @author Pavel Baranchikov - * - * @see
    - * Java Coding Style */ -public class EnumValueNameCheck extends AbstractCheck { - /** - * A key is pointing to the warning message text in "messages.properties" - * file. - */ - public static final String MSG_CONST = "enum.name.const.invalidPattern"; - /** - * A key is pointing to the warning message text in "messages.properties" - * file. - */ - public static final String MSG_OBJ = "enum.name.obj.invalidPattern"; - +public class EnumValueNameCheck extends AbstractNameCheck { /** * Default pattern for Values Enumeration names. */ - public static final String DEFAULT_CONST_PATTERN = + public static final String DEFAULT_PATTERN = "^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"; /** - * Default pattern for Class Enumeration names. - */ - public static final String DEFAULT_OBJ_PATTERN = "^[A-Z][a-zA-Z0-9]*$"; - - /** - * Default exclusions value. - */ - private static final String[] DEFAULT_EXCLUSION = { - "toString", - }; - - /** - * Regular expression to test Class Enumeration names against. - */ - private Pattern objRegexp; - - /** - * Format for Class Enumeration names to check for. Compiled to - * {@link #objRegexp} - */ - private String objFormat; - - /** - * Regular expression to test Values Enumeration names against. - */ - private Pattern constRegexp; - - /** - * Format for Values Enumeration names to check for. Compiled to - * {@link #constRegexp} - */ - private String constFormat; - - /** - * Method and field names to exclude from check. - */ - private final List excludes; - - /** - * Constructs check with the default pattern.compile. + * Creates a new {@code EnumValueNameCheck} instance. */ public EnumValueNameCheck() { - setConstFormat(DEFAULT_CONST_PATTERN); - setObjFormat(DEFAULT_OBJ_PATTERN); - excludes = Lists.newArrayList(); - setExcludes(DEFAULT_EXCLUSION); - } - - /** - * Method sets format to match Class Enumeration names. - * @param newConstRegexp format to check against - */ - public final void setConstFormat(String newConstRegexp) { - this.constRegexp = Pattern.compile(newConstRegexp, 0); - constFormat = newConstRegexp; - } - - /** - * Method sets format to match Values Enumeration names. - * @param objectRegexp format to check against - */ - public final void setObjFormat(String objectRegexp) { - objRegexp = Pattern.compile(objectRegexp, 0); - objFormat = objectRegexp; - } - - /** - * Method sets method and field name exclusions. - * @param excludes - * comma separated list or regular expressions - */ - public final void setExcludes(String[] excludes) { - this.excludes.clear(); - for (String exclude: excludes) { - this.excludes.add(Pattern.compile(exclude)); - } + super(DEFAULT_PATTERN); } @Override public int[] getDefaultTokens() { - return new int[] { - TokenTypes.ENUM_CONSTANT_DEF, - }; + return getAcceptableTokens(); } @Override - public void visitToken(DetailAST ast) { - final DetailAST nameAST = ast.findFirstToken(TokenTypes.IDENT); - final boolean enumIsClass = isClassEnumeration(ast); - final Pattern pattern; - if (enumIsClass) { - pattern = objRegexp; - } - else { - pattern = constRegexp; - } - if (!pattern.matcher(nameAST.getText()).find()) { - final String format; - if (enumIsClass) { - format = objFormat; - } - else { - format = constFormat; - } - final String msg; - if (enumIsClass) { - msg = MSG_OBJ; - } - else { - msg = MSG_CONST; - } - log(nameAST.getLineNo(), - nameAST.getColumnNo(), - msg, - nameAST.getText(), - format); - } + public int[] getAcceptableTokens() { + return new int[] {TokenTypes.ENUM_CONSTANT_DEF}; } - /** - * Method determines, whether the Enum, specified as parameter has any - * members. Method uses {@link #excludes} while looking though the tree - * nodes - * - * @param ast - * ast to check - * @return true if enum is a class enumeration - */ - private boolean isClassEnumeration(DetailAST ast) { - return hasMembers(ast, excludes); - } - - /** - * Method determines whether the specified enum is a constant or is an - * object. - * - * @param ast - * token of a enum value definition - * @param excludes - * list of ignored member names - * @return true if enum is a class enumeration - */ - private static boolean - hasMembers(DetailAST ast, List excludes) { - final DetailAST objBlock = ast.getParent(); - boolean memberFound = false; - for (DetailAST member = objBlock.getFirstChild(); member != null; member = member - .getNextSibling()) { - if (member.getType() == TokenTypes.METHOD_DEF - || member.getType() == TokenTypes.VARIABLE_DEF) { - final DetailAST memberIdent = member - .findFirstToken(TokenTypes.IDENT); - final String identifierStr = memberIdent.getText(); - if (!isAnyMatched(excludes, identifierStr)) { - memberFound = true; - break; - } - } - } - return memberFound; - } - - /** - * Returns whether at least one of patterns are successfully matched arainst - * the specified string value - * @param patterns - * pattern list to match against - * @param value - * value to match - * @return true if at least one pattern have been successfully - * matched. - */ - private static boolean - isAnyMatched(Collection patterns, String value) { - for (Pattern pattern : patterns) { - if (pattern.matcher(value).find()) { - return true; - } - } - return false; + @Override + protected boolean mustCheckName(DetailAST ast) { + return true; } - } 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 d2322e5b21..0edc20059a 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,5 +1,3 @@ name.invalidPattern=Name ''{0}'' must match pattern ''{1}''. -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}. enum.name.format.violated=Name of enumeration value ''{0}'' must match pattern {1}. 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 8b6ccb1304..5a67551eab 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 @@ -19,192 +19,47 @@ package com.github.sevntu.checkstyle.checks.naming; -import java.text.MessageFormat; +import static com.github.sevntu.checkstyle.checks.naming.EnumValueNameCheck.DEFAULT_PATTERN; +import static com.puppycrawl.tools.checkstyle.checks.naming.AbstractNameCheck.MSG_INVALID_PATTERN; -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.CheckstyleException; -/** - * Test unit for - * {@link EnumValueNameCheck}. - * @author Pavel Baranchikov - */ public class EnumValueNameCheckTest extends BaseCheckTestSupport { - private final String msgObj = getCheckMessage(EnumValueNameCheck.MSG_OBJ); - private final String msgConst = getCheckMessage(EnumValueNameCheck.MSG_CONST); - private final String inputFile; - - public EnumValueNameCheckTest() { - inputFile = getPath("InputEnumValueNameCheck.java"); - } - - /** - * Tests for a default naming pattern. - * - * @throws Exception - * on some errors during verification. - */ @Test public void testDefault() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(EnumValueNameCheck.class); - final MessageContext constContext = new MessageContext(false, - EnumValueNameCheck.DEFAULT_CONST_PATTERN); - final MessageContext objContext = new MessageContext(true, - EnumValueNameCheck.DEFAULT_OBJ_PATTERN); - final String[] expected = { - buildMessage(35, 9, "FirstSimple", constContext), - buildMessage(43, 26, "SECOND_COMPLEX", objContext), - buildMessage(66, 19, "MoSecond", constContext), - buildMessage(76, 9, "FO_FIRST", objContext), - }; - verify(checkConfig, inputFile, expected); - } - - /** - * Tests for a default naming pattern with exclusion of "some*" member - * names. - * - * @throws Exception - * on some errors during verification. - */ - @Test - public void testExcludes() - throws Exception { - final DefaultConfiguration checkConfig = - createCheckConfig(EnumValueNameCheck.class); - final MessageContext constContext = new MessageContext(false, - EnumValueNameCheck.DEFAULT_CONST_PATTERN); - final MessageContext objContext = new MessageContext(true, - EnumValueNameCheck.DEFAULT_OBJ_PATTERN); - checkConfig.addAttribute("excludes", "some*"); final String[] expected = { - buildMessage(35, 9, "FirstSimple", constContext), - buildMessage(43, 26, "SECOND_COMPLEX", objContext), - buildMessage(66, 9, "MO_FIRST", objContext), - buildMessage(76, 19, "FoSecond", constContext), + "35:9: " + getCheckMessage(MSG_INVALID_PATTERN, "FirstSimple", DEFAULT_PATTERN), + "43:9: " + getCheckMessage(MSG_INVALID_PATTERN, "FirstComplex", DEFAULT_PATTERN), + "66:19: " + getCheckMessage(MSG_INVALID_PATTERN, "MoSecond", DEFAULT_PATTERN), + "76:19: " + getCheckMessage(MSG_INVALID_PATTERN, "FoSecond", DEFAULT_PATTERN), }; - verify(checkConfig, inputFile, expected); + verify(checkConfig, getPath("InputEnumValueNameCheck.java"), expected); } - /** - * Tests for wrong formatter string. - * - * @throws Exception - * on some errors during verification. - */ @Test - public void testInvalidFormat() + public void testCustomFormat() throws Exception { + final String pattern = "[a-z]+"; final DefaultConfiguration checkConfig = createCheckConfig(EnumValueNameCheck.class); - checkConfig.addAttribute("constFormat", "\\"); - final String[] expected = {}; - try { - verify(checkConfig, inputFile, expected); - fail(); - } - catch (CheckstyleException ex) { - Assert.assertTrue(ex.getMessage().startsWith("cannot initialize module " - + "com.puppycrawl.tools.checkstyle.TreeWalker - " - + "Cannot set property 'constFormat' to '\\' in module ")); - } - } - /** - * Tests for upset naming - Values Enumeration in camel notation while Class - * Enumeration - in upper-case notation. - * - * @throws Exception - * on some errors during verification. - */ - @Test - public void testUpset() - throws Exception { - final DefaultConfiguration checkConfig = - createCheckConfig(EnumValueNameCheck.class); - final MessageContext constContext = new MessageContext(false, - EnumValueNameCheck.DEFAULT_OBJ_PATTERN); - final MessageContext objContext = new MessageContext(true, - EnumValueNameCheck.DEFAULT_CONST_PATTERN); - - checkConfig.addAttribute("constFormat", constContext.getPattern()); - checkConfig.addAttribute("objFormat", objContext.getPattern()); + checkConfig.addAttribute("format", pattern); final String[] expected = { - buildMessage(35, 22, "SECOND_SIMPLE", constContext), - buildMessage(43, 9, "FirstComplex", objContext), - buildMessage(66, 9, "MO_FIRST", constContext), - buildMessage(76, 19, "FoSecond", objContext), + "35:22: " + getCheckMessage(MSG_INVALID_PATTERN, "SECOND_SIMPLE", pattern), + "35:37: " + getCheckMessage(MSG_INVALID_PATTERN, "DB2", pattern), + "35:42: " + getCheckMessage(MSG_INVALID_PATTERN, "V1", pattern), + "43:26: " + getCheckMessage(MSG_INVALID_PATTERN, "SECOND_COMPLEX", pattern), + "43:45: " + getCheckMessage(MSG_INVALID_PATTERN, "V2", pattern), + "66:9: " + getCheckMessage(MSG_INVALID_PATTERN, "MO_FIRST", pattern), + "76:9: " + getCheckMessage(MSG_INVALID_PATTERN, "FO_FIRST", pattern), }; - verify(checkConfig, inputFile, expected); + verify(checkConfig, getPath("InputEnumValueNameCheck.java"), expected); } - - /** - * Tests equal values for constants and static final object references. - * - * @throws Exception - * on some errors during verification. - */ - @Test - public void testEqualRegexps() - throws Exception { - final DefaultConfiguration checkConfig = - createCheckConfig(EnumValueNameCheck.class); - final MessageContext constContext = new MessageContext(false, - EnumValueNameCheck.DEFAULT_CONST_PATTERN); - final MessageContext objContext = new MessageContext(true, - EnumValueNameCheck.DEFAULT_CONST_PATTERN); - checkConfig.addAttribute("constFormat", constContext.getPattern()); - checkConfig.addAttribute("objFormat", objContext.getPattern()); - - final String[] expected = { - buildMessage(35, 9, "FirstSimple", constContext), - buildMessage(43, 9, "FirstComplex", objContext), - buildMessage(66, 19, "MoSecond", constContext), - buildMessage(76, 19, "FoSecond", objContext), - }; - verify(checkConfig, inputFile, expected); - } - - private String buildMessage(int lineNumber, int colNumber, - String constName, MessageContext context) { - final String msg; - if (context.isEnumObj()) { - msg = msgObj; - } - else { - msg = msgConst; - } - return lineNumber + ":" + colNumber + ": " - + MessageFormat.format(msg, constName, context.getPattern()); - } - - /** - * Class containing pattern and is-object flag. - */ - private static final class MessageContext { - private final boolean enumObj; - private final String pattern; - - private MessageContext(boolean enumIsObj, String pattern) { - this.enumObj = enumIsObj; - this.pattern = pattern; - } - - public boolean isEnumObj() { - return enumObj; - } - - public String getPattern() { - return pattern; - } - - } - } 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 380ac27513..eaae026067 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 @@ -777,21 +777,13 @@ com.github.sevntu.checkstyle.checks.naming.EnumValueNameCheck Check for enum values name - Check forces enum values to match the specific pattern + Checks that enumeration value names conform to a format specified by the format property. Checker/TreeWalker/com.github.sevntu.checkstyle.checks.naming.EnumValueNameCheck - - Regex for Values Enumeration name to conform + + Regex for enumeration value names to conform ^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$ - - Regex for Class Enumeration name to conform - ^[A-Z][a-zA-Z0-9]*$ - - - Exclude method and field names regexp list (comma-separated) - toString - From a646fffafbc1f8cd5879b1c22ce3c6d0a8887a5a Mon Sep 17 00:00:00 2001 From: Roman Ivanov Date: Thu, 25 May 2017 19:42:14 -0700 Subject: [PATCH 084/208] Issue #165: update for deploy.sh to do have special mode for deploy to maven central --- deploy.sh | 43 +++++++++++++++++++++--- sevntu-checks/pom.xml | 20 ++++++----- sevntu-checkstyle-idea-extension/pom.xml | 22 +++++++----- sevntu-checkstyle-maven-plugin/pom.xml | 21 +++++++----- 4 files changed, 78 insertions(+), 28 deletions(-) diff --git a/deploy.sh b/deploy.sh index dab444d2a9..8a8de2a546 100755 --- a/deploy.sh +++ b/deploy.sh @@ -43,7 +43,7 @@ prepareForDeploy() deployIdea() { cd $REPO_HOME_DIR/sevntu-checkstyle-idea-extension/ - mvn clean deploy + mvn clean deploy -Plocal-deploy if [ "$?" != "0" ] then echo "build for $REPO_HOME_DIR/sevntu-checkstyle-idea-extension/" @@ -61,7 +61,7 @@ deployEclipse() #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 + mvn clean install -f eclipse-pom.xml -Plocal-deploy if [ "$?" != "0" ] then echo "build for eclipse-pom.xml." @@ -83,7 +83,7 @@ deployMavenLibrary() # 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 - mvn clean javadoc:javadoc deploy + mvn clean javadoc:javadoc deploy -Plocal-deploy if [ "$?" != "0" ] then echo "build for $REPO_HOME_DIR/sevntu-checks." @@ -100,10 +100,41 @@ deployMavenLibrary() return } +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 + # 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 + mvn clean deploy -DskipStaging=false + if [ "$?" != "0" ] + then + echo "build for $REPO_HOME_DIR/sevntu-checks." + exit 1 + fi + cd $REPO_HOME_DIR + + cd $REPO_HOME_DIR/sevntu-checkstyle-maven-plugin/ + mvn clean deploy -DskipStaging=false + cd $REPO_HOME_DIR + + cd $REPO_HOME_DIR/sevntu-checkstyle-idea-extension/ + mvn clean deploy -DskipStaging=false + cd $REPO_HOME_DIR + + cd $REPO_HOME_DIR/sevntu-checkstyle-sonar-plugin/ + mvn clean deploy -DskipStaging=false + cd $REPO_HOME_DIR + + return + } + deployMavenPlugin() { cd $REPO_HOME_DIR/sevntu-checkstyle-maven-plugin/ - mvn clean deploy + mvn clean deploy -Plocal-deploy if [ "$?" != "0" ] then echo "build for $REPO_HOME_DIR/sevntu-checkstyle-maven-plugin/." @@ -169,6 +200,10 @@ do deployMavenPlugin shift 1 ;; + --maven-central) + deployToMavenCentral + shift 1 + ;; --idea) prepareForDeploy deployMavenLibrary diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml index 09bc772384..d8f5e7a853 100644 --- a/sevntu-checks/pom.xml +++ b/sevntu-checks/pom.xml @@ -75,14 +75,6 @@ - - - com.github.sevntu-checkstyle - sevntu-checks - file://${basedir}/../gh-pages/maven2/ - - - @@ -330,6 +322,18 @@ + + + local-deploy + + + com.github.sevntu-checkstyle + sevntu-checks + file://${basedir}/../gh-pages/maven2/ + + + + diff --git a/sevntu-checkstyle-idea-extension/pom.xml b/sevntu-checkstyle-idea-extension/pom.xml index e14e08b988..d677890703 100644 --- a/sevntu-checkstyle-idea-extension/pom.xml +++ b/sevntu-checkstyle-idea-extension/pom.xml @@ -31,14 +31,6 @@ - - - com.github.sevntu-checkstyle - Sevntu Checkstyle Idea extension - file://${basedir}/../gh-pages/maven2/ - - - @@ -125,4 +117,18 @@ + + + local-deploy + + + com.github.sevntu-checkstyle + Sevntu Checkstyle Idea extension + file://${basedir}/../gh-pages/maven2/ + + + + + + diff --git a/sevntu-checkstyle-maven-plugin/pom.xml b/sevntu-checkstyle-maven-plugin/pom.xml index 0f2859005d..8d7132f3dd 100644 --- a/sevntu-checkstyle-maven-plugin/pom.xml +++ b/sevntu-checkstyle-maven-plugin/pom.xml @@ -34,14 +34,6 @@ - - - com.github.sevntu-checkstyle - Sevntu Checkstyle Maven Plugin - file://${basedir}/../gh-pages/maven2/ - - - @@ -93,4 +85,17 @@ + + + local-deploy + + + com.github.sevntu-checkstyle + Sevntu Checkstyle Maven Plugin + file://${basedir}/../gh-pages/maven2/ + + + + + From 562fe063994d3284c08fce66af0a3b77db50b474 Mon Sep 17 00:00:00 2001 From: rnveach Date: Fri, 26 May 2017 13:51:12 -0400 Subject: [PATCH 085/208] Issue #589: fixed OutOfBoundsException in CauseParameterInException --- .../checks/design/CauseParameterInExceptionCheck.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 237cfd169e..956b8210fa 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 @@ -144,6 +144,11 @@ public int[] getDefaultTokens() { }; } + @Override + public void beginTree(DetailAST rootAST) { + exceptionClassesToWarn.clear(); + } + @Override public void visitToken(DetailAST ast) { switch (ast.getType()) { @@ -173,7 +178,6 @@ public void finishTree(DetailAST treeRootAST) { for (DetailAST classDefNode : exceptionClassesToWarn) { log(classDefNode, MSG_KEY, getName(classDefNode)); } - exceptionClassesToWarn.clear(); } /** From 7e0169b0379dc4bfe1ac2d38ade32381207f7b78 Mon Sep 17 00:00:00 2001 From: Roman Ivanov Date: Fri, 26 May 2017 16:35:45 -0700 Subject: [PATCH 086/208] Issue #591: bump version of eclipse-cs --- .travis.yml | 2 +- eclipsecs-sevntu-plugin/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index f37eb217d3..f2d4c0f2a2 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.2.0" + - CMD1="&& cd eclipse-cs-git/ && git checkout 7.6.0" - 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 2f9b67ffd1..cb9aa4edc8 100644 --- a/eclipsecs-sevntu-plugin/pom.xml +++ b/eclipsecs-sevntu-plugin/pom.xml @@ -26,7 +26,7 @@ - 7.2.0-SNAPSHOT + 7.6.0-SNAPSHOT From 1b3fbea32cdd8b2355b4a6524ca0c211dab3d0a9 Mon Sep 17 00:00:00 2001 From: Roman Ivanov Date: Fri, 26 May 2017 21:19:41 -0700 Subject: [PATCH 087/208] minor: change name for UniformEnumConstantNameCheck in eclipse plugin --- .../checkstyle/checks/naming/checkstyle-metadata.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 ea8d1349b9..fb0b53dc8c 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 @@ -6,6 +6,6 @@ EnumValueNameCheck.name = Enum values name 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.name = Uniform 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. UniformEnumConstantNameCheck.formats = Regex list that enum value names should conform From a0e8e5ff2e6d17fe24aeeebde3038046b8855ed4 Mon Sep 17 00:00:00 2001 From: Roman Ivanov Date: Sat, 27 May 2017 05:44:48 -0700 Subject: [PATCH 088/208] version bump to 1.24.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 747e5a0759..675943b17b 100644 --- a/eclipse-pom.xml +++ b/eclipse-pom.xml @@ -5,7 +5,7 @@ com.github.sevntu-checkstyle parent - 1.23.1 + 1.24.0 pom diff --git a/eclipsecs-sevntu-plugin-feature/feature.xml b/eclipsecs-sevntu-plugin-feature/feature.xml index b5319db1e8..d60bf9d692 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 6c9563ecf9..b59cf7cc94 100644 --- a/eclipsecs-sevntu-plugin-feature/pom.xml +++ b/eclipsecs-sevntu-plugin-feature/pom.xml @@ -7,7 +7,7 @@ ../eclipse-pom.xml com.github.sevntu-checkstyle parent - 1.23.1 + 1.24.0 com.github.sevntu-checkstyle diff --git a/eclipsecs-sevntu-plugin/META-INF/MANIFEST.MF b/eclipsecs-sevntu-plugin/META-INF/MANIFEST.MF index c60b4b9e36..ef21505b23 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.23.1 +Bundle-Version: 1.24.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 cb9aa4edc8..e389bb48a6 100644 --- a/eclipsecs-sevntu-plugin/pom.xml +++ b/eclipsecs-sevntu-plugin/pom.xml @@ -9,7 +9,7 @@ ../eclipse-pom.xml com.github.sevntu-checkstyle parent - 1.23.1 + 1.24.0 com.github.sevntu-checkstyle diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml index d8f5e7a853..b2e9a6c0e4 100644 --- a/sevntu-checks/pom.xml +++ b/sevntu-checks/pom.xml @@ -11,7 +11,7 @@ com.github.sevntu-checkstyle sevntu-checks - 1.23.1 + 1.24.0 iso-8859-1 diff --git a/sevntu-checkstyle-idea-extension/pom.xml b/sevntu-checkstyle-idea-extension/pom.xml index d677890703..046320b2a4 100644 --- a/sevntu-checkstyle-idea-extension/pom.xml +++ b/sevntu-checkstyle-idea-extension/pom.xml @@ -11,7 +11,7 @@ com.github.sevntu-checkstyle sevntu-checkstyle-idea-extension - 1.23.1 + 1.24.0 jar Sevntu Checkstyle Idea extension diff --git a/sevntu-checkstyle-maven-plugin/pom.xml b/sevntu-checkstyle-maven-plugin/pom.xml index 8d7132f3dd..9e6bba1b87 100644 --- a/sevntu-checkstyle-maven-plugin/pom.xml +++ b/sevntu-checkstyle-maven-plugin/pom.xml @@ -12,7 +12,7 @@ com.github.sevntu-checkstyle sevntu-checkstyle-maven-plugin Sevntu Checkstyle Maven Plugin - 1.23.1 + 1.24.0 @@ -25,7 +25,7 @@ com.github.sevntu-checkstyle sevntu-checks - 1.23.1 + 1.24.0 org.apache.maven.plugins diff --git a/sevntu-checkstyle-sonar-plugin/pom.xml b/sevntu-checkstyle-sonar-plugin/pom.xml index fabbc2b576..b27500c68b 100644 --- a/sevntu-checkstyle-sonar-plugin/pom.xml +++ b/sevntu-checkstyle-sonar-plugin/pom.xml @@ -11,7 +11,7 @@ com.github.sevntu-checkstyle sevntu-checkstyle-sonar-plugin - 1.23.1 + 1.24.0 sonar-plugin SevNTU Checkstyle Sonar Extension Plugin diff --git a/update-site/pom.xml b/update-site/pom.xml index 8ceb8b9b08..9e1562fbcf 100644 --- a/update-site/pom.xml +++ b/update-site/pom.xml @@ -7,7 +7,7 @@ ../eclipse-pom.xml com.github.sevntu-checkstyle parent - 1.23.1 + 1.24.0 com.github.sevntu.checkstyle.p2updatesite From 0d510dd04fb9b8eee37a84ab4e15d17406fe7485 Mon Sep 17 00:00:00 2001 From: Roman Ivanov Date: Sat, 27 May 2017 07:27:55 -0700 Subject: [PATCH 089/208] minor: add Dummy.java to force javadoc jar generation to satisfy maven central requirements --- sevntu-checkstyle-idea-extension/src/Dummy.java | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 sevntu-checkstyle-idea-extension/src/Dummy.java diff --git a/sevntu-checkstyle-idea-extension/src/Dummy.java b/sevntu-checkstyle-idea-extension/src/Dummy.java new file mode 100644 index 0000000000..aa5ea84544 --- /dev/null +++ b/sevntu-checkstyle-idea-extension/src/Dummy.java @@ -0,0 +1,4 @@ +/** +* Just need smth to make javadoc to pass maven central requirements +*/ +class Dummy {} \ No newline at end of file From 4d20e78cd3757ce0be267549ccd2fbc94b2c2078 Mon Sep 17 00:00:00 2001 From: Roman Ivanov Date: Sat, 27 May 2017 07:54:09 -0700 Subject: [PATCH 090/208] Issue #165: fix for 'failureMessage Missing Signature ...' --- deploy.sh | 8 ++++---- sevntu-checks/pom.xml | 15 +++++++++++++++ sevntu-checkstyle-idea-extension/pom.xml | 15 +++++++++++++++ sevntu-checkstyle-maven-plugin/pom.xml | 15 +++++++++++++++ sevntu-checkstyle-sonar-plugin/pom.xml | 15 +++++++++++++++ 5 files changed, 64 insertions(+), 4 deletions(-) diff --git a/deploy.sh b/deploy.sh index 8a8de2a546..0cd43da022 100755 --- a/deploy.sh +++ b/deploy.sh @@ -108,7 +108,7 @@ deployToMavenCentral() # 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 - mvn clean deploy -DskipStaging=false + mvn clean deploy -DskipStaging=false -Pgpg if [ "$?" != "0" ] then echo "build for $REPO_HOME_DIR/sevntu-checks." @@ -117,15 +117,15 @@ deployToMavenCentral() cd $REPO_HOME_DIR cd $REPO_HOME_DIR/sevntu-checkstyle-maven-plugin/ - mvn clean deploy -DskipStaging=false + mvn clean deploy -DskipStaging=false -Pgpg cd $REPO_HOME_DIR cd $REPO_HOME_DIR/sevntu-checkstyle-idea-extension/ - mvn clean deploy -DskipStaging=false + mvn clean deploy -DskipStaging=false -Pgpg cd $REPO_HOME_DIR cd $REPO_HOME_DIR/sevntu-checkstyle-sonar-plugin/ - mvn clean deploy -DskipStaging=false + mvn clean deploy -DskipStaging=false -Pgpg cd $REPO_HOME_DIR return diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml index b2e9a6c0e4..c77cbc141f 100644 --- a/sevntu-checks/pom.xml +++ b/sevntu-checks/pom.xml @@ -117,6 +117,21 @@ + + org.apache.maven.plugins + maven-gpg-plugin + 1.6 + + + sign-artifacts + verify + + sign + + + + + org.sonatype.plugins nexus-staging-maven-plugin diff --git a/sevntu-checkstyle-idea-extension/pom.xml b/sevntu-checkstyle-idea-extension/pom.xml index 046320b2a4..50d9e5f493 100644 --- a/sevntu-checkstyle-idea-extension/pom.xml +++ b/sevntu-checkstyle-idea-extension/pom.xml @@ -68,6 +68,21 @@ + + org.apache.maven.plugins + maven-gpg-plugin + 1.6 + + + sign-artifacts + verify + + sign + + + + + org.sonatype.plugins nexus-staging-maven-plugin diff --git a/sevntu-checkstyle-maven-plugin/pom.xml b/sevntu-checkstyle-maven-plugin/pom.xml index 9e6bba1b87..09c69d9aff 100644 --- a/sevntu-checkstyle-maven-plugin/pom.xml +++ b/sevntu-checkstyle-maven-plugin/pom.xml @@ -66,6 +66,21 @@ + + org.apache.maven.plugins + maven-gpg-plugin + 1.6 + + + sign-artifacts + verify + + sign + + + + + org.sonatype.plugins nexus-staging-maven-plugin diff --git a/sevntu-checkstyle-sonar-plugin/pom.xml b/sevntu-checkstyle-sonar-plugin/pom.xml index b27500c68b..6cfc25136b 100644 --- a/sevntu-checkstyle-sonar-plugin/pom.xml +++ b/sevntu-checkstyle-sonar-plugin/pom.xml @@ -82,6 +82,21 @@ + + org.apache.maven.plugins + maven-gpg-plugin + 1.6 + + + sign-artifacts + verify + + sign + + + + + org.sonatype.plugins nexus-staging-maven-plugin From aab1d6ca232c739d8237c2a3b0f040f726a61e4d Mon Sep 17 00:00:00 2001 From: Roman Ivanov Date: Sat, 27 May 2017 13:55:00 -0700 Subject: [PATCH 091/208] Issue #165: force sevntu-checkstyle-idea-extension to generate javadoc jar --- sevntu-checkstyle-idea-extension/pom.xml | 3 +++ sevntu-checkstyle-idea-extension/src/Dummy.java | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sevntu-checkstyle-idea-extension/pom.xml b/sevntu-checkstyle-idea-extension/pom.xml index 50d9e5f493..068d50e839 100644 --- a/sevntu-checkstyle-idea-extension/pom.xml +++ b/sevntu-checkstyle-idea-extension/pom.xml @@ -64,6 +64,9 @@ jar + + ${basedir}/src + diff --git a/sevntu-checkstyle-idea-extension/src/Dummy.java b/sevntu-checkstyle-idea-extension/src/Dummy.java index aa5ea84544..4c00aebf4d 100644 --- a/sevntu-checkstyle-idea-extension/src/Dummy.java +++ b/sevntu-checkstyle-idea-extension/src/Dummy.java @@ -1,4 +1,4 @@ /** * Just need smth to make javadoc to pass maven central requirements */ -class Dummy {} \ No newline at end of file +public class Dummy {} From 2cdb259268b4e9e9a75309eb0273a00ae280a108 Mon Sep 17 00:00:00 2001 From: Roman Ivanov Date: Sat, 27 May 2017 22:12:51 -0700 Subject: [PATCH 092/208] Issue #165: fix for travis build to avoid gpg pluging , it should be used only by special profile '-Pgpg' --- sevntu-checks/pom.xml | 38 +++++++++++++--------- sevntu-checkstyle-idea-extension/pom.xml | 41 +++++++++++++++--------- sevntu-checkstyle-maven-plugin/pom.xml | 39 +++++++++++++--------- sevntu-checkstyle-sonar-plugin/pom.xml | 39 +++++++++++++--------- 4 files changed, 96 insertions(+), 61 deletions(-) diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml index c77cbc141f..7cc30a8990 100644 --- a/sevntu-checks/pom.xml +++ b/sevntu-checks/pom.xml @@ -117,21 +117,6 @@ - - org.apache.maven.plugins - maven-gpg-plugin - 1.6 - - - sign-artifacts - verify - - sign - - - - - org.sonatype.plugins nexus-staging-maven-plugin @@ -349,6 +334,29 @@ + + + gpg + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.6 + + + sign-artifacts + verify + + sign + + + + + + + + diff --git a/sevntu-checkstyle-idea-extension/pom.xml b/sevntu-checkstyle-idea-extension/pom.xml index 068d50e839..2056f60d4e 100644 --- a/sevntu-checkstyle-idea-extension/pom.xml +++ b/sevntu-checkstyle-idea-extension/pom.xml @@ -71,21 +71,6 @@ - - org.apache.maven.plugins - maven-gpg-plugin - 1.6 - - - sign-artifacts - verify - - sign - - - - - org.sonatype.plugins nexus-staging-maven-plugin @@ -136,6 +121,7 @@ + local-deploy @@ -146,7 +132,30 @@ - + + + gpg + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.6 + + + sign-artifacts + verify + + sign + + + + + + + + + diff --git a/sevntu-checkstyle-maven-plugin/pom.xml b/sevntu-checkstyle-maven-plugin/pom.xml index 09c69d9aff..3c9ca0f436 100644 --- a/sevntu-checkstyle-maven-plugin/pom.xml +++ b/sevntu-checkstyle-maven-plugin/pom.xml @@ -66,21 +66,6 @@ - - org.apache.maven.plugins - maven-gpg-plugin - 1.6 - - - sign-artifacts - verify - - sign - - - - - org.sonatype.plugins nexus-staging-maven-plugin @@ -101,6 +86,7 @@ + local-deploy @@ -112,5 +98,28 @@ + + + gpg + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.6 + + + sign-artifacts + verify + + sign + + + + + + + + diff --git a/sevntu-checkstyle-sonar-plugin/pom.xml b/sevntu-checkstyle-sonar-plugin/pom.xml index 6cfc25136b..085c05b466 100644 --- a/sevntu-checkstyle-sonar-plugin/pom.xml +++ b/sevntu-checkstyle-sonar-plugin/pom.xml @@ -82,21 +82,6 @@ - - org.apache.maven.plugins - maven-gpg-plugin - 1.6 - - - sign-artifacts - verify - - sign - - - - - org.sonatype.plugins nexus-staging-maven-plugin @@ -323,6 +308,30 @@ + + + + gpg + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.6 + + + sign-artifacts + verify + + sign + + + + + + + + From b9f9e1c9f3535f69f590ba6acdfbfff203cbbb56 Mon Sep 17 00:00:00 2001 From: Roman Ivanov Date: Sat, 27 May 2017 22:30:35 -0700 Subject: [PATCH 093/208] Issue #591: update for checkstyle version in sevntu-checks --- sevntu-checks/pom.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml index 7cc30a8990..5ddd3e5e23 100644 --- a/sevntu-checks/pom.xml +++ b/sevntu-checks/pom.xml @@ -15,9 +15,10 @@ iso-8859-1 + 7.7 - - 7.2 + + 7.6 2.17 RELEASE From ec1bb020829a95bcba48c39836c2b770f1370821 Mon Sep 17 00:00:00 2001 From: Roman Ivanov Date: Sat, 27 May 2017 22:34:13 -0700 Subject: [PATCH 094/208] config: missed update of Issue #448 --- sevntu-checks/sevntu-checks.xml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sevntu-checks/sevntu-checks.xml b/sevntu-checks/sevntu-checks.xml index 031ceed9e7..ae2e1e5ae9 100644 --- a/sevntu-checks/sevntu-checks.xml +++ b/sevntu-checks/sevntu-checks.xml @@ -194,9 +194,7 @@ - - - + From d112c4eceaff2a5b1df581ff30569c61a85681e5 Mon Sep 17 00:00:00 2001 From: Roman Ivanov Date: Sat, 27 May 2017 22:51:43 -0700 Subject: [PATCH 095/208] config: allow '_' in enums (EnumValueName) --- 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 ae2e1e5ae9..69664a4b12 100644 --- a/sevntu-checks/sevntu-checks.xml +++ b/sevntu-checks/sevntu-checks.xml @@ -194,7 +194,7 @@ - + From 6a0267e8481187162a62851101f075d63cc6c7db Mon Sep 17 00:00:00 2001 From: Roman Ivanov Date: Sat, 27 May 2017 23:07:19 -0700 Subject: [PATCH 096/208] Issue #165: update README with links to maven central --- README.textile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.textile b/README.textile index 3e71bec7e3..39d2597bb3 100644 --- a/README.textile +++ b/README.textile @@ -1,4 +1,10 @@ -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 +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 + Additional(non-standard) checks for Checkstyle that are compiled as: - extension to "maven-checkstyle-plugin":http://maven.apache.org/plugins/maven-checkstyle-plugin/ (how to use: "in general":http://maven.apache.org/plugins/maven-checkstyle-plugin/examples/custom-developed-checkstyle.html, "maven, ant, gradle example":https://github.com/sevntu-checkstyle/checkstyle-samples). From 5c3f7a57cbe4d70e040dde385860076a2861fe60 Mon Sep 17 00:00:00 2001 From: Roman Ivanov Date: Sun, 28 May 2017 19:44:39 -0700 Subject: [PATCH 097/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 5ddd3e5e23..8e5043d33e 100644 --- a/sevntu-checks/pom.xml +++ b/sevntu-checks/pom.xml @@ -16,7 +16,7 @@ iso-8859-1 - 7.7 + 7.8 7.6 2.17 From 0af517c6faa555f26b03eb8ccbf209b20b2ca565 Mon Sep 17 00:00:00 2001 From: rnveach Date: Wed, 31 May 2017 16:16:08 -0400 Subject: [PATCH 098/208] config: allowed overriding checkstyle configuration for snapshots --- sevntu-checks/pom.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml index 8e5043d33e..44377f8066 100644 --- a/sevntu-checks/pom.xml +++ b/sevntu-checks/pom.xml @@ -17,6 +17,7 @@ iso-8859-1 7.8 + https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.version}/config/checkstyle_checks.xml 7.6 2.17 @@ -184,7 +185,7 @@ check - https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.version}/config/checkstyle_checks.xml + ${checkstyle.configLocation} true false checkstyle.properties From 6636211c7573a68ce3a718eaed1935e9caa4c2af Mon Sep 17 00:00:00 2001 From: Roman Ivanov Date: Sat, 3 Jun 2017 14:28:04 -0700 Subject: [PATCH 099/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 44377f8066..34f51b965c 100644 --- a/sevntu-checks/pom.xml +++ b/sevntu-checks/pom.xml @@ -16,7 +16,7 @@ iso-8859-1 - 7.8 + 7.8.1 https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.version}/config/checkstyle_checks.xml 7.6 From 81721d9b38b81d3981423ede728b1459b8da7486 Mon Sep 17 00:00:00 2001 From: Roman Ivanov Date: Sun, 18 Jun 2017 09:01:23 -0700 Subject: [PATCH 100/208] config: bump checkstyle to 7.8.2 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 34f51b965c..17d43bfa7c 100644 --- a/sevntu-checks/pom.xml +++ b/sevntu-checks/pom.xml @@ -16,7 +16,7 @@ iso-8859-1 - 7.8.1 + 7.8.2 https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.version}/config/checkstyle_checks.xml 7.6 From 32f5ed6b8b4cf4be89e63ed1b0c553a94b7184f1 Mon Sep 17 00:00:00 2001 From: Roman Ivanov Date: Sat, 1 Jul 2017 20:01:38 -0700 Subject: [PATCH 101/208] config: bump version for checkstyle --- 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 17d43bfa7c..6ddd3db1d9 100644 --- a/sevntu-checks/pom.xml +++ b/sevntu-checks/pom.xml @@ -16,7 +16,7 @@ iso-8859-1 - 7.8.2 + 8.0 https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.version}/config/checkstyle_checks.xml 7.6 From 0dbe92d9d74fe6b85e13de3f05e9821660ed4cb5 Mon Sep 17 00:00:00 2001 From: rnveach Date: Sat, 1 Jul 2017 13:22:24 -0400 Subject: [PATCH 102/208] Issue #595: added get acceptable and required tokens in all checks --- .../annotation/ForbidAnnotationCheck.java | 10 +++ .../ForbidAnnotationElementValueCheck.java | 10 +++ .../RequiredParameterForAnnotationCheck.java | 5 ++ ...onstantAsFirstOperandInConditionCheck.java | 10 +++ ...efaultSerializableInInnerClassesCheck.java | 10 +++ .../AvoidHidingCauseExceptionCheck.java | 10 +++ .../coding/AvoidModifiersForTypesCheck.java | 10 +++ ...tShortCircuitOperatorsForBooleanCheck.java | 10 +++ .../coding/ConfusingConditionCheck.java | 10 +++ .../coding/CustomDeclarationOrderCheck.java | 10 +++ ...ondOperatorForVariableDefinitionCheck.java | 10 +++ .../checks/coding/EitherLogOrThrowCheck.java | 10 +++ .../coding/EmptyPublicCtorInClassCheck.java | 10 +++ .../coding/FinalizeImplementationCheck.java | 10 +++ .../coding/ForbidCCommentsInMethodsCheck.java | 10 +++ .../coding/ForbidCertainImportsCheck.java | 10 +++ .../coding/ForbidInstantiationCheck.java | 10 +++ .../ForbidReturnInFinallyBlockCheck.java | 10 +++ .../ForbidThrowAnonymousExceptionsCheck.java | 10 +++ .../coding/IllegalCatchExtendedCheck.java | 5 ++ .../LogicConditionNeedOptimizationCheck.java | 10 +++ .../MapIterationInForEachLoopCheck.java | 10 +++ .../coding/MoveVariableInsideIfCheck.java | 5 ++ .../MultipleStringLiteralsExtendedCheck.java | 10 +++ ...ipleVariableDeclarationsExtendedCheck.java | 10 +++ ...meConventionForJunit4TestClassesCheck.java | 10 +++ .../NoNullForCollectionReturnCheck.java | 10 +++ .../NumericLiteralNeedsUnderscoreCheck.java | 10 +++ .../OverridableMethodInConstructorCheck.java | 10 +++ .../checks/coding/RedundantReturnCheck.java | 10 +++ .../coding/ReturnBooleanFromTernaryCheck.java | 10 +++ .../coding/ReturnCountExtendedCheck.java | 10 +++ .../ReturnNullInsteadOfBooleanCheck.java | 5 ++ .../SimpleAccessorNameNotationCheck.java | 10 +++ .../coding/SingleBreakOrContinueCheck.java | 10 +++ .../TernaryPerExpressionCountCheck.java | 10 +++ .../UnnecessaryParenthesesExtendedCheck.java | 10 +++ .../coding/UselessSingleCatchCheck.java | 10 +++ .../coding/UselessSuperCtorCallCheck.java | 10 +++ ...WhitespaceBeforeArrayInitializerCheck.java | 10 +++ .../design/AvoidConditionInversionCheck.java | 10 +++ .../CauseParameterInExceptionCheck.java | 10 +++ .../checks/design/ChildBlockLengthCheck.java | 10 +++ .../ForbidWildcardAsReturnTypeCheck.java | 10 +++ .../HideUtilityClassConstructorCheck.java | 10 +++ .../checks/design/InnerClassCheck.java | 10 +++ .../checks/design/NestedSwitchCheck.java | 5 ++ .../NoMainMethodInAbstractClassCheck.java | 10 +++ .../PublicReferenceToPrivateTypeCheck.java | 10 +++ .../checks/naming/EnumValueNameCheck.java | 5 ++ .../InterfaceTypeParameterNameCheck.java | 10 +++ .../checks/sizes/LineLengthExtendedCheck.java | 10 +++ .../checkstyle/internal/AllChecksTest.java | 83 +++++++++++++++++++ 53 files changed, 573 insertions(+) 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 404d6d5cee..e0c4b7b810 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 @@ -87,6 +87,16 @@ public int[] getDefaultTokens() { return new int[] {TokenTypes.ANNOTATION }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void visitToken(DetailAST annotation) { 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 d22a9f42a1..cbbccefa8f 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 @@ -165,6 +165,16 @@ public int[] getDefaultTokens() { }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void visitToken(DetailAST ast) { if (getAnnotationName(ast).equals(annotationName)) { 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 909ef8beba..774b70d7dc 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 @@ -145,6 +145,11 @@ public int[] getRequiredTokens() { }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + @Override public void visitToken(DetailAST annotationNode) { final String annotationNameCheck = getAnnotationName(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 8c56dcafa9..27247c2b5f 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 @@ -95,6 +95,16 @@ public int[] getDefaultTokens() { }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void visitToken(DetailAST detailAST) { if (isRefactoringRequired(detailAST)) { 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 0c5b7b3580..b6ce07e16f 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 @@ -64,6 +64,16 @@ public int[] getDefaultTokens() { return new int[] {TokenTypes.CLASS_DEF }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void visitToken(DetailAST detailAST) { final boolean topLevelClass = detailAST.getParent() == null; 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 a2a5b5c1db..2c5f296bef 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 @@ -78,6 +78,16 @@ public int[] getDefaultTokens() { }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void visitToken(DetailAST detailAST) { 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 cc4fac9361..141b5d8088 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 @@ -384,6 +384,16 @@ public int[] getDefaultTokens() { return new int[] {TokenTypes.VARIABLE_DEF }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void visitToken(DetailAST ast) { final String classNameAndPath = getClassNameAndPath(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 53059cfe53..44cdd2baf3 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 @@ -100,6 +100,16 @@ public final int[] getDefaultTokens() { TokenTypes.BOR_ASSIGN, TokenTypes.BAND_ASSIGN, }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public final void visitToken(final DetailAST detailAST) { 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 bdc8618893..57c7ca8aa7 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 @@ -157,6 +157,16 @@ public int[] getDefaultTokens() { }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void visitToken(DetailAST literalIf) { if (isIfEndsWithElse(literalIf) 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 886a43caad..be6de0c161 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 @@ -333,6 +333,16 @@ else if (currentRule.hasRule(GETTER_SETTER_MACRO)) { return tokenTypes; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void visitToken(DetailAST ast) { switch (ast.getType()) { 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 9499bafc33..585b9363da 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 @@ -52,6 +52,16 @@ public int[] getDefaultTokens() { return new int[] {TokenTypes.VARIABLE_DEF}; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void visitToken(DetailAST variableDefNode) { 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 d741ceb5ff..29fbfa86f6 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 @@ -204,6 +204,16 @@ public int[] getDefaultTokens() { TokenTypes.METHOD_DEF, }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void visitToken(final DetailAST ast) { switch (ast.getType()) { 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 efa2064a9a..a5715f4e25 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 @@ -166,6 +166,16 @@ public int[] getDefaultTokens() { }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void beginTree(DetailAST aRootNode) { singleTypeImports.clear(); 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 afc43f30bb..147a876c39 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 @@ -92,6 +92,16 @@ public int[] getDefaultTokens() { }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void visitToken(DetailAST methodDefToken) { if (isFinalizeMethodSignature(methodDefToken)) { 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 b21b15bb29..0dd833e6b0 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 @@ -50,6 +50,16 @@ public int[] getDefaultTokens() { }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void beginTree(DetailAST rootAST) { clangComments = getFileContents().getCComments().keySet(); 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 e3a5061472..35ffa80da9 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 @@ -139,6 +139,16 @@ public int[] getDefaultTokens() { }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void beginTree(DetailAST rootAST) { packageMatches = false; 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 62f473693d..5491f35e0a 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 @@ -99,6 +99,16 @@ public int[] getDefaultTokens() { return new int[] {TokenTypes.IMPORT, TokenTypes.LITERAL_NEW }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void visitToken(DetailAST ast) { switch (ast.getType()) { 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 619626eeb7..6adaf53011 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 @@ -52,6 +52,16 @@ public final int[] getDefaultTokens() { }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void visitToken(DetailAST finallyNode) { final DetailAST firstSlistNode = finallyNode.findFirstToken(TokenTypes.SLIST); 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 55011c7519..45c5b6f4ef 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 @@ -89,6 +89,16 @@ public int[] getDefaultTokens() { }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void visitToken(DetailAST literalThrowOrVariableDefAst) { switch (literalThrowOrVariableDefAst.getType()) { 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 2ae4a78b81..55613f57d9 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 @@ -83,6 +83,11 @@ public int[] getDefaultTokens() { }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + @Override public int[] getRequiredTokens() { return getDefaultTokens(); 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 33431a0942..4c89006a89 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 @@ -46,6 +46,16 @@ public int[] getDefaultTokens() { return new int[] {TokenTypes.LAND, TokenTypes.LOR }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void visitToken(DetailAST detailAST) { if (needOptimization(detailAST)) { 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 f5b280e704..0da95e5a88 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 @@ -273,6 +273,16 @@ public int[] getDefaultTokens() { return new int[] {TokenTypes.LITERAL_FOR, TokenTypes.IMPORT, TokenTypes.VARIABLE_DEF, }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void beginTree(DetailAST ast) { qualifiedImportList.clear(); 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 127b6239cf..ae45a279eb 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 @@ -125,6 +125,11 @@ public int[] getDefaultTokens() { return new int[] {TokenTypes.VARIABLE_DEF}; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + @Override public int[] getRequiredTokens() { return getDefaultTokens(); 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 da2a16c543..9538ba89f3 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 @@ -136,6 +136,16 @@ public int[] getDefaultTokens() { }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void visitToken(DetailAST ast) { if (!isInIgnoreOccurrenceContext(ast)) { 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 ba1995b267..b11bbce62a 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 @@ -89,6 +89,16 @@ public int[] getDefaultTokens() { }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + /** * Searches for wrong declarations and checks the their type. * 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 ac43bc8b08..ab057dfae5 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 @@ -195,6 +195,16 @@ public int[] getDefaultTokens() { }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void visitToken(DetailAST classDefNode) { if ((isClassDefinitionAnnotated(classDefNode) || isAtleastOneMethodAnnotated(classDefNode)) 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 cb867e2561..d7e7f535e7 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 @@ -128,6 +128,16 @@ public int[] getDefaultTokens() { }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void beginTree(DetailAST rootAST) { methodDefs.clear(); 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 324fbe6a93..f5a5892833 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 @@ -337,6 +337,16 @@ public int[] getDefaultTokens() { }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void visitToken(final DetailAST ast) { if (!passesCheck(ast)) { 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 c40a4bdc24..c4696025e3 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 @@ -252,6 +252,16 @@ public int[] getDefaultTokens() { return new int[] {TokenTypes.CTOR_DEF, TokenTypes.METHOD_DEF}; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void beginTree(DetailAST rootAST) { treeRootAST = rootAST; 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 2db7209b4d..467b754d13 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 @@ -106,6 +106,16 @@ public int[] getDefaultTokens() { }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void visitToken(DetailAST ast) { 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 c7128688bd..a47a32df46 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 @@ -51,6 +51,16 @@ public int[] getDefaultTokens() { }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void visitToken(DetailAST ast) { final DetailAST secondBranch = ast.getLastChild(); 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 db906ff0d5..9036df3fc8 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 @@ -229,6 +229,16 @@ public int[] getDefaultTokens() { }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void visitToken(final DetailAST node) { final DetailAST openingBrace = node 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 213abeadf9..2458256003 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 @@ -55,6 +55,11 @@ public int[] getDefaultTokens() { }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + @Override public int[] getRequiredTokens() { return new int[] { 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 00ffae7386..24966ae362 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 @@ -91,6 +91,16 @@ public int[] getDefaultTokens() { }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void visitToken(DetailAST methodDef) { if (hasBody(methodDef) && !isMethodAtAnonymousClass(methodDef)) { 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 8dbb2624e4..098388c50f 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 @@ -125,6 +125,16 @@ public int[] getDefaultTokens() { TokenTypes.LITERAL_DO, }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void visitToken(DetailAST ast) { if (getNumberOfContinueAndBreaks(ast.getFirstChild()) > 1) { 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 f05bbf9a16..156a279817 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 @@ -108,6 +108,16 @@ public int[] getDefaultTokens() { }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + /** * Sets the maximum number of ternary operators, default value = 1. * 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 72efa5661f..d77bce6d6f 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 @@ -152,6 +152,16 @@ public int[] getDefaultTokens() { }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void visitToken(DetailAST ast) { final int type = ast.getType(); 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 d0e0546acd..6e1c16e95d 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 @@ -52,6 +52,16 @@ public int[] getDefaultTokens() { }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void visitToken(DetailAST tryBlockNode) { final int catchBlocksCount = tryBlockNode.getChildCount(TokenTypes.LITERAL_CATCH); 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 5d2fdd2414..8cf17e4372 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 @@ -188,6 +188,16 @@ public int[] getDefaultTokens() { }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void visitToken(DetailAST aSuperCallNode) { if (getSuperCallArgsCount(aSuperCallNode) == 0) { 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 6f8575a21d..0b1d75ef24 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 @@ -64,6 +64,16 @@ public int[] getDefaultTokens() { return new int[] {TokenTypes.ARRAY_INIT}; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void visitToken(DetailAST ast) { final DetailAST previousAst = getPreviousAst(ast); 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 d1f78ec5d1..a03a0c0575 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 @@ -142,6 +142,16 @@ public int[] getDefaultTokens() { }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void visitToken(DetailAST ast) { 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 956b8210fa..0e7a33c6c7 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 @@ -144,6 +144,16 @@ public int[] getDefaultTokens() { }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void beginTree(DetailAST rootAST) { exceptionClassesToWarn.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 90ea6bea95..4603fdf9d3 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 @@ -131,6 +131,16 @@ public int[] getDefaultTokens() { return blockTypes; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void visitToken(DetailAST ast) { final DetailAST aOpeningBrace = openingBrace(ast); 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 d1c3a3291b..04273ac985 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 @@ -197,6 +197,16 @@ public int[] getDefaultTokens() { }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void visitToken(DetailAST methodDefAst) { final String methodScope = getVisibilityScope(methodDefAst); 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 38658fb169..9d997da0b0 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 @@ -47,6 +47,16 @@ public int[] getDefaultTokens() { }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void visitToken(DetailAST ast) { // abstract class could not have private constructor 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 39a6d57920..3236dfbe52 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 @@ -47,6 +47,16 @@ public int[] getDefaultTokens() { }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void visitToken(DetailAST ast) { // First root class 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 3ee6d90171..5c54ea341c 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 @@ -70,6 +70,11 @@ public int[] getDefaultTokens() { }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + @Override public void visitToken(DetailAST aAST) { nestIn(aAST, MSG_KEY); 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 bb252f4983..e4a9f955e5 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 @@ -54,6 +54,16 @@ public final int[] getDefaultTokens() { }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public final void visitToken(final DetailAST ast) { if (ast.getType() == TokenTypes.CLASS_DEF) { 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 3ecf6ca03d..5e959e6cd8 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 @@ -99,6 +99,16 @@ public int[] getDefaultTokens() { }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void beginTree(DetailAST rootAST) { privateTypes.clear(); 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 8427b177c2..32a9e5bfa8 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 @@ -72,6 +72,11 @@ public int[] getAcceptableTokens() { return new int[] {TokenTypes.ENUM_CONSTANT_DEF}; } + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override 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 eda4162042..92c66d2649 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 @@ -64,6 +64,16 @@ public final int[] getDefaultTokens() { }; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override protected final boolean mustCheckName(DetailAST ast) { final DetailAST location = ast.getParent().getParent(); 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 602627382d..f9a072c118 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 @@ -192,6 +192,16 @@ public int[] getDefaultTokens() { return returnTokens; } + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + @Override public void visitToken(DetailAST ast) { if (ast.getParent() != null 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 d22a0c9e0b..224e3a4dfd 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 @@ -26,6 +26,7 @@ import java.nio.file.Files; import java.nio.file.Paths; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Locale; @@ -39,7 +40,67 @@ import org.junit.Assert; import org.junit.Test; +import com.puppycrawl.tools.checkstyle.api.AbstractCheck; + public class AllChecksTest { + + @Test + public void testDefaultTokensAreSubsetOfAcceptableTokens() throws Exception { + for (Class check : CheckUtil.getCheckstyleChecks()) { + if (AbstractCheck.class.isAssignableFrom(check)) { + final AbstractCheck testedCheck = (AbstractCheck) check.getDeclaredConstructor() + .newInstance(); + final int[] defaultTokens = testedCheck.getDefaultTokens(); + final int[] acceptableTokens = testedCheck.getAcceptableTokens(); + + if (!isSubset(defaultTokens, acceptableTokens)) { + final String errorMessage = String.format(Locale.ROOT, + "%s's default tokens must be a subset" + + " of acceptable tokens.", check.getName()); + Assert.fail(errorMessage); + } + } + } + } + + @Test + public void testRequiredTokensAreSubsetOfAcceptableTokens() throws Exception { + for (Class check : CheckUtil.getCheckstyleChecks()) { + if (AbstractCheck.class.isAssignableFrom(check)) { + final AbstractCheck testedCheck = (AbstractCheck) check.getDeclaredConstructor() + .newInstance(); + final int[] requiredTokens = testedCheck.getRequiredTokens(); + final int[] acceptableTokens = testedCheck.getAcceptableTokens(); + + if (!isSubset(requiredTokens, acceptableTokens)) { + final String errorMessage = String.format(Locale.ROOT, + "%s's required tokens must be a subset" + + " of acceptable tokens.", check.getName()); + Assert.fail(errorMessage); + } + } + } + } + + @Test + public void testRequiredTokensAreSubsetOfDefaultTokens() throws Exception { + for (Class check : CheckUtil.getCheckstyleChecks()) { + if (AbstractCheck.class.isAssignableFrom(check)) { + final AbstractCheck testedCheck = (AbstractCheck) check.getDeclaredConstructor() + .newInstance(); + final int[] defaultTokens = testedCheck.getDefaultTokens(); + final int[] requiredTokens = testedCheck.getRequiredTokens(); + + if (!isSubset(requiredTokens, defaultTokens)) { + final String errorMessage = String.format(Locale.ROOT, + "%s's required tokens must be a subset" + + " of default tokens.", check.getName()); + Assert.fail(errorMessage); + } + } + } + } + @Test public void testAllChecksAreReferencedInConfigFile() throws Exception { final Set checksReferencedInConfig = CheckUtil.getConfigCheckStyleChecks(); @@ -246,4 +307,26 @@ private static Set getFullNames(Set> checks) { private static String getSimplePath(String path) { return path.substring(path.lastIndexOf("com" + File.separator + "github")); } + + /** + * Checks that an array is a subset of other array. + * @param array to check whether it is a subset. + * @param arrayToCheckIn array to check in. + */ + private static boolean isSubset(int[] array, int... arrayToCheckIn) { + boolean result = true; + if (arrayToCheckIn == null) { + result = array == null || array.length == 0; + } + else { + Arrays.sort(arrayToCheckIn); + for (final int element : array) { + if (Arrays.binarySearch(arrayToCheckIn, element) < 0) { + result = false; + break; + } + } + } + return result; + } } From 4c2a1622527f4ae19145418984ba94d835c00393 Mon Sep 17 00:00:00 2001 From: Roman Ivanov Date: Sun, 2 Jul 2017 08:02:07 -0700 Subject: [PATCH 103/208] version bump to 1.24.1 --- 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 675943b17b..2c95476b89 100644 --- a/eclipse-pom.xml +++ b/eclipse-pom.xml @@ -5,7 +5,7 @@ com.github.sevntu-checkstyle parent - 1.24.0 + 1.24.1 pom diff --git a/eclipsecs-sevntu-plugin-feature/feature.xml b/eclipsecs-sevntu-plugin-feature/feature.xml index d60bf9d692..533e9bf86e 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 b59cf7cc94..53c5b55295 100644 --- a/eclipsecs-sevntu-plugin-feature/pom.xml +++ b/eclipsecs-sevntu-plugin-feature/pom.xml @@ -7,7 +7,7 @@ ../eclipse-pom.xml com.github.sevntu-checkstyle parent - 1.24.0 + 1.24.1 com.github.sevntu-checkstyle diff --git a/eclipsecs-sevntu-plugin/META-INF/MANIFEST.MF b/eclipsecs-sevntu-plugin/META-INF/MANIFEST.MF index ef21505b23..3338c36c0a 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.24.0 +Bundle-Version: 1.24.1 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 e389bb48a6..0a675911a1 100644 --- a/eclipsecs-sevntu-plugin/pom.xml +++ b/eclipsecs-sevntu-plugin/pom.xml @@ -9,7 +9,7 @@ ../eclipse-pom.xml com.github.sevntu-checkstyle parent - 1.24.0 + 1.24.1 com.github.sevntu-checkstyle diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml index 6ddd3db1d9..ce622ed46e 100644 --- a/sevntu-checks/pom.xml +++ b/sevntu-checks/pom.xml @@ -11,7 +11,7 @@ com.github.sevntu-checkstyle sevntu-checks - 1.24.0 + 1.24.1 iso-8859-1 diff --git a/sevntu-checkstyle-idea-extension/pom.xml b/sevntu-checkstyle-idea-extension/pom.xml index 2056f60d4e..5d4c13cb73 100644 --- a/sevntu-checkstyle-idea-extension/pom.xml +++ b/sevntu-checkstyle-idea-extension/pom.xml @@ -11,7 +11,7 @@ com.github.sevntu-checkstyle sevntu-checkstyle-idea-extension - 1.24.0 + 1.24.1 jar Sevntu Checkstyle Idea extension diff --git a/sevntu-checkstyle-maven-plugin/pom.xml b/sevntu-checkstyle-maven-plugin/pom.xml index 3c9ca0f436..82adebae61 100644 --- a/sevntu-checkstyle-maven-plugin/pom.xml +++ b/sevntu-checkstyle-maven-plugin/pom.xml @@ -12,7 +12,7 @@ com.github.sevntu-checkstyle sevntu-checkstyle-maven-plugin Sevntu Checkstyle Maven Plugin - 1.24.0 + 1.24.1 @@ -25,7 +25,7 @@ com.github.sevntu-checkstyle sevntu-checks - 1.24.0 + 1.24.1 org.apache.maven.plugins diff --git a/sevntu-checkstyle-sonar-plugin/pom.xml b/sevntu-checkstyle-sonar-plugin/pom.xml index 085c05b466..756f42f355 100644 --- a/sevntu-checkstyle-sonar-plugin/pom.xml +++ b/sevntu-checkstyle-sonar-plugin/pom.xml @@ -11,7 +11,7 @@ com.github.sevntu-checkstyle sevntu-checkstyle-sonar-plugin - 1.24.0 + 1.24.1 sonar-plugin SevNTU Checkstyle Sonar Extension Plugin diff --git a/update-site/pom.xml b/update-site/pom.xml index 9e1562fbcf..13d71724b3 100644 --- a/update-site/pom.xml +++ b/update-site/pom.xml @@ -7,7 +7,7 @@ ../eclipse-pom.xml com.github.sevntu-checkstyle parent - 1.24.0 + 1.24.1 com.github.sevntu.checkstyle.p2updatesite From c58af9f6d850a97b2c0358d3089d81c9bef2f6c4 Mon Sep 17 00:00:00 2001 From: rnveach Date: Wed, 19 Jul 2017 13:34:37 -0400 Subject: [PATCH 104/208] Pull #599: removed excess hierarchy from IllegalCatchExtendedCheck --- .../coding/IllegalCatchExtendedCheck.java | 54 ++++++++++++++----- .../coding/IllegalCatchExtendedCheckTest.java | 15 ++++++ 2 files changed, 55 insertions(+), 14 deletions(-) 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 55613f57d9..7d1e656f71 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 @@ -19,10 +19,14 @@ package com.github.sevntu.checkstyle.checks.coding; +import java.util.Arrays; +import java.util.Set; +import java.util.stream.Collectors; + +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.checks.coding.AbstractIllegalCheck; import com.puppycrawl.tools.checkstyle.utils.CheckUtils; /** @@ -30,12 +34,18 @@ * is almost never acceptable. * @author Simon Harris */ -public final class IllegalCatchExtendedCheck extends AbstractIllegalCheck { +public final class IllegalCatchExtendedCheck extends AbstractCheck { /** * Warning message key. */ public static final String MSG_KEY = "illegal.catch"; + /** Illegal class names. */ + private final Set illegalClassNames = Arrays.stream( + new String[] {"Exception", "Error", "RuntimeException", "Throwable", + "java.lang.Error", "java.lang.Exception", "java.lang.RuntimeException", + "java.lang.Throwable", }).collect(Collectors.toSet()); + /** Disable warnings for "catch" blocks containing * throwing an exception. */ private boolean allowThrow = true; @@ -44,18 +54,24 @@ public final class IllegalCatchExtendedCheck extends AbstractIllegalCheck { * rethrowing an exception. */ private boolean allowRethrow = true; - /** Creates new instance of the check. */ - public IllegalCatchExtendedCheck() { - super(new String[] { - "Exception", - "Error", - "RuntimeException", - "Throwable", - "java.lang.Error", - "java.lang.Exception", - "java.lang.RuntimeException", - "java.lang.Throwable", - }); + /** + * Set the list of illegal classes. + * + * @param classNames + * array of illegal exception classes + */ + public void setIllegalClassNames(final String... classNames) { + illegalClassNames.clear(); + for (final String name : classNames) { + illegalClassNames.add(name); + final int lastDot = name.lastIndexOf('.'); + if (lastDot > 0 + && lastDot < name.length() - 1) { + final String shortName = name + .substring(name.lastIndexOf('.') + 1); + illegalClassNames.add(shortName); + } + } } /** @@ -168,4 +184,14 @@ private static DetailAST[] getChilds(DetailAST node) { return result; } + /** + * Checks if given class is illegal. + * + * @param ident + * ident to check. + * @return true if given ident is illegal. + */ + protected boolean isIllegalClassName(final String ident) { + return illegalClassNames.contains(ident); + } } 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 e423670613..80b57f4161 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 @@ -80,4 +80,19 @@ public final void testReThrowPermit() throws Exception { verify(checkConfig, getPath("InputIllegalCatchExtendedCheckNew.java"), expected); } + @Test + public void testIllegalClassNames() throws Exception { + checkConfig.addAttribute("illegalClassNames", + "java.lang.Error, java.lang.Exception, NullPointerException"); + + // check that incorrect names don't break the Check + checkConfig.addAttribute("illegalClassNames", + "java.lang.IOException."); + + final String[] expected = { + "11:9: " + getCheckMessage(MSG_KEY, "java.lang.Exception"), + }; + + verify(checkConfig, getPath("InputIllegalCatchExtendedCheckNew.java"), expected); + } } From 40f14c3166be2ed38bc42ddb3f5b2d771cbcd74e Mon Sep 17 00:00:00 2001 From: rnveach Date: Wed, 19 Jul 2017 14:03:51 -0400 Subject: [PATCH 105/208] Pull #600: removed excess hierarchy from NestedSwitchCheck --- .../checks/design/NestedSwitchCheck.java | 36 ++++++++++++++----- .../checks/design/NestedSwitchCheckTest.java | 10 ++++++ 2 files changed, 37 insertions(+), 9 deletions(-) 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 5c54ea341c..d25a17419e 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 @@ -19,9 +19,9 @@ package com.github.sevntu.checkstyle.checks.design; +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.coding.AbstractNestedDepthCheck; /** *

    @@ -48,19 +48,24 @@ *

    * @author Damian Szczepanik (damianszczepanik@github) */ -public class NestedSwitchCheck extends AbstractNestedDepthCheck { +public class NestedSwitchCheck extends AbstractCheck { /** * A key is pointing to the warning message text in "messages.properties" * file. */ public static final String MSG_KEY = "avoid.nested.switch"; - /** Default allowed nesting depth. */ - private static final int DEFAULT_MAX = 0; + /** Maximum allowed nesting depth. */ + private int max; + /** Current nesting depth. */ + private int depth; - /** The default constructor. */ - public NestedSwitchCheck() { - super(DEFAULT_MAX); + /** + * Setter for maximum allowed nesting depth. + * @param max maximum allowed nesting depth. + */ + public final void setMax(int max) { + this.max = max; } @Override @@ -75,13 +80,26 @@ public int[] getAcceptableTokens() { return getDefaultTokens(); } + @Override + public final int[] getRequiredTokens() { + return getDefaultTokens(); + } + + @Override + public void beginTree(DetailAST rootAST) { + depth = 0; + } + @Override public void visitToken(DetailAST aAST) { - nestIn(aAST, MSG_KEY); + if (depth > max) { + log(aAST, MSG_KEY, depth, max); + } + ++depth; } @Override public void leaveToken(DetailAST aAST) { - nestOut(); + --depth; } } 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 b96479c778..94554df2ab 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 @@ -25,6 +25,7 @@ import com.github.sevntu.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** * @author Damian Szczepanik (damianszczepanik@github) @@ -49,4 +50,13 @@ public void testSimple() throws Exception { verify(checkConfig, getPath("InputNestedSwitchCheck.java"), expected); } + + @Test + public void testMax() throws Exception { + checkConfig.addAttribute("max", "99"); + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; + + verify(checkConfig, getPath("InputNestedSwitchCheck.java"), + expected); + } } From f686a166ed2c243a3f251bac6aa3021941aa381c Mon Sep 17 00:00:00 2001 From: Roman Ivanov Date: Thu, 20 Jul 2017 05:28:36 -0700 Subject: [PATCH 106/208] version bump to 1.24.2 --- 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 2c95476b89..ebcbfcdd0f 100644 --- a/eclipse-pom.xml +++ b/eclipse-pom.xml @@ -5,7 +5,7 @@ com.github.sevntu-checkstyle parent - 1.24.1 + 1.24.2 pom diff --git a/eclipsecs-sevntu-plugin-feature/feature.xml b/eclipsecs-sevntu-plugin-feature/feature.xml index 533e9bf86e..4287f37f95 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 53c5b55295..a7b798d2da 100644 --- a/eclipsecs-sevntu-plugin-feature/pom.xml +++ b/eclipsecs-sevntu-plugin-feature/pom.xml @@ -7,7 +7,7 @@ ../eclipse-pom.xml com.github.sevntu-checkstyle parent - 1.24.1 + 1.24.2 com.github.sevntu-checkstyle diff --git a/eclipsecs-sevntu-plugin/META-INF/MANIFEST.MF b/eclipsecs-sevntu-plugin/META-INF/MANIFEST.MF index 3338c36c0a..fc8c315933 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.24.1 +Bundle-Version: 1.24.2 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 0a675911a1..4cbcd7cbc7 100644 --- a/eclipsecs-sevntu-plugin/pom.xml +++ b/eclipsecs-sevntu-plugin/pom.xml @@ -9,7 +9,7 @@ ../eclipse-pom.xml com.github.sevntu-checkstyle parent - 1.24.1 + 1.24.2 com.github.sevntu-checkstyle diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml index ce622ed46e..c09b74b990 100644 --- a/sevntu-checks/pom.xml +++ b/sevntu-checks/pom.xml @@ -11,7 +11,7 @@ com.github.sevntu-checkstyle sevntu-checks - 1.24.1 + 1.24.2 iso-8859-1 diff --git a/sevntu-checkstyle-idea-extension/pom.xml b/sevntu-checkstyle-idea-extension/pom.xml index 5d4c13cb73..31d76fb777 100644 --- a/sevntu-checkstyle-idea-extension/pom.xml +++ b/sevntu-checkstyle-idea-extension/pom.xml @@ -11,7 +11,7 @@ com.github.sevntu-checkstyle sevntu-checkstyle-idea-extension - 1.24.1 + 1.24.2 jar Sevntu Checkstyle Idea extension diff --git a/sevntu-checkstyle-maven-plugin/pom.xml b/sevntu-checkstyle-maven-plugin/pom.xml index 82adebae61..ad89acc5a4 100644 --- a/sevntu-checkstyle-maven-plugin/pom.xml +++ b/sevntu-checkstyle-maven-plugin/pom.xml @@ -12,7 +12,7 @@ com.github.sevntu-checkstyle sevntu-checkstyle-maven-plugin Sevntu Checkstyle Maven Plugin - 1.24.1 + 1.24.2 @@ -25,7 +25,7 @@ com.github.sevntu-checkstyle sevntu-checks - 1.24.1 + 1.24.2 org.apache.maven.plugins diff --git a/sevntu-checkstyle-sonar-plugin/pom.xml b/sevntu-checkstyle-sonar-plugin/pom.xml index 756f42f355..d5e4d93978 100644 --- a/sevntu-checkstyle-sonar-plugin/pom.xml +++ b/sevntu-checkstyle-sonar-plugin/pom.xml @@ -11,7 +11,7 @@ com.github.sevntu-checkstyle sevntu-checkstyle-sonar-plugin - 1.24.1 + 1.24.2 sonar-plugin SevNTU Checkstyle Sonar Extension Plugin diff --git a/update-site/pom.xml b/update-site/pom.xml index 13d71724b3..56103d22ef 100644 --- a/update-site/pom.xml +++ b/update-site/pom.xml @@ -7,7 +7,7 @@ ../eclipse-pom.xml com.github.sevntu-checkstyle parent - 1.24.1 + 1.24.2 com.github.sevntu.checkstyle.p2updatesite From 451dd880d1952eeefa952e5b438e6d00393e14d9 Mon Sep 17 00:00:00 2001 From: rnveach Date: Fri, 21 Jul 2017 17:18:23 -0400 Subject: [PATCH 107/208] Pull #601: fixed missing final from bug in FinalLocalVariableCheck --- .../checkstyle/checks/design/StaticMethodCandidateCheck.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 b52b59136f..28240d9af7 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 @@ -387,7 +387,7 @@ public boolean apply(DetailAST ast) { * is still a static method candidate. */ private static boolean isFrameTypesAcceptable(final Frame frame) { - Predicate predicate = new Predicate() { + final Predicate predicate = new Predicate() { @Override public boolean apply(String type) { final Optional typeFrame = findFrameByName(frame, type); From 5c47d5eeb095bfde663156296a861130063a08d8 Mon Sep 17 00:00:00 2001 From: Roman Ivanov Date: Mon, 24 Jul 2017 21:44:03 -0700 Subject: [PATCH 108/208] config: bump checkstyle to 8.1 --- 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 c09b74b990..980685aa1a 100644 --- a/sevntu-checks/pom.xml +++ b/sevntu-checks/pom.xml @@ -16,7 +16,7 @@ iso-8859-1 - 8.0 + 8.1 https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.version}/config/checkstyle_checks.xml 7.6 From 8c700e56073f4d324544bcb56e3576e3457e5477 Mon Sep 17 00:00:00 2001 From: Roman Ivanov Date: Fri, 28 Jul 2017 19:03:26 -0700 Subject: [PATCH 109/208] minor: style update to comply with checkstyle 8.1 --- sevntu-checks/sevntu-checks.xml | 14 +++++++------ .../ForbidAnnotationElementValueCheck.java | 2 +- ...efaultSerializableInInnerClassesCheck.java | 12 +++++------ .../coding/CustomDeclarationOrderCheck.java | 7 +++---- .../checks/coding/EitherLogOrThrowCheck.java | 1 + .../coding/FinalizeImplementationCheck.java | 1 + .../OverridableMethodInConstructorCheck.java | 1 + .../coding/UselessSingleCatchCheck.java | 4 ++-- .../coding/UselessSuperCtorCallCheck.java | 2 +- .../design/AvoidConditionInversionCheck.java | 20 +++++++++---------- .../HideUtilityClassConstructorCheck.java | 2 ++ 11 files changed, 35 insertions(+), 31 deletions(-) diff --git a/sevntu-checks/sevntu-checks.xml b/sevntu-checks/sevntu-checks.xml index 69664a4b12..8eee769330 100644 --- a/sevntu-checks/sevntu-checks.xml +++ b/sevntu-checks/sevntu-checks.xml @@ -4,19 +4,21 @@ - - - - - - + + + + + + + + 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 cbbccefa8f..75e0ed78d5 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 @@ -332,7 +332,7 @@ private static String getExpressionText(DetailAST expression) { } /** - * Gets String-represented array from provided left brace + * Gets String-represented array from provided left brace. * * @param brace * DetailAST node of type {@link TokenTypes#ANNOTATION_ARRAY_INIT} 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 b6ce07e16f..56bbcdf1b6 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 @@ -107,10 +107,9 @@ private static boolean isStatic(DetailAST classNode) { } /** - *

    - * 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: *

    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 c4696025e3..966add5012 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 @@ -29,6 +29,7 @@ import com.puppycrawl.tools.checkstyle.api.TokenTypes; /** + * Detects overridable methods in constructors. *

    * This check prevents any calls to overridable methods that are take place in: *

    1. 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 1081b30154f1ddd4046612517060d53f80ae685e 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 2d5a9ac39b808da2779bdb036fbd51202d76fd78 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 dfc3721ea55a738535b2680aa739ab34f978e99d 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.2 https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.version}/config/checkstyle_checks.xml 7.6 From df21ea6702c9d2d2378dcaa6454834abcdea994a 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 c0143b99bca47d7994be14a93790e4de84274667 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 e5f136ea0eea9705be6af4f4c00ca5c59fb1746e 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 1d9a082d015368c5f5cab667b441e67a291fa8ac 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 f0a142985255e224d4f5d0390b7ea38afb2be0bd 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 e1c4e197e9e2c88d6d8ea4ec5e5e4dcd73671218 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 d700a26fd9c1bbcea389a1fe2c60749dd60035d8 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 13ae7922977c73e8a8eb9955e81de53ecf39f1b8 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.3 https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.version}/config/checkstyle_checks.xml 7.6 From 938df125c8dd56fe558159497a5cdbc6d2a89727 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 91af400d01493c8777657d5016c5178b60998244 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 d11e5eb69216158c9c1677e7a181e74c579123aa 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 f39b37dc028398723db5e956d49ec6edb8dfc8ad 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.4 https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.version}/config/checkstyle_checks.xml 7.6 From 1acee8b9518670bfc286e81cb35fdee712bdb36e 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 9283d444577367c3e10f3cfe49c1299bfe9b53d3 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 75de41c16f174511f46942b9a09760b70c78a602 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 dfac4ec002fabc8b7127a59f56fd45907f603185 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: + *

      + *
      + * <module name="RequireFailForTryCatchInJunitCheck"/>
      + * 
      + *

      + * 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 test = ast -> { + try { + } + catch (Exception e) { + // fail can't be required because lambdas can't throw checked + // exceptions, so they must be caught and if warranted, + // re-thrown as an unchecked exception + } + }; + } + + @org.junit.Test + public void method2() throws Exception { + try { + Assert.fail(); + } + catch (Exception e) { + } + try { + fail(); + } + catch (Exception e) { + } + + final Consumer test = ast -> { + try { + } + catch (Exception e) { + // fail can't be required because lambdas can't throw checked + // exceptions, so they must be caught and if warranted, + // re-thrown as an unchecked exception + } + }; + } +} 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 eaae026067..8b13317639 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 @@ 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 + + + com.github.sevntu.checkstyle.checks.coding.RequireFailForTryCatchInJunitCheck + Require fail for try/catch in junit check + + Checks if a try/catch block has a junit fail assertion inside the try for a junit method. + Checker/TreeWalker/com.github.sevntu.checkstyle.checks.coding.RequireFailForTryCatchInJunitCheck + From b653508ae58a539659f54a531750dfee60f80e1c Mon Sep 17 00:00:00 2001 From: rnveach Date: Thu, 26 Oct 2017 18:54:18 -0400 Subject: [PATCH 129/208] Issue #618: fixed all violations from RequireFailForTryCatchInJunitCheck --- .../com/github/sevntu/checkstyle/BaseCheckTestSupport.java | 5 ++--- .../test/java/com/github/sevntu/checkstyle/UtilsTest.java | 2 ++ .../checks/coding/AvoidModifiersForTypesCheckTest.java | 1 + .../checks/coding/EmptyPublicCtorInClassCheckTest.java | 1 + .../checks/coding/ForbidCertainImportsCheckTest.java | 1 + .../checks/coding/ForbidInstantiationCheckTest.java | 1 + .../coding/NumericLiteralNeedsUnderscoreCheckTest.java | 5 +++++ .../checkstyle/checks/coding/RedundantReturnCheckTest.java | 1 + .../coding/RequireFailForTryCatchInJunitCheckTest.java | 1 + .../checks/coding/ReturnNullInsteadOfBooleanCheckTest.java | 1 + .../checks/design/AvoidConditionInversionCheckTest.java | 1 + .../checks/design/CauseParameterInExceptionCheckTest.java | 1 + .../checks/design/ConstructorWithoutParamsCheckTest.java | 1 + .../checks/design/PublicReferenceToPrivateTypeCheckTest.java | 1 + .../checks/design/StaticMethodCandidateCheckTest.java | 1 + .../checks/naming/UniformEnumConstantNameCheckTest.java | 2 ++ .../checkstyle/checks/sizes/LineLengthExtendedCheckTest.java | 2 ++ 17 files changed, 25 insertions(+), 3 deletions(-) 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 7fcb7ff230..977c41ae88 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 @@ -20,6 +20,7 @@ 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; @@ -34,8 +35,6 @@ import java.util.Locale; import java.util.Properties; -import org.junit.Assert; - import com.google.common.collect.Lists; import com.puppycrawl.tools.checkstyle.AuditEventUtFormatter; import com.puppycrawl.tools.checkstyle.Checker; @@ -45,7 +44,7 @@ import com.puppycrawl.tools.checkstyle.api.AuditEvent; import com.puppycrawl.tools.checkstyle.api.Configuration; -public abstract class BaseCheckTestSupport extends Assert { +public abstract class BaseCheckTestSupport { private final ByteArrayOutputStream baos = new ByteArrayOutputStream(); private final PrintStream printStream = new PrintStream(baos); 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 35bf245219..4f4dda14f0 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 @@ -20,6 +20,7 @@ package com.github.sevntu.checkstyle; import static com.puppycrawl.tools.checkstyle.internal.TestUtils.assertUtilsClassHasPrivateConstructor; +import static org.junit.Assert.fail; import org.junit.Assert; import org.junit.Test; @@ -36,6 +37,7 @@ public void testIsProperUtilsClass() throws ReflectiveOperationException { public void testReportInvalidToken() { try { Utils.reportInvalidToken(TokenTypes.CLASS_DEF); + fail(); } catch (IllegalArgumentException ex) { Assert.assertEquals("Found unsupported token: CLASS_DEF", ex.getMessage()); 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 d2307b3885..d3b28b0e44 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 @@ -20,6 +20,7 @@ package com.github.sevntu.checkstyle.checks.coding; import static com.github.sevntu.checkstyle.checks.coding.AvoidModifiersForTypesCheck.MSG_KEY; +import static org.junit.Assert.fail; import org.junit.Assert; import org.junit.Test; 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 630f1215bd..60e1bf741f 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 @@ -20,6 +20,7 @@ package com.github.sevntu.checkstyle.checks.coding; import static com.github.sevntu.checkstyle.checks.coding.EmptyPublicCtorInClassCheck.MSG_KEY; +import static org.junit.Assert.fail; import org.junit.Assert; import org.junit.Test; 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 096fe0f2d5..ad9e420b5c 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 @@ -20,6 +20,7 @@ package com.github.sevntu.checkstyle.checks.coding; import static com.github.sevntu.checkstyle.checks.coding.ForbidCertainImportsCheck.MSG_KEY; +import static org.junit.Assert.fail; import org.junit.Assert; import org.junit.Test; 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 9329561692..aab11c85f5 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 @@ -20,6 +20,7 @@ package com.github.sevntu.checkstyle.checks.coding; import static com.github.sevntu.checkstyle.checks.coding.ForbidInstantiationCheck.MSG_KEY; +import static org.junit.Assert.fail; import org.junit.Assert; import org.junit.Test; 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 1e5caefa35..b5e308265c 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 @@ -20,6 +20,7 @@ package com.github.sevntu.checkstyle.checks.coding; import static com.github.sevntu.checkstyle.checks.coding.NumericLiteralNeedsUnderscoreCheck.MSG_KEY; +import static org.junit.Assert.fail; import java.io.File; @@ -185,6 +186,7 @@ public void testMinSymbolsBeforeCheckingSwitchReflection() throws Exception { new NumericLiteralNeedsUnderscoreCheck(); final NumericType mockType = PowerMockito.mock(NumericType.class); WhiteboxImpl.invokeMethod(check, "minSymbolsBeforeChecking", mockType); + fail(); } catch (IllegalStateException ex) { Assert.assertTrue(ex.getMessage().startsWith(EXCEPTION_MESSAGE)); @@ -198,6 +200,7 @@ public void testMaxSymbolsUntilUnderscoreSwitchReflection() throws Exception { new NumericLiteralNeedsUnderscoreCheck(); final NumericType mockType = PowerMockito.mock(NumericType.class); WhiteboxImpl.invokeMethod(check, "maxSymbolsUntilUnderscore", mockType); + fail(); } catch (IllegalStateException ex) { Assert.assertTrue(ex.getMessage().startsWith(EXCEPTION_MESSAGE)); @@ -211,6 +214,7 @@ public void testGetNumericSegmentsSwitchReflection() throws Exception { new NumericLiteralNeedsUnderscoreCheck(); final NumericType mockType = PowerMockito.mock(NumericType.class); WhiteboxImpl.invokeMethod(check, "getNumericSegments", "", mockType); + fail(); } catch (IllegalStateException ex) { Assert.assertTrue(ex.getMessage().startsWith(EXCEPTION_MESSAGE)); @@ -224,6 +228,7 @@ public void testRemovePrePostfixByTypeSwitchReflection() throws Exception { new NumericLiteralNeedsUnderscoreCheck(); final NumericType mockType = PowerMockito.mock(NumericType.class); WhiteboxImpl.invokeMethod(check, "removePrePostfixByType", "", mockType); + fail(); } catch (IllegalStateException ex) { Assert.assertTrue(ex.getMessage().startsWith(EXCEPTION_MESSAGE)); 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 f3089e34ff..4689cd800c 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 @@ -20,6 +20,7 @@ package com.github.sevntu.checkstyle.checks.coding; import static com.github.sevntu.checkstyle.checks.coding.RedundantReturnCheck.MSG_KEY; +import static org.junit.Assert.fail; import org.junit.Assert; import org.junit.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 6741d55aad..8e8916569f 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 @@ -20,6 +20,7 @@ package com.github.sevntu.checkstyle.checks.coding; import static com.github.sevntu.checkstyle.checks.coding.RequireFailForTryCatchInJunitCheck.MSG_KEY; +import static org.junit.Assert.fail; import org.junit.Assert; import org.junit.Test; 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 9787d776d9..9bb3c490b7 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 @@ -20,6 +20,7 @@ package com.github.sevntu.checkstyle.checks.coding; import static com.github.sevntu.checkstyle.checks.coding.ReturnNullInsteadOfBooleanCheck.MSG_KEY; +import static org.junit.Assert.fail; import org.junit.Assert; import org.junit.Test; 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 ca025acdcf..39f44a819b 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 @@ -20,6 +20,7 @@ package com.github.sevntu.checkstyle.checks.design; import static com.github.sevntu.checkstyle.checks.design.AvoidConditionInversionCheck.MSG_KEY; +import static org.junit.Assert.fail; import org.junit.Assert; import org.junit.Test; 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 415a825888..8bd8881674 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 @@ -20,6 +20,7 @@ package com.github.sevntu.checkstyle.checks.design; import static com.github.sevntu.checkstyle.checks.design.CauseParameterInExceptionCheck.MSG_KEY; +import static org.junit.Assert.fail; import org.junit.Assert; import org.junit.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 8cbd438682..6534a89cce 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 @@ -20,6 +20,7 @@ package com.github.sevntu.checkstyle.checks.design; import static com.github.sevntu.checkstyle.checks.design.ConstructorWithoutParamsCheck.MSG_KEY; +import static org.junit.Assert.assertArrayEquals; import org.junit.Before; import org.junit.Test; 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 539d45d37c..61aa059fa5 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 @@ -20,6 +20,7 @@ package com.github.sevntu.checkstyle.checks.design; import static com.github.sevntu.checkstyle.checks.design.PublicReferenceToPrivateTypeCheck.MSG_KEY; +import static org.junit.Assert.fail; import org.junit.Assert; import org.junit.Test; 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 2e0f0b919c..09e66debd5 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 @@ -20,6 +20,7 @@ package com.github.sevntu.checkstyle.checks.design; import static com.github.sevntu.checkstyle.checks.design.StaticMethodCandidateCheck.MSG_KEY; +import static org.junit.Assert.assertArrayEquals; import java.io.File; 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 c12c317997..46e46364e4 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 @@ -19,6 +19,8 @@ package com.github.sevntu.checkstyle.checks.naming; +import static org.junit.Assert.fail; + import java.util.Arrays; import org.junit.Assert; 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 7c3d271990..fb8742302e 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 @@ -20,6 +20,7 @@ package com.github.sevntu.checkstyle.checks.sizes; import static com.github.sevntu.checkstyle.checks.sizes.LineLengthExtendedCheck.MSG_KEY; +import static org.junit.Assert.fail; import org.junit.Assert; import org.junit.Test; @@ -86,6 +87,7 @@ public void testProperty() throws Exception { try { verify(checkConfig, getPath("InputLineLengthExtendedCheck.java"), expected); + fail(); } catch (CheckstyleException ex) { Assert.assertTrue(ex.getMessage().startsWith("cannot initialize module " From f5a128c434cda350bb32e56e59c79cd3cbc510eb Mon Sep 17 00:00:00 2001 From: Roman Ivanov Date: Thu, 9 Nov 2017 13:27:21 -0800 Subject: [PATCH 130/208] minor: move import-control-test to repo as packagename is different with main project --- sevntu-checks/checkstyle.properties | 2 +- sevntu-checks/import-control-test.xml | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 sevntu-checks/import-control-test.xml diff --git a/sevntu-checks/checkstyle.properties b/sevntu-checks/checkstyle.properties index 9ca9648368..53c8f47cd9 100644 --- a/sevntu-checks/checkstyle.properties +++ b/sevntu-checks/checkstyle.properties @@ -2,4 +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 +checkstyle.importcontroltest.file=import-control-test.xml diff --git a/sevntu-checks/import-control-test.xml b/sevntu-checks/import-control-test.xml new file mode 100644 index 0000000000..198bbedf39 --- /dev/null +++ b/sevntu-checks/import-control-test.xml @@ -0,0 +1,12 @@ + + + + + + + + + + From 1e5c804238ed961dbf952a1684e792eba7c7053e Mon Sep 17 00:00:00 2001 From: rnveach Date: Thu, 16 Nov 2017 20:59:17 -0500 Subject: [PATCH 131/208] Issue #610: standardized UTs from CheckstyleTestMakeup violations --- .../checkstyle/BaseCheckTestSupport.java | 4 +- .../annotation/ForbidAnnotationCheckTest.java | 18 +- ...ForbidAnnotationElementValueCheckTest.java | 24 +- ...quiredParameterForAnnotationCheckTest.java | 10 +- ...antAsFirstOperandInConditionCheckTest.java | 6 +- ...ltSerializableInInnerClassesCheckTest.java | 8 +- .../AvoidHidingCauseExceptionCheckTest.java | 6 +- .../AvoidModifiersForTypesCheckTest.java | 314 +++++++----------- ...rtCircuitOperatorsForBooleanCheckTest.java | 7 +- .../coding/ConfusingConditionCheckTest.java | 8 +- .../CustomDeclarationOrderCheckTest.java | 10 +- ...peratorForVariableDefinitionCheckTest.java | 5 +- .../coding/EitherLogOrThrowCheckTest.java | 3 +- .../EmptyPublicCtorInClassCheckTest.java | 24 +- .../FinalizeImplementationCheckTest.java | 11 +- .../ForbidCCommentsInMethodsCheckTest.java | 6 +- .../coding/ForbidCertainImportsCheckTest.java | 54 +-- .../coding/ForbidInstantiationCheckTest.java | 20 +- .../ForbidReturnInFinallyBlockCheckTest.java | 2 +- ...rbidThrowAnonymousExceptionsCheckTest.java | 20 +- .../coding/IllegalCatchExtendedCheckTest.java | 12 +- ...gicConditionNeedOptimizationCheckTest.java | 2 +- .../MapIterationInForEachLoopCheckTest.java | 22 +- .../coding/MoveVariableInsideIfCheckTest.java | 9 +- ...ltipleStringLiteralsExtendedCheckTest.java | 14 +- ...VariableDeclarationsExtendedCheckTest.java | 8 +- ...nventionForJunit4TestClassesCheckTest.java | 97 ++++-- .../NoNullForCollectionReturnCheckTest.java | 27 +- ...umericLiteralNeedsUnderscoreCheckTest.java | 8 +- ...erridableMethodInConstructorCheckTest.java | 59 +++- .../coding/RedundantReturnCheckTest.java | 10 +- ...equireFailForTryCatchInJunitCheckTest.java | 10 +- .../ReturnBooleanFromTernaryCheckTest.java | 2 +- .../coding/ReturnCountExtendedCheckTest.java | 35 +- .../ReturnNullInsteadOfBooleanCheckTest.java | 2 +- .../SimpleAccessorNameNotationCheckTest.java | 24 +- .../SingleBreakOrContinueCheckTest.java | 2 +- .../TernaryPerExpressionCountCheckTest.java | 220 ++++++------ ...necessaryParenthesesExtendedCheckTest.java | 6 +- .../coding/UselessSingleCatchCheckTest.java | 7 +- .../coding/UselessSuperCtorCallCheckTest.java | 19 +- ...espaceBeforeArrayInitializerCheckTest.java | 5 +- .../AvoidConditionInversionCheckTest.java | 12 +- .../CauseParameterInExceptionCheckTest.java | 19 +- .../design/ChildBlockLengthCheckTest.java | 10 +- .../ConstructorWithoutParamsCheckTest.java | 12 +- .../ForbidWildcardAsReturnTypeCheckTest.java | 30 +- .../HideUtilityClassConstructorCheckTest.java | 14 +- .../checks/design/InnerClassCheckTest.java | 2 +- .../checks/design/NestedSwitchCheckTest.java | 4 +- .../NoMainMethodInAbstractClassCheckTest.java | 2 +- ...PublicReferenceToPrivateTypeCheckTest.java | 38 +-- .../StaticMethodCandidateCheckTest.java | 8 +- .../checks/naming/EnumValueNameCheckTest.java | 21 +- .../InterfaceTypeParameterNameCheckTest.java | 4 +- .../UniformEnumConstantNameCheckTest.java | 22 +- .../sizes/LineLengthExtendedCheckTest.java | 6 +- .../InputAvoidModifiersForTypesCheck2.java | 6 +- 58 files changed, 717 insertions(+), 653 deletions(-) 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 977c41ae88..aeae518cf2 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 @@ -48,7 +48,7 @@ public abstract class BaseCheckTestSupport { private final ByteArrayOutputStream baos = new ByteArrayOutputStream(); private final PrintStream printStream = new PrintStream(baos); - public static DefaultConfiguration createCheckConfig(Class clazz) { + public static DefaultConfiguration createModuleConfig(Class clazz) { return new DefaultConfiguration(clazz.getName()); } @@ -111,7 +111,7 @@ protected Checker createChecker(Configuration checkConfig) throws Exception { protected DefaultConfiguration createCheckerConfig(Configuration config) { final DefaultConfiguration result = new DefaultConfiguration("configuration"); - final DefaultConfiguration treeWalkerConfig = createCheckConfig(TreeWalker.class); + 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); 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 233f9908b1..f777449589 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 @@ -36,7 +36,7 @@ public class ForbidAnnotationCheckTest extends BaseCheckTestSupport { @Test public void testDefaultCheck() throws Exception { - final DefaultConfiguration checkConfig = createCheckConfig(ForbidAnnotationCheck.class); + final DefaultConfiguration checkConfig = createModuleConfig(ForbidAnnotationCheck.class); final String[] expected1 = {}; @@ -45,7 +45,7 @@ public void testDefaultCheck() throws Exception { @Test public void testNullProperties() throws Exception { - final DefaultConfiguration checkConfig = createCheckConfig(ForbidAnnotationCheck.class); + final DefaultConfiguration checkConfig = createModuleConfig(ForbidAnnotationCheck.class); checkConfig.addAttribute("annotationNames", null); checkConfig.addAttribute("annotationTargets", null); @@ -57,7 +57,7 @@ public void testNullProperties() throws Exception { @Test public void testFullAnnotationName() throws Exception { - final DefaultConfiguration checkConfig = createCheckConfig(ForbidAnnotationCheck.class); + final DefaultConfiguration checkConfig = createModuleConfig(ForbidAnnotationCheck.class); checkConfig.addAttribute("annotationNames", "Test"); @@ -68,7 +68,7 @@ public void testFullAnnotationName() throws Exception { @Test public void testVariableIsForbidden() throws Exception { - final DefaultConfiguration checkConfig = createCheckConfig(ForbidAnnotationCheck.class); + final DefaultConfiguration checkConfig = createModuleConfig(ForbidAnnotationCheck.class); checkConfig.addAttribute("annotationNames", "Edible,Author,Author2,SuppressWarnings"); @@ -86,7 +86,7 @@ public void testVariableIsForbidden() throws Exception { @Test public void testMethodIsForbidden() throws Exception { - final DefaultConfiguration checkConfig = createCheckConfig(ForbidAnnotationCheck.class); + final DefaultConfiguration checkConfig = createModuleConfig(ForbidAnnotationCheck.class); checkConfig.addAttribute("annotationNames", "Twizzle,One,Two,Three,B"); checkConfig.addAttribute("annotationTargets", "METHOD_DEF"); @@ -104,7 +104,7 @@ public void testMethodIsForbidden() throws Exception { @Test public void testClassAndConstuctorIsForbidden() throws Exception { - final DefaultConfiguration checkConfig = createCheckConfig(ForbidAnnotationCheck.class); + final DefaultConfiguration checkConfig = createModuleConfig(ForbidAnnotationCheck.class); checkConfig.addAttribute("annotationNames", "Test,ctor,ctor2"); checkConfig.addAttribute("annotationTargets", "CLASS_DEF,CTOR_DEF"); @@ -120,7 +120,7 @@ public void testClassAndConstuctorIsForbidden() throws Exception { @Test public void testAnnotationIsForbidden() throws Exception { - final DefaultConfiguration checkConfig = createCheckConfig(ForbidAnnotationCheck.class); + final DefaultConfiguration checkConfig = createModuleConfig(ForbidAnnotationCheck.class); checkConfig.addAttribute("annotationNames", "Retention,Target"); checkConfig.addAttribute("annotationTargets", "ANNOTATION_DEF"); @@ -135,7 +135,7 @@ public void testAnnotationIsForbidden() throws Exception { @Test public void testParameterAndInterfaceIsForbidden() throws Exception { - final DefaultConfiguration checkConfig = createCheckConfig(ForbidAnnotationCheck.class); + final DefaultConfiguration checkConfig = createModuleConfig(ForbidAnnotationCheck.class); checkConfig.addAttribute("annotationNames", "MyAnnotation,A"); checkConfig.addAttribute("annotationTargets", @@ -151,7 +151,7 @@ public void testParameterAndInterfaceIsForbidden() throws Exception { @Test public void testEnumIsForbidden() throws Exception { - final DefaultConfiguration checkConfig = createCheckConfig(ForbidAnnotationCheck.class); + final DefaultConfiguration checkConfig = createModuleConfig(ForbidAnnotationCheck.class); checkConfig.addAttribute("annotationNames", "C,int1,int2,int3"); checkConfig.addAttribute("annotationTargets", 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 b6eca0cedb..b46813dc90 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 @@ -30,7 +30,7 @@ public class ForbidAnnotationElementValueCheckTest extends BaseCheckTestSupport @Test public void testAnnotationWithStringParameter() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(ForbidAnnotationElementValueCheck.class); + createModuleConfig(ForbidAnnotationElementValueCheck.class); checkConfig.addAttribute("annotationName", "Anno1"); checkConfig.addAttribute("elementName", "str"); checkConfig.addAttribute("forbiddenElementValueRegexp", "someString\\d+"); @@ -45,7 +45,7 @@ public void testAnnotationWithStringParameter() throws Exception { @Test public void testAnnotationWithIntegerParameter() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(ForbidAnnotationElementValueCheck.class); + createModuleConfig(ForbidAnnotationElementValueCheck.class); checkConfig.addAttribute("annotationName", "Anno2"); checkConfig.addAttribute("elementName", "intVal"); @@ -61,7 +61,7 @@ public void testAnnotationWithIntegerParameter() throws Exception { @Test public void testAnnotationWithFloatParameter() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(ForbidAnnotationElementValueCheck.class); + createModuleConfig(ForbidAnnotationElementValueCheck.class); checkConfig.addAttribute("annotationName", "Anno3"); checkConfig.addAttribute("elementName", "floatVal"); @@ -77,7 +77,7 @@ public void testAnnotationWithFloatParameter() throws Exception { @Test public void testAnnotationWithBooleanParameter() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(ForbidAnnotationElementValueCheck.class); + createModuleConfig(ForbidAnnotationElementValueCheck.class); checkConfig.addAttribute("annotationName", "Anno4"); checkConfig.addAttribute("elementName", "boolVal"); @@ -93,7 +93,7 @@ public void testAnnotationWithBooleanParameter() throws Exception { @Test public void testAnnotationWithDotSplittedParameter() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(ForbidAnnotationElementValueCheck.class); + createModuleConfig(ForbidAnnotationElementValueCheck.class); checkConfig.addAttribute("annotationName", "Bean"); checkConfig.addAttribute("elementName", "name"); @@ -109,7 +109,7 @@ public void testAnnotationWithDotSplittedParameter() throws Exception { @Test public void testAnnotationWithSeveralParameters() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(ForbidAnnotationElementValueCheck.class); + createModuleConfig(ForbidAnnotationElementValueCheck.class); checkConfig.addAttribute("annotationName", "Anno5"); checkConfig.addAttribute("elementName", "stringValue"); @@ -125,7 +125,7 @@ public void testAnnotationWithSeveralParameters() throws Exception { @Test public void testAnnotationWithSingleParameter() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(ForbidAnnotationElementValueCheck.class); + createModuleConfig(ForbidAnnotationElementValueCheck.class); checkConfig.addAttribute("annotationName", "SuppressWarnings"); checkConfig.addAttribute("elementName", "value"); @@ -141,7 +141,7 @@ public void testAnnotationWithSingleParameter() throws Exception { @Test public void testAnnotationWtithBooleanParameterValueDoesntMatch() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(ForbidAnnotationElementValueCheck.class); + createModuleConfig(ForbidAnnotationElementValueCheck.class); checkConfig.addAttribute("annotationName", "Anno4"); checkConfig.addAttribute("elementName", "boolVal"); @@ -155,7 +155,7 @@ public void testAnnotationWtithBooleanParameterValueDoesntMatch() throws Excepti @Test public void testAnnotationWithListAsParameterValue() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(ForbidAnnotationElementValueCheck.class); + createModuleConfig(ForbidAnnotationElementValueCheck.class); checkConfig.addAttribute("annotationName", "SuppressWarnings"); checkConfig.addAttribute("elementName", "value"); @@ -172,7 +172,7 @@ public void testAnnotationWithListAsParameterValue() throws Exception { @Test public void testAnnotationWithAnnotationAsParameter() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(ForbidAnnotationElementValueCheck.class); + createModuleConfig(ForbidAnnotationElementValueCheck.class); checkConfig.addAttribute("annotationName", "Name"); checkConfig.addAttribute("elementName", "last"); @@ -188,7 +188,7 @@ public void testAnnotationWithAnnotationAsParameter() throws Exception { @Test public void testAnnotationWithDefaultValues() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(ForbidAnnotationElementValueCheck.class); + createModuleConfig(ForbidAnnotationElementValueCheck.class); final String[] expected = { "114:11: " + getCheckMessage(MSG_KEY, "expected", "Test"), @@ -200,7 +200,7 @@ public void testAnnotationWithDefaultValues() throws Exception { @Test public void testFullAnnotationClasspath() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(ForbidAnnotationElementValueCheck.class); + createModuleConfig(ForbidAnnotationElementValueCheck.class); checkConfig.addAttribute("annotationName", "SuppressWarnings"); checkConfig.addAttribute("elementName", "value"); 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 000675559e..02c2b70d3d 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 @@ -33,7 +33,7 @@ public class RequiredParameterForAnnotationCheckTest extends BaseCheckTestSuppor public void testValidateRequiredParameter() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(RequiredParameterForAnnotationCheck.class); + createModuleConfig(RequiredParameterForAnnotationCheck.class); checkConfig.addAttribute("annotationName", "testAnnotation1"); checkConfig.addAttribute("requiredParameters", "firstParameter"); @@ -53,7 +53,7 @@ public void testValidateRequiredParameter() public void testMultipleProperties1() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(RequiredParameterForAnnotationCheck.class); + createModuleConfig(RequiredParameterForAnnotationCheck.class); checkConfig.addAttribute("annotationName", "testAnnotation1"); checkConfig.addAttribute("requiredParameters", @@ -93,7 +93,7 @@ public void testMultipleProperties1() public void testMultipleProperties2() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(RequiredParameterForAnnotationCheck.class); + createModuleConfig(RequiredParameterForAnnotationCheck.class); checkConfig.addAttribute("annotationName", "testAnnotation1"); checkConfig.addAttribute("requiredParameters", "firstParameter,secondParameter"); @@ -122,7 +122,7 @@ public void testMultipleProperties2() public void testForAnnotationWithCanonicalName() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(RequiredParameterForAnnotationCheck.class); + createModuleConfig(RequiredParameterForAnnotationCheck.class); checkConfig.addAttribute("annotationName", "com.github.sevntu.checkstyle.checks" + ".annotation.InputRequiredParameterForAnnotationCheck.testAnnotation2"); @@ -152,7 +152,7 @@ public void testForAnnotationWithCanonicalName() public void testMultipleParametersForAnnotationWithCanonicalName() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(RequiredParameterForAnnotationCheck.class); + createModuleConfig(RequiredParameterForAnnotationCheck.class); checkConfig.addAttribute("annotationName", "com.github.sevntu.checkstyle.checks" + ".annotation.InputRequiredParameterForAnnotationCheck.testAnnotation2"); 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 8712370464..0b0decb64a 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 @@ -31,7 +31,7 @@ public class AvoidConstantAsFirstOperandInConditionCheckTest extends BaseCheckTe @Test public void testAll() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(AvoidConstantAsFirstOperandInConditionCheck.class); + createModuleConfig(AvoidConstantAsFirstOperandInConditionCheck.class); final String[] expected = { "24: " + getCheckMessage(MSG_KEY, "=="), "25: " + getCheckMessage(MSG_KEY, "=="), @@ -69,7 +69,7 @@ public void testAll() throws Exception { @Test public void testAttributes() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(AvoidConstantAsFirstOperandInConditionCheck.class); + createModuleConfig(AvoidConstantAsFirstOperandInConditionCheck.class); checkConfig.addAttribute("targetConstantTypes", "LITERAL_FALSE,NUM_INT,NUM_FLOAT"); final String[] expected = { "25: " + getCheckMessage(MSG_KEY, "=="), @@ -84,7 +84,7 @@ public void testAttributes() throws Exception { @Test public void testNullProperties() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(AvoidConstantAsFirstOperandInConditionCheck.class); + createModuleConfig(AvoidConstantAsFirstOperandInConditionCheck.class); checkConfig.addAttribute("targetConstantTypes", null); 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 51683efb0c..0be959ba9a 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 @@ -34,7 +34,7 @@ public class AvoidDefaultSerializableInInnerClassesCheckTest extends public void testWithAllowPartiaFalse() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(AvoidDefaultSerializableInInnerClassesCheck.class); + createModuleConfig(AvoidDefaultSerializableInInnerClassesCheck.class); final String[] expected = { "33: " + warningMessage, @@ -61,7 +61,7 @@ public void testWithAllowPartiaFalse() public void testPrivateNotRealReadObject() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(AvoidDefaultSerializableInInnerClassesCheck.class); + createModuleConfig(AvoidDefaultSerializableInInnerClassesCheck.class); checkConfig.addAttribute("allowPartialImplementation", "true"); final String[] expected = { @@ -76,7 +76,7 @@ public void testPrivateNotRealReadObject() public void testRealReadObjectNotRealReadObjectRealPrivate() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(AvoidDefaultSerializableInInnerClassesCheck.class); + createModuleConfig(AvoidDefaultSerializableInInnerClassesCheck.class); final String[] expected = {}; @@ -88,7 +88,7 @@ public void testRealReadObjectNotRealReadObjectRealPrivate() public void testWithAllowPartiaTrue() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(AvoidDefaultSerializableInInnerClassesCheck.class); + createModuleConfig(AvoidDefaultSerializableInInnerClassesCheck.class); checkConfig.addAttribute("allowPartialImplementation", "true"); final String[] expected = { "33: " + warningMessage, 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 73320d63f9..904c13ea8c 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 @@ -32,7 +32,7 @@ public class AvoidHidingCauseExceptionCheckTest extends BaseCheckTestSupport { @Test public final void issue52Test() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(AvoidHidingCauseExceptionCheck.class); + createModuleConfig(AvoidHidingCauseExceptionCheck.class); final String[] expected = {}; @@ -42,7 +42,7 @@ public final void issue52Test() throws Exception { @Test public final void test() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(AvoidHidingCauseExceptionCheck.class); + createModuleConfig(AvoidHidingCauseExceptionCheck.class); final String[] expected = { "18:13: " + getCheckMessage(MSG_KEY, "e"), @@ -69,7 +69,7 @@ public final void test() throws Exception { @Test public final void testWrappingException() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(AvoidHidingCauseExceptionCheck.class); + createModuleConfig(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 d3b28b0e44..d056b6c878 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 @@ -38,30 +38,20 @@ */ public class AvoidModifiersForTypesCheckTest extends BaseCheckTestSupport { - private final DefaultConfiguration checkConfig = - createCheckConfig(AvoidModifiersForTypesCheck.class); - @Test public void testFinal() throws Exception { - final String annotationRegexp = null; - final String finalRegexp = "InputAvoidModifiersForTypesCheck"; - final String staticRegexp = null; - final String transientRegexp = null; - final String volatileRegexp = null; - final String publicRegexp = null; - final String packagePrivateRegexp = null; - final String protectedRegexp = null; - final String privateRegexp = null; - - checkConfig.addAttribute("forbiddenClassesRegexpAnnotation", annotationRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpFinal", finalRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpStatic", staticRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpTransient", transientRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpVolatile", volatileRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpPublic", publicRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpPackagePrivate", packagePrivateRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpProtected", protectedRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpPrivate", privateRegexp); + final DefaultConfiguration checkConfig = + createModuleConfig(AvoidModifiersForTypesCheck.class); + checkConfig.addAttribute("forbiddenClassesRegexpAnnotation", null); + checkConfig.addAttribute("forbiddenClassesRegexpFinal", + "InputAvoidModifiersForTypesCheck"); + checkConfig.addAttribute("forbiddenClassesRegexpStatic", null); + checkConfig.addAttribute("forbiddenClassesRegexpTransient", null); + checkConfig.addAttribute("forbiddenClassesRegexpVolatile", null); + checkConfig.addAttribute("forbiddenClassesRegexpPublic", null); + checkConfig.addAttribute("forbiddenClassesRegexpPackagePrivate", null); + checkConfig.addAttribute("forbiddenClassesRegexpProtected", null); + checkConfig.addAttribute("forbiddenClassesRegexpPrivate", null); final String[] expected = { "19:5: " + getCheckMessage(MSG_KEY, "InputAvoidModifiersForTypesCheck", "final"), @@ -75,25 +65,18 @@ public void testFinal() throws Exception { @Test public void testPackagePrivate() throws Exception { - final String annotationRegexp = null; - final String finalRegexp = null; - final String staticRegexp = null; - final String transientRegexp = null; - final String volatileRegexp = null; - final String privateRegexp = null; - final String packagePrivateRegexp = "InputAvoidModifiersForTypesCheck"; - final String protectedRegexp = null; - final String publicRegexp = null; - - checkConfig.addAttribute("forbiddenClassesRegexpAnnotation", annotationRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpFinal", finalRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpStatic", staticRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpTransient", transientRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpVolatile", volatileRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpPrivate", privateRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpPackagePrivate", packagePrivateRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpProtected", protectedRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpPublic", publicRegexp); + final DefaultConfiguration checkConfig = + createModuleConfig(AvoidModifiersForTypesCheck.class); + checkConfig.addAttribute("forbiddenClassesRegexpAnnotation", null); + checkConfig.addAttribute("forbiddenClassesRegexpFinal", null); + checkConfig.addAttribute("forbiddenClassesRegexpStatic", null); + checkConfig.addAttribute("forbiddenClassesRegexpTransient", null); + checkConfig.addAttribute("forbiddenClassesRegexpVolatile", null); + checkConfig.addAttribute("forbiddenClassesRegexpPrivate", null); + checkConfig.addAttribute("forbiddenClassesRegexpPackagePrivate", + "InputAvoidModifiersForTypesCheck"); + checkConfig.addAttribute("forbiddenClassesRegexpProtected", null); + checkConfig.addAttribute("forbiddenClassesRegexpPublic", null); final String[] expected = { "23:5: " + getCheckMessage(MSG_KEY, "InputAvoidModifiersForTypesCheck", @@ -107,25 +90,17 @@ public void testPackagePrivate() throws Exception { @Test public void testAnnotationPrivateStatic() throws Exception { - final String annotationRegexp = "File"; - final String finalRegexp = null; - final String staticRegexp = "File"; - final String transientRegexp = null; - final String volatileRegexp = null; - final String privateRegexp = "File"; - final String packagePrivateRegexp = null; - final String protectedRegexp = null; - final String publicRegexp = null; - - checkConfig.addAttribute("forbiddenClassesRegexpAnnotation", annotationRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpFinal", finalRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpStatic", staticRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpTransient", transientRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpVolatile", volatileRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpPrivate", privateRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpPackagePrivate", packagePrivateRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpProtected", protectedRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpPublic", publicRegexp); + final DefaultConfiguration checkConfig = + createModuleConfig(AvoidModifiersForTypesCheck.class); + checkConfig.addAttribute("forbiddenClassesRegexpAnnotation", "File"); + checkConfig.addAttribute("forbiddenClassesRegexpFinal", null); + checkConfig.addAttribute("forbiddenClassesRegexpStatic", "File"); + checkConfig.addAttribute("forbiddenClassesRegexpTransient", null); + checkConfig.addAttribute("forbiddenClassesRegexpVolatile", null); + checkConfig.addAttribute("forbiddenClassesRegexpPrivate", "File"); + checkConfig.addAttribute("forbiddenClassesRegexpPackagePrivate", null); + checkConfig.addAttribute("forbiddenClassesRegexpProtected", null); + checkConfig.addAttribute("forbiddenClassesRegexpPublic", null); final String[] expected = { "18:5: " + getCheckMessage(MSG_KEY, "File", "annotation"), @@ -138,25 +113,19 @@ public void testAnnotationPrivateStatic() throws Exception { @Test public void testProtectedAndTransient() throws Exception { - final String annotationRegexp = null; - final String finalRegexp = null; - final String staticRegexp = null; - final String transientRegexp = "InputAvoidModifiersForTypesCheck"; - final String volatileRegexp = null; - final String privateRegexp = null; - final String packagePrivateRegexp = null; - final String protectedRegexp = "InputAvoidModifiersForTypesCheck"; - final String publicRegexp = null; - - checkConfig.addAttribute("forbiddenClassesRegexpAnnotation", annotationRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpFinal", finalRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpStatic", staticRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpTransient", transientRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpVolatile", volatileRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpPrivate", privateRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpPackagePrivate", packagePrivateRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpProtected", protectedRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpPublic", publicRegexp); + final DefaultConfiguration checkConfig = + createModuleConfig(AvoidModifiersForTypesCheck.class); + checkConfig.addAttribute("forbiddenClassesRegexpAnnotation", null); + checkConfig.addAttribute("forbiddenClassesRegexpFinal", null); + checkConfig.addAttribute("forbiddenClassesRegexpStatic", null); + checkConfig.addAttribute("forbiddenClassesRegexpTransient", + "InputAvoidModifiersForTypesCheck"); + checkConfig.addAttribute("forbiddenClassesRegexpVolatile", null); + checkConfig.addAttribute("forbiddenClassesRegexpPrivate", null); + checkConfig.addAttribute("forbiddenClassesRegexpPackagePrivate", null); + checkConfig.addAttribute("forbiddenClassesRegexpProtected", + "InputAvoidModifiersForTypesCheck"); + checkConfig.addAttribute("forbiddenClassesRegexpPublic", null); final String[] expected = { "21:5: " + getCheckMessage(MSG_KEY, "InputAvoidModifiersForTypesCheck", "protected"), @@ -168,25 +137,19 @@ public void testProtectedAndTransient() throws Exception { @Test public void testPublicAndVolatile() throws Exception { - final String annotationRegexp = null; - final String finalRegexp = null; - final String staticRegexp = null; - final String transientRegexp = null; - final String volatileRegexp = "InputAvoidModifiersForTypesCheck"; - final String privateRegexp = null; - final String packagePrivateRegexp = null; - final String protectedRegexp = null; - final String publicRegexp = "InputAvoidModifiersForTypesCheck"; - - checkConfig.addAttribute("forbiddenClassesRegexpAnnotation", annotationRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpFinal", finalRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpStatic", staticRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpTransient", transientRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpVolatile", volatileRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpPrivate", privateRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpPackagePrivate", packagePrivateRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpProtected", protectedRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpPublic", publicRegexp); + final DefaultConfiguration checkConfig = + createModuleConfig(AvoidModifiersForTypesCheck.class); + checkConfig.addAttribute("forbiddenClassesRegexpAnnotation", null); + checkConfig.addAttribute("forbiddenClassesRegexpFinal", null); + checkConfig.addAttribute("forbiddenClassesRegexpStatic", null); + checkConfig.addAttribute("forbiddenClassesRegexpTransient", null); + checkConfig.addAttribute("forbiddenClassesRegexpVolatile", + "InputAvoidModifiersForTypesCheck"); + checkConfig.addAttribute("forbiddenClassesRegexpPrivate", null); + checkConfig.addAttribute("forbiddenClassesRegexpPackagePrivate", null); + checkConfig.addAttribute("forbiddenClassesRegexpProtected", null); + checkConfig.addAttribute("forbiddenClassesRegexpPublic", + "InputAvoidModifiersForTypesCheck"); final String[] expected = { "22:5: " + getCheckMessage(MSG_KEY, "InputAvoidModifiersForTypesCheck", "public"), @@ -198,25 +161,19 @@ public void testPublicAndVolatile() throws Exception { @Test public void testFinalAndPrivatePackage() throws Exception { - final String annotationRegexp = null; - final String finalRegexp = "InputAvoidModifiersForTypesCheck"; - final String staticRegexp = null; - final String transientRegexp = null; - final String volatileRegexp = null; - final String privateRegexp = null; - final String packagePrivateRegexp = "InputAvoidModifiersForTypesCheck"; - final String protectedRegexp = null; - final String publicRegexp = null; - - checkConfig.addAttribute("forbiddenClassesRegexpAnnotation", annotationRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpFinal", finalRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpStatic", staticRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpTransient", transientRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpVolatile", volatileRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpPrivate", privateRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpPackagePrivate", packagePrivateRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpProtected", protectedRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpPublic", publicRegexp); + final DefaultConfiguration checkConfig = + createModuleConfig(AvoidModifiersForTypesCheck.class); + checkConfig.addAttribute("forbiddenClassesRegexpAnnotation", null); + checkConfig.addAttribute("forbiddenClassesRegexpFinal", + "InputAvoidModifiersForTypesCheck"); + checkConfig.addAttribute("forbiddenClassesRegexpStatic", null); + checkConfig.addAttribute("forbiddenClassesRegexpTransient", null); + checkConfig.addAttribute("forbiddenClassesRegexpVolatile", null); + checkConfig.addAttribute("forbiddenClassesRegexpPrivate", null); + checkConfig.addAttribute("forbiddenClassesRegexpPackagePrivate", + "InputAvoidModifiersForTypesCheck"); + checkConfig.addAttribute("forbiddenClassesRegexpProtected", null); + checkConfig.addAttribute("forbiddenClassesRegexpPublic", null); final String[] expected = { "19:5: " + getCheckMessage(MSG_KEY, "InputAvoidModifiersForTypesCheck", "final"), @@ -234,25 +191,19 @@ public void testFinalAndPrivatePackage() throws Exception { @Test public void testFinalAndStatic() throws Exception { - final String annotationRegexp = null; - final String finalRegexp = "InputAvoidModifiersForTypesCheck"; - final String staticRegexp = "InputAvoidModifiersForTypesCheck"; - final String transientRegexp = null; - final String volatileRegexp = null; - final String privateRegexp = null; - final String packagePrivateRegexp = null; - final String protectedRegexp = null; - final String publicRegexp = null; - - checkConfig.addAttribute("forbiddenClassesRegexpAnnotation", annotationRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpFinal", finalRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpStatic", staticRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpTransient", transientRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpVolatile", volatileRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpPrivate", privateRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpPackagePrivate", packagePrivateRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpProtected", protectedRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpPublic", publicRegexp); + final DefaultConfiguration checkConfig = + createModuleConfig(AvoidModifiersForTypesCheck.class); + checkConfig.addAttribute("forbiddenClassesRegexpAnnotation", null); + checkConfig.addAttribute("forbiddenClassesRegexpFinal", + "InputAvoidModifiersForTypesCheck"); + checkConfig.addAttribute("forbiddenClassesRegexpStatic", + "InputAvoidModifiersForTypesCheck"); + checkConfig.addAttribute("forbiddenClassesRegexpTransient", null); + checkConfig.addAttribute("forbiddenClassesRegexpVolatile", null); + checkConfig.addAttribute("forbiddenClassesRegexpPrivate", null); + checkConfig.addAttribute("forbiddenClassesRegexpPackagePrivate", null); + checkConfig.addAttribute("forbiddenClassesRegexpProtected", null); + checkConfig.addAttribute("forbiddenClassesRegexpPublic", null); final String[] expected = { "19:5: " + getCheckMessage(MSG_KEY, "InputAvoidModifiersForTypesCheck", "final"), @@ -267,25 +218,18 @@ public void testFinalAndStatic() throws Exception { @Test public void testProtected() throws Exception { - final String annotationRegexp = null; - final String finalRegexp = null; - final String staticRegexp = null; - final String transientRegexp = null; - final String volatileRegexp = null; - final String privateRegexp = null; - final String packagePrivateRegexp = null; - final String protectedRegexp = "InputAvoidModifiersForTypesCheck"; - final String publicRegexp = null; - - checkConfig.addAttribute("forbiddenClassesRegexpAnnotation", annotationRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpFinal", finalRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpStatic", staticRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpTransient", transientRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpVolatile", volatileRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpPrivate", privateRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpPackagePrivate", packagePrivateRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpProtected", protectedRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpPublic", publicRegexp); + final DefaultConfiguration checkConfig = + createModuleConfig(AvoidModifiersForTypesCheck.class); + checkConfig.addAttribute("forbiddenClassesRegexpAnnotation", null); + checkConfig.addAttribute("forbiddenClassesRegexpFinal", null); + checkConfig.addAttribute("forbiddenClassesRegexpStatic", null); + checkConfig.addAttribute("forbiddenClassesRegexpTransient", null); + checkConfig.addAttribute("forbiddenClassesRegexpVolatile", null); + checkConfig.addAttribute("forbiddenClassesRegexpPrivate", null); + checkConfig.addAttribute("forbiddenClassesRegexpPackagePrivate", null); + checkConfig.addAttribute("forbiddenClassesRegexpProtected", + "InputAvoidModifiersForTypesCheck"); + checkConfig.addAttribute("forbiddenClassesRegexpPublic", null); final String[] expected = { "21:5: " + getCheckMessage(MSG_KEY, "InputAvoidModifiersForTypesCheck", "protected"), @@ -296,25 +240,17 @@ public void testProtected() throws Exception { @Test public void testLogger() throws Exception { - final String annotationRegexp = null; - final String finalRegexp = null; - final String staticRegexp = null; - final String transientRegexp = null; - final String volatileRegexp = null; - final String privateRegexp = null; - final String packagePrivateRegexp = "Logger"; - final String protectedRegexp = "Logger"; - final String publicRegexp = "Logger"; - - checkConfig.addAttribute("forbiddenClassesRegexpAnnotation", annotationRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpFinal", finalRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpStatic", staticRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpTransient", transientRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpVolatile", volatileRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpPrivate", privateRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpPackagePrivate", packagePrivateRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpProtected", protectedRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpPublic", publicRegexp); + final DefaultConfiguration checkConfig = + createModuleConfig(AvoidModifiersForTypesCheck.class); + checkConfig.addAttribute("forbiddenClassesRegexpAnnotation", null); + checkConfig.addAttribute("forbiddenClassesRegexpFinal", null); + checkConfig.addAttribute("forbiddenClassesRegexpStatic", null); + checkConfig.addAttribute("forbiddenClassesRegexpTransient", null); + checkConfig.addAttribute("forbiddenClassesRegexpVolatile", null); + checkConfig.addAttribute("forbiddenClassesRegexpPrivate", null); + checkConfig.addAttribute("forbiddenClassesRegexpPackagePrivate", "Logger"); + checkConfig.addAttribute("forbiddenClassesRegexpProtected", "Logger"); + checkConfig.addAttribute("forbiddenClassesRegexpPublic", "Logger"); final String[] expected = { "36:9: " + getCheckMessage(MSG_KEY, "Logger", "protected"), @@ -327,25 +263,17 @@ public void testLogger() throws Exception { @Test public void testAnyFile() throws Exception { - final String annotationRegexp = null; - final String finalRegexp = null; - final String staticRegexp = null; - final String transientRegexp = null; - final String volatileRegexp = null; - final String privateRegexp = null; - final String packagePrivateRegexp = null; - final String protectedRegexp = null; - final String publicRegexp = null; - - checkConfig.addAttribute("forbiddenClassesRegexpAnnotation", annotationRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpFinal", finalRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpStatic", staticRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpTransient", transientRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpVolatile", volatileRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpPrivate", privateRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpPackagePrivate", packagePrivateRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpProtected", protectedRegexp); - checkConfig.addAttribute("forbiddenClassesRegexpPublic", publicRegexp); + final DefaultConfiguration checkConfig = + createModuleConfig(AvoidModifiersForTypesCheck.class); + checkConfig.addAttribute("forbiddenClassesRegexpAnnotation", null); + checkConfig.addAttribute("forbiddenClassesRegexpFinal", null); + checkConfig.addAttribute("forbiddenClassesRegexpStatic", null); + checkConfig.addAttribute("forbiddenClassesRegexpTransient", null); + checkConfig.addAttribute("forbiddenClassesRegexpVolatile", null); + checkConfig.addAttribute("forbiddenClassesRegexpPrivate", null); + checkConfig.addAttribute("forbiddenClassesRegexpPackagePrivate", null); + checkConfig.addAttribute("forbiddenClassesRegexpProtected", null); + checkConfig.addAttribute("forbiddenClassesRegexpPublic", null); final String[] expected = {}; 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 8bfe2bd199..d42825b769 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,11 +29,10 @@ public class AvoidNotShortCircuitOperatorsForBooleanCheckTest extends BaseCheckTestSupport { - private final DefaultConfiguration checkConfig = - createCheckConfig(AvoidNotShortCircuitOperatorsForBooleanCheck.class); - @Test public final void testAll() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(AvoidNotShortCircuitOperatorsForBooleanCheck.class); final String[] expected = { "6:23: " + getCheckMessage(MSG_KEY, "|"), @@ -58,6 +57,8 @@ public final void testAll() throws Exception { @Test public final void testNonClasses() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(AvoidNotShortCircuitOperatorsForBooleanCheck.class); verify(checkConfig, 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 46a2c0e8c9..fb0a8b4b65 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 @@ -35,7 +35,7 @@ public class ConfusingConditionCheckTest extends BaseCheckTestSupport { @Test public void testDefault() throws Exception { - final DefaultConfiguration checkConfig = createCheckConfig(ConfusingConditionCheck.class); + final DefaultConfiguration checkConfig = createModuleConfig(ConfusingConditionCheck.class); final String[] expected = { "10: " + warningMessage, @@ -63,7 +63,7 @@ public void testDefault() throws Exception { @Test public void testFalseProperties() throws Exception { - final DefaultConfiguration checkConfig = createCheckConfig(ConfusingConditionCheck.class); + final DefaultConfiguration checkConfig = createModuleConfig(ConfusingConditionCheck.class); checkConfig.addAttribute("ignoreInnerIf", "false"); checkConfig.addAttribute("ignoreNullCaseInIf", "false"); @@ -107,7 +107,7 @@ public void testFalseProperties() throws Exception { @Test public void testMultiplyFactor() throws Exception { - final DefaultConfiguration checkConfig = createCheckConfig(ConfusingConditionCheck.class); + final DefaultConfiguration checkConfig = createModuleConfig(ConfusingConditionCheck.class); checkConfig.addAttribute("multiplyFactorForElseBlocks", "0"); @@ -130,7 +130,7 @@ public void testMultiplyFactor() throws Exception { @Test public void testExceptions() throws Exception { - final DefaultConfiguration checkConfig = createCheckConfig(ConfusingConditionCheck.class); + final DefaultConfiguration checkConfig = createModuleConfig(ConfusingConditionCheck.class); final String[] 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 ab5b089117..88799991bb 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 @@ -36,7 +36,7 @@ public class CustomDeclarationOrderCheckTest extends BaseCheckTestSupport { @Test public void testCustomDecrationOrder() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(CustomDeclarationOrderCheck.class); + createModuleConfig(CustomDeclarationOrderCheck.class); final String[] expected = { "10:5: " + getCheckMessage(MSG_KEY_FIELD, "Field(private static final long serialVersionUID)", @@ -84,7 +84,7 @@ public void testCustomDecrationOrder() throws Exception { public void anonymousClasses() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(CustomDeclarationOrderCheck.class); + createModuleConfig(CustomDeclarationOrderCheck.class); final String[] expected = { "39:5: " + getCheckMessage(MSG_KEY_FIELD, "DeclareAnnonClassField(private .*)", "Field(public .*)"), @@ -116,7 +116,7 @@ public void anonymousClasses() public void gettersSetters() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(CustomDeclarationOrderCheck.class); + createModuleConfig(CustomDeclarationOrderCheck.class); final String[] expected = { "50:5: " + getCheckMessage(MSG_KEY_METHOD, "GetterSetter(.*)", "Method(.*)"), "56:5: " + getCheckMessage(MSG_KEY_METHOD, "GetterSetter(.*)", "Method(.*)"), @@ -148,7 +148,7 @@ public void gettersSetters() public void innerInterfacesAndEnums() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(CustomDeclarationOrderCheck.class); + createModuleConfig(CustomDeclarationOrderCheck.class); final String[] expected = { "41:5: " + getCheckMessage(MSG_KEY_FIELD, "Field(private )", "InnerInterface(.*)"), "49:5: " + getCheckMessage(MSG_KEY_FIELD, "Field(private )", "InnerEnum(.*)"), @@ -170,7 +170,7 @@ public void innerInterfacesAndEnums() public void mainMethod() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(CustomDeclarationOrderCheck.class); + createModuleConfig(CustomDeclarationOrderCheck.class); final String[] expected = { "10:5: " + getCheckMessage(MSG_KEY_FIELD, "Field(private )", "MainMethod(.*)"), "17:5: " + getCheckMessage(MSG_KEY_FIELD, "Field(private )", "MainMethod(.*)"), 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 b60dbd7695..4086f7007d 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,11 +27,10 @@ import com.puppycrawl.tools.checkstyle.DefaultConfiguration; public class DiamondOperatorForVariableDefinitionCheckTest extends BaseCheckTestSupport { - private final DefaultConfiguration checkConfig = - createCheckConfig(DiamondOperatorForVariableDefinitionCheck.class); - @Test public void testDefault() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(DiamondOperatorForVariableDefinitionCheck.class); final String[] expected = { "25:58: " + getCheckMessage(MSG_KEY), "27:26: " + getCheckMessage(MSG_KEY), 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 708e13bca6..294fd1a33d 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 @@ -33,10 +33,9 @@ public class EitherLogOrThrowCheckTest extends BaseCheckTestSupport { private final String warningMessage = getCheckMessage(MSG_KEY); - private final DefaultConfiguration checkConfig = createCheckConfig(EitherLogOrThrowCheck.class); - @Test public void test() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(EitherLogOrThrowCheck.class); checkConfig.addAttribute("loggerFullyQualifiedClassName", "org.slf4j.Logger"); checkConfig.addAttribute("loggingMethodNames", "error, warn"); 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 60e1bf741f..e284b446e2 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 @@ -33,11 +33,11 @@ public class EmptyPublicCtorInClassCheckTest extends BaseCheckTestSupport { private final String message = getCheckMessage(MSG_KEY); - private DefaultConfiguration checkConfig = createCheckConfig(EmptyPublicCtorInClassCheck.class); - @Test public void testEmptyPublicCtor() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(EmptyPublicCtorInClassCheck.class); final String[] expected = { "5:5: " + message, }; @@ -48,6 +48,8 @@ public void testEmptyPublicCtor() @Test public void testEmptyPrivateCtor() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(EmptyPublicCtorInClassCheck.class); final String[] expected = {}; verify(checkConfig, getPath("InputEmptyPublicCtorInClassCheck2.java"), expected); @@ -56,6 +58,8 @@ public void testEmptyPrivateCtor() @Test public void testEmptyProtectedCtor() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(EmptyPublicCtorInClassCheck.class); final String[] expected = {}; verify(checkConfig, getPath("InputEmptyPublicCtorInClassCheck6.java"), expected); @@ -64,6 +68,8 @@ public void testEmptyProtectedCtor() @Test public void testClassWithMultiplePublicCtors() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(EmptyPublicCtorInClassCheck.class); final String[] expected = {}; verify(checkConfig, getPath("InputEmptyPublicCtorInClassCheck3.java"), expected); @@ -72,6 +78,8 @@ public void testClassWithMultiplePublicCtors() @Test public void testPublicNotEmptyCtor() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(EmptyPublicCtorInClassCheck.class); final String[] expected = {}; verify(checkConfig, getPath("InputEmptyPublicCtorInClassCheck4.java"), expected); @@ -80,6 +88,8 @@ public void testPublicNotEmptyCtor() @Test public void testClassWithInnerClasses() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(EmptyPublicCtorInClassCheck.class); final String[] expected = { "5:5: " + message, "14:9: " + message, @@ -90,7 +100,7 @@ public void testClassWithInnerClasses() @Test public void testCtorAnnotatedWithAnnotation() throws Exception { - final DefaultConfiguration config = createCheckConfig(EmptyPublicCtorInClassCheck.class); + final DefaultConfiguration config = createModuleConfig(EmptyPublicCtorInClassCheck.class); config.addAttribute("ctorAnnotationNames", "com\\.github\\.sevntu\\.checkstyle\\.checks\\." + "coding\\.AnnotationName"); @@ -102,7 +112,7 @@ public void testCtorAnnotatedWithAnnotation() throws Exception { @Test public void testClassAnnotatedWithAnnotation1() throws Exception { - final DefaultConfiguration config = createCheckConfig(EmptyPublicCtorInClassCheck.class); + final DefaultConfiguration config = createModuleConfig(EmptyPublicCtorInClassCheck.class); config.addAttribute("classAnnotationNames", "com\\.github\\.sevntu\\.checkstyle\\.checks\\.coding\\.AnnotationName|" @@ -118,7 +128,7 @@ public void testClassAnnotatedWithAnnotation1() throws Exception { @Test public void testClassAnnotatedWithAnnotation2() throws Exception { - final DefaultConfiguration config = createCheckConfig(EmptyPublicCtorInClassCheck.class); + final DefaultConfiguration config = createModuleConfig(EmptyPublicCtorInClassCheck.class); config.addAttribute("classAnnotationNames", "org\\.junit\\.runner\\.RunWith|org\\.junit\\.Ignore|"); @@ -130,7 +140,7 @@ public void testClassAnnotatedWithAnnotation2() throws Exception { @Test public void testNullProperties1() throws Exception { - final DefaultConfiguration config = createCheckConfig(EmptyPublicCtorInClassCheck.class); + final DefaultConfiguration config = createModuleConfig(EmptyPublicCtorInClassCheck.class); config.addAttribute("classAnnotationNames", null); config.addAttribute("ctorAnnotationNames", null); @@ -145,7 +155,7 @@ public void testNullProperties1() throws Exception { @Test public void testNullProperties2() throws Exception { - final DefaultConfiguration config = createCheckConfig(EmptyPublicCtorInClassCheck.class); + final DefaultConfiguration config = createModuleConfig(EmptyPublicCtorInClassCheck.class); config.addAttribute("classAnnotationNames", ""); config.addAttribute("ctorAnnotationNames", ""); 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 752ff7f52f..3d1862e759 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 @@ -31,15 +31,10 @@ public class FinalizeImplementationCheckTest extends BaseCheckTestSupport { - /** - * Default check configuration - */ - private final DefaultConfiguration checkConfig = - createCheckConfig(FinalizeImplementationCheck.class); - @Test public final void basicTest() throws Exception { - + final DefaultConfiguration checkConfig = + createModuleConfig(FinalizeImplementationCheck.class); final String[] expected = { "22: " + getCheckMessage(MSG_KEY_MISSED_TRY_FINALLY), "35: " + getCheckMessage(MSG_KEY_MISSED_TRY_FINALLY), @@ -54,6 +49,8 @@ public final void basicTest() throws Exception { @Test public final void testSpecialFinalize() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(FinalizeImplementationCheck.class); final String[] expected = { "5: " + getCheckMessage(MSG_KEY_MISSED_TRY_FINALLY), "18: " + getCheckMessage(MSG_KEY_MISSED_TRY_FINALLY), 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 f302d82602..595b8c5ad2 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 @@ -35,7 +35,7 @@ public void defaultTest() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(ForbidCCommentsInMethodsCheck.class); + createModuleConfig(ForbidCCommentsInMethodsCheck.class); final String[] expected = { "10: " + warningMessage, "17: " + warningMessage, @@ -53,7 +53,7 @@ public void defaultTest() public void testFileWithoutComments() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(ForbidCCommentsInMethodsCheck.class); + createModuleConfig(ForbidCCommentsInMethodsCheck.class); final String[] expected = {}; verify(checkConfig, getPath("InputForbidCCommentsInMethodsCheck2.java"), expected); } @@ -62,7 +62,7 @@ public void testFileWithoutComments() public void testInterface() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(ForbidCCommentsInMethodsCheck.class); + createModuleConfig(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 ad9e420b5c..eed5a0f07c 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,23 +35,21 @@ * Yaroslavtsev */ public class ForbidCertainImportsCheckTest extends BaseCheckTestSupport { - private final DefaultConfiguration checkConfig = - createCheckConfig(ForbidCertainImportsCheck.class); - @Test public void testNormalWork() throws Exception { - final String importRegexp = ".+\\.api\\..+"; + final DefaultConfiguration checkConfig = + createModuleConfig(ForbidCertainImportsCheck.class); checkConfig.addAttribute("packageNameRegexp", ".+\\.sevntu\\..+"); - checkConfig.addAttribute("forbiddenImportsRegexp", importRegexp); + checkConfig.addAttribute("forbiddenImportsRegexp", ".+\\.api\\..+"); checkConfig.addAttribute("forbiddenImportsExcludesRegexp", ""); final String[] expected = { - "3: " + getCheckMessage(MSG_KEY, importRegexp, + "3: " + getCheckMessage(MSG_KEY, ".+\\.api\\..+", "com.puppycrawl.tools.checkstyle.api.AutomaticBean"), - "9: " + getCheckMessage(MSG_KEY, importRegexp, + "9: " + getCheckMessage(MSG_KEY, ".+\\.api\\..+", "com.puppycrawl.tools.checkstyle.api.AutomaticBean"), - "21: " + getCheckMessage(MSG_KEY, importRegexp, + "21: " + getCheckMessage(MSG_KEY, ".+\\.api\\..+", "com.puppycrawl.tools.checkstyle.api.AutomaticBean"), }; @@ -60,6 +58,8 @@ public void testNormalWork() throws Exception { @Test public void testNoPackageMatch() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(ForbidCertainImportsCheck.class); checkConfig.addAttribute("packageNameRegexp", ".+\\.BAD\\..+"); checkConfig.addAttribute("forbiddenImportsRegexp", ".+\\.api\\..+"); checkConfig.addAttribute("forbiddenImportsExcludesRegexp", ""); @@ -71,10 +71,10 @@ public void testNoPackageMatch() throws Exception { @Test public void testNormalWorkWithExcludes() throws Exception { - final String importRegexp = ".+\\.api\\..+"; - + final DefaultConfiguration checkConfig = + createModuleConfig(ForbidCertainImportsCheck.class); checkConfig.addAttribute("packageNameRegexp", ".+\\.sevntu\\..+"); - checkConfig.addAttribute("forbiddenImportsRegexp", importRegexp); + checkConfig.addAttribute("forbiddenImportsRegexp", ".+\\.api\\..+"); checkConfig.addAttribute("forbiddenImportsExcludesRegexp", "com.puppycrawl.+"); final String[] expected = {}; @@ -84,6 +84,8 @@ public void testNormalWorkWithExcludes() throws Exception { @Test public void testEmptyImportsAndDefaultPackage() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(ForbidCertainImportsCheck.class); checkConfig.addAttribute("packageNameRegexp", ".+\\.old\\..+"); checkConfig.addAttribute("forbiddenImportsRegexp", ".+\\.api\\..+"); checkConfig.addAttribute("forbiddenImportsExcludesRegexp", ""); @@ -97,6 +99,8 @@ public void testEmptyImportsAndDefaultPackage() throws Exception { @Test public void testEmptyParams() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(ForbidCertainImportsCheck.class); checkConfig.addAttribute("packageNameRegexp", ""); checkConfig.addAttribute("forbiddenImportsRegexp", ""); checkConfig.addAttribute("forbiddenImportsExcludesRegexp", ""); @@ -110,6 +114,8 @@ public void testEmptyParams() throws Exception { @Test public void testNullParams() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(ForbidCertainImportsCheck.class); checkConfig.addAttribute("packageNameRegexp", null); checkConfig.addAttribute("forbiddenImportsRegexp", null); checkConfig.addAttribute("forbiddenImportsExcludesRegexp", null); @@ -123,6 +129,8 @@ public void testNullParams() throws Exception { @Test public void testPackageMatchButNullParams() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(ForbidCertainImportsCheck.class); checkConfig.addAttribute("packageNameRegexp", ".+\\.sevntu\\..+"); checkConfig.addAttribute("forbiddenImportsRegexp", null); checkConfig.addAttribute("forbiddenImportsExcludesRegexp", null); @@ -134,18 +142,18 @@ public void testPackageMatchButNullParams() throws Exception { @Test public void testPackageForbiddenImportMatchButNullExclude() throws Exception { - final String importRegexp = ".+\\.api\\..+"; - + final DefaultConfiguration checkConfig = + createModuleConfig(ForbidCertainImportsCheck.class); checkConfig.addAttribute("packageNameRegexp", ".+\\.sevntu\\..+"); - checkConfig.addAttribute("forbiddenImportsRegexp", importRegexp); + checkConfig.addAttribute("forbiddenImportsRegexp", ".+\\.api\\..+"); checkConfig.addAttribute("forbiddenImportsExcludesRegexp", null); final String[] expected = { - "3: " + getCheckMessage(MSG_KEY, importRegexp, + "3: " + getCheckMessage(MSG_KEY, ".+\\.api\\..+", "com.puppycrawl.tools.checkstyle.api.AutomaticBean"), - "9: " + getCheckMessage(MSG_KEY, importRegexp, + "9: " + getCheckMessage(MSG_KEY, ".+\\.api\\..+", "com.puppycrawl.tools.checkstyle.api.AutomaticBean"), - "21: " + getCheckMessage(MSG_KEY, importRegexp, + "21: " + getCheckMessage(MSG_KEY, ".+\\.api\\..+", "com.puppycrawl.tools.checkstyle.api.AutomaticBean"), }; @@ -154,6 +162,8 @@ public void testPackageForbiddenImportMatchButNullExclude() throws Exception { @Test public void testNoImports() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(ForbidCertainImportsCheck.class); checkConfig.addAttribute("packageNameRegexp", ""); checkConfig.addAttribute("forbiddenImportsRegexp", ""); checkConfig.addAttribute("forbiddenImportsExcludesRegexp", ""); @@ -167,16 +177,16 @@ public void testNoImports() throws Exception { @Test public void testSinglePackage() throws Exception { - final String importRegexp = ".+\\.api\\..+"; - + final DefaultConfiguration checkConfig = + createModuleConfig(ForbidCertainImportsCheck.class); checkConfig.addAttribute("packageNameRegexp", "sevntu"); - checkConfig.addAttribute("forbiddenImportsRegexp", importRegexp); + checkConfig.addAttribute("forbiddenImportsRegexp", ".+\\.api\\..+"); checkConfig.addAttribute("forbiddenImportsExcludesRegexp", ""); final String[] expected = { - "3: " + getCheckMessage(MSG_KEY, importRegexp, + "3: " + getCheckMessage(MSG_KEY, ".+\\.api\\..+", "com.puppycrawl.tools.checkstyle.api.AutomaticBean"), - "10: " + getCheckMessage(MSG_KEY, importRegexp, + "10: " + getCheckMessage(MSG_KEY, ".+\\.api\\..+", "com.puppycrawl.tools.checkstyle.api.AutomaticBean"), }; 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 aab11c85f5..9a20f8b9a8 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,11 +35,10 @@ * Yaroslavtsev */ public class ForbidInstantiationCheckTest extends BaseCheckTestSupport { - private final DefaultConfiguration checkConfig = - createCheckConfig(ForbidInstantiationCheck.class); - @Test public void testNullProperties() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(ForbidInstantiationCheck.class); checkConfig.addAttribute("forbiddenClasses", null); final String[] expected = {}; @@ -49,7 +48,8 @@ public void testNullProperties() throws Exception { @Test public void testNullPointerException() throws Exception { - + final DefaultConfiguration checkConfig = + createModuleConfig(ForbidInstantiationCheck.class); checkConfig.addAttribute("forbiddenClasses", "java.lang.NullPointerException"); final String[] expected = { @@ -62,7 +62,8 @@ public void testNullPointerException() throws Exception { @Test public void testNormalWork() throws Exception { - + final DefaultConfiguration checkConfig = + createModuleConfig(ForbidInstantiationCheck.class); checkConfig.addAttribute("forbiddenClasses", "java.io.File , java.lang.String , "); final String[] expected = { @@ -76,7 +77,8 @@ public void testNormalWork() throws Exception { @Test public void testNormalWork2() throws Exception { - + final DefaultConfiguration checkConfig = + createModuleConfig(ForbidInstantiationCheck.class); checkConfig.addAttribute("forbiddenClasses", "com.github.sevntu.checkstyle.checks.coding.InputForbidInstantiationCheck"); @@ -89,7 +91,8 @@ public void testNormalWork2() throws Exception { @Test public void testNormalWork3() throws Exception { - + final DefaultConfiguration checkConfig = + createModuleConfig(ForbidInstantiationCheck.class); checkConfig.addAttribute("forbiddenClasses", "java.io.File , java.lang.String , "); final String[] expected = { @@ -102,7 +105,8 @@ public void testNormalWork3() throws Exception { @Test public void testAsteriskInInput() throws Exception { - + final DefaultConfiguration checkConfig = + createModuleConfig(ForbidInstantiationCheck.class); checkConfig.addAttribute("forbiddenClasses", "java.io.File , java.lang.String , "); final String[] expected = { 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 151b87c916..de58133712 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 @@ -37,7 +37,7 @@ public class ForbidReturnInFinallyBlockCheckTest public void testDefault() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(ForbidReturnInFinallyBlockCheck.class); + createModuleConfig(ForbidReturnInFinallyBlockCheck.class); final String[] expected = { "13: " + warningMessage, "28: " + warningMessage, 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 971ca6a119..9c06819f90 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 @@ -28,15 +28,10 @@ public class ForbidThrowAnonymousExceptionsCheckTest extends BaseCheckTestSupport { - /** - * Default check configuration - */ - private final DefaultConfiguration checkConfig = - createCheckConfig(ForbidThrowAnonymousExceptionsCheck.class); - @Test public final void anonymousExceptionTest() throws Exception { - + final DefaultConfiguration checkConfig = + createModuleConfig(ForbidThrowAnonymousExceptionsCheck.class); final String[] expected = { "8: " + getCheckMessage(MSG_KEY), }; @@ -47,7 +42,8 @@ public final void anonymousExceptionTest() throws Exception { @Test public final void preDefinedAnonymousExceptionTest() throws Exception { - + final DefaultConfiguration checkConfig = + createModuleConfig(ForbidThrowAnonymousExceptionsCheck.class); final String[] expected = { "8: " + getCheckMessage(MSG_KEY), "30: " + getCheckMessage(MSG_KEY), @@ -59,7 +55,8 @@ public final void preDefinedAnonymousExceptionTest() throws Exception { @Test public final void sameNameExceptionsTest() throws Exception { - + final DefaultConfiguration checkConfig = + createModuleConfig(ForbidThrowAnonymousExceptionsCheck.class); final String[] expected = { "12: " + getCheckMessage(MSG_KEY), "23: " + getCheckMessage(MSG_KEY), @@ -75,8 +72,9 @@ public final void sameNameExceptionsTest() throws Exception { @Test public final void nonStandardExceptionClassNameTest() throws Exception { - final String exceptionNameRegex = "^.*bla"; - checkConfig.addAttribute("exceptionClassNameRegex", exceptionNameRegex); + final DefaultConfiguration checkConfig = + createModuleConfig(ForbidThrowAnonymousExceptionsCheck.class); + checkConfig.addAttribute("exceptionClassNameRegex", "^.*bla"); final String[] expected = { "10: " + getCheckMessage(MSG_KEY), "12: " + getCheckMessage(MSG_KEY), 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 946b1a3f0b..27a329340e 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,11 +28,10 @@ public class IllegalCatchExtendedCheckTest extends BaseCheckTestSupport { - private final DefaultConfiguration checkConfig = - createCheckConfig(IllegalCatchExtendedCheck.class); - @Test public final void testDefault() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(IllegalCatchExtendedCheck.class); final String[] expected = { "9:9: " + getCheckMessage(MSG_KEY, "RuntimeException"), "11:9: " + getCheckMessage(MSG_KEY, "java.lang.Exception"), @@ -50,7 +49,8 @@ public final void testDefault() throws Exception { @Test public final void testThrowPermit() throws Exception { - + final DefaultConfiguration checkConfig = + createModuleConfig(IllegalCatchExtendedCheck.class); final String[] expected = { "9:9: " + getCheckMessage(MSG_KEY, "RuntimeException"), "11:9: " + getCheckMessage(MSG_KEY, "java.lang.Exception"), @@ -67,6 +67,8 @@ public final void testThrowPermit() throws Exception { @Test public final void testReThrowPermit() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(IllegalCatchExtendedCheck.class); checkConfig.addAttribute("illegalClassNames", "java.lang.Error, java.lang.Exception, java.lang.Throwable"); @@ -83,6 +85,8 @@ public final void testReThrowPermit() throws Exception { @Test public void testIllegalClassNames() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(IllegalCatchExtendedCheck.class); checkConfig.addAttribute("illegalClassNames", "java.lang.Error, java.lang.Exception, NullPointerException"); 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 7c7dbfbd37..fc9d69d732 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 @@ -31,7 +31,7 @@ public class LogicConditionNeedOptimizationCheckTest extends BaseCheckTestSuppor @Test public void test() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(LogicConditionNeedOptimizationCheck.class); + createModuleConfig(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/MapIterationInForEachLoopCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/MapIterationInForEachLoopCheckTest.java index bb795e340a..0854436fd0 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 @@ -31,14 +31,10 @@ public class MapIterationInForEachLoopCheckTest extends BaseCheckTestSupport { - /** - * Default check configuration - */ - private final DefaultConfiguration checkConfig = - createCheckConfig(MapIterationInForEachLoopCheck.class); - @Test public final void basicTest() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(MapIterationInForEachLoopCheck.class); checkConfig.addAttribute("proposeValuesUsage", "true"); checkConfig.addAttribute("proposeKeySetUsage", "true"); checkConfig.addAttribute("proposeEntrySetUsage", "true"); @@ -61,6 +57,8 @@ public final void basicTest() throws Exception { @Test public final void importsWithoutFullPathTest() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(MapIterationInForEachLoopCheck.class); checkConfig.addAttribute("proposeValuesUsage", "true"); checkConfig.addAttribute("proposeKeySetUsage", "true"); checkConfig.addAttribute("proposeEntrySetUsage", "true"); @@ -75,17 +73,13 @@ public final void importsWithoutFullPathTest() throws Exception { @Test public final void skipIfConditionTest() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(MapIterationInForEachLoopCheck.class); checkConfig.addAttribute("proposeValuesUsage", "false"); checkConfig.addAttribute("proposeKeySetUsage", "true"); checkConfig.addAttribute("proposeEntrySetUsage", "true"); - - final String supportedMapImplQualifiedNames = - "java.util.Map, " - + "java.util.HashMap, java.util.TreeMap, " - + "com.myTest.InputMyMap"; - checkConfig.addAttribute("supportedMapImplQualifiedNames", - supportedMapImplQualifiedNames); + "java.util.Map, java.util.HashMap, java.util.TreeMap, com.myTest.InputMyMap"); final String[] expected = { "14:9: " + getCheckMessage(MSG_KEY_ENTRYSET), @@ -98,6 +92,8 @@ public final void skipIfConditionTest() throws Exception { @Test public final void testClassExtendingMap() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(MapIterationInForEachLoopCheck.class); checkConfig.addAttribute("proposeValuesUsage", "true"); checkConfig.addAttribute("proposeKeySetUsage", "true"); checkConfig.addAttribute("proposeEntrySetUsage", "true"); 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 2b04c09fb8..22c1359836 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 @@ -30,14 +30,16 @@ public class MoveVariableInsideIfCheckTest extends BaseCheckTestSupport { @Test public final void testNoViolations() throws Exception { - final DefaultConfiguration checkConfig = createCheckConfig(MoveVariableInsideIfCheck.class); + final DefaultConfiguration checkConfig = + createModuleConfig(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 DefaultConfiguration checkConfig = + createModuleConfig(MoveVariableInsideIfCheck.class); final String[] expected = { "5:9: " + getCheckMessage(MSG_KEY, "variable", "7"), "13:9: " + getCheckMessage(MSG_KEY, "variable", "15"), @@ -50,7 +52,8 @@ public final void testViolations() throws Exception { @Test public final void testFalsePositives() throws Exception { - final DefaultConfiguration checkConfig = createCheckConfig(MoveVariableInsideIfCheck.class); + final DefaultConfiguration checkConfig = + createModuleConfig(MoveVariableInsideIfCheck.class); final String[] expected = { "9:9: " + getCheckMessage(MSG_KEY, "variable", "12"), "18:9: " + getCheckMessage(MSG_KEY, "variable", "24"), 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 3ccc4ca2dc..b073457321 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 @@ -30,7 +30,7 @@ public class MultipleStringLiteralsExtendedCheckTest extends BaseCheckTestSuppor @Test public void testIt() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(MultipleStringLiteralsExtendedCheck.class); + createModuleConfig(MultipleStringLiteralsExtendedCheck.class); checkConfig.addAttribute("allowedDuplicates", "2"); checkConfig.addAttribute("ignoreStringsRegexp", ""); checkConfig.addAttribute("highlightAllDuplicates", "false"); @@ -48,7 +48,7 @@ public void testIt() throws Exception { public void testItAndShowAllWarnings() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(MultipleStringLiteralsExtendedCheck.class); + createModuleConfig(MultipleStringLiteralsExtendedCheck.class); checkConfig.addAttribute("allowedDuplicates", "2"); checkConfig.addAttribute("ignoreStringsRegexp", ""); checkConfig.addAttribute("highlightAllDuplicates", "true"); @@ -72,7 +72,7 @@ public void testItAndShowAllWarnings() @Test public void testItIgnoreEmpty() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(MultipleStringLiteralsExtendedCheck.class); + createModuleConfig(MultipleStringLiteralsExtendedCheck.class); checkConfig.addAttribute("allowedDuplicates", "2"); checkConfig.addAttribute("highlightAllDuplicates", "false"); @@ -87,7 +87,7 @@ public void testItIgnoreEmpty() throws Exception { @Test public void testItIgnoreEmptyAndComaSpace() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(MultipleStringLiteralsExtendedCheck.class); + createModuleConfig(MultipleStringLiteralsExtendedCheck.class); checkConfig.addAttribute("allowedDuplicates", "2"); checkConfig.addAttribute("ignoreStringsRegexp", "^((\"\")|(\", \"))$"); checkConfig.addAttribute("highlightAllDuplicates", "false"); @@ -102,7 +102,7 @@ public void testItIgnoreEmptyAndComaSpace() throws Exception { @Test public void testItWithoutIgnoringAnnotations() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(MultipleStringLiteralsExtendedCheck.class); + createModuleConfig(MultipleStringLiteralsExtendedCheck.class); checkConfig.addAttribute("allowedDuplicates", "3"); checkConfig.addAttribute("ignoreOccurrenceContext", ""); checkConfig.addAttribute("highlightAllDuplicates", "false"); @@ -117,7 +117,7 @@ public void testItWithoutIgnoringAnnotations() throws Exception { @Test public void testNullProperty() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(MultipleStringLiteralsExtendedCheck.class); + createModuleConfig(MultipleStringLiteralsExtendedCheck.class); checkConfig.addAttribute("ignoreStringsRegexp", null); final String[] expected = { @@ -133,7 +133,7 @@ public void testNullProperty() throws Exception { @Test public void testIgnoreOccurrenceContextProperty() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(MultipleStringLiteralsExtendedCheck.class); + createModuleConfig(MultipleStringLiteralsExtendedCheck.class); checkConfig.addAttribute("ignoreOccurrenceContext", "EXPR, PLUS"); final String[] expected = {}; 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 1aa770c2a6..2f62a3494d 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 @@ -35,7 +35,7 @@ public class MultipleVariableDeclarationsExtendedCheckTest extends BaseCheckTest @Test public void testStandartSituation() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(MultipleVariableDeclarationsExtendedCheck.class); + createModuleConfig(MultipleVariableDeclarationsExtendedCheck.class); final String[] expected = { "3:5: " + msgVarDeclarationsComa, @@ -57,7 +57,7 @@ public void testStandartSituation() throws Exception { @Test public void testIgnoreCycles() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(MultipleVariableDeclarationsExtendedCheck.class); + createModuleConfig(MultipleVariableDeclarationsExtendedCheck.class); final String[] expected = { "3:5: " + msgVarDeclarationsComa, @@ -77,7 +77,7 @@ public void testIgnoreCycles() throws Exception { @Test public void testIgnoreMethods() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(MultipleVariableDeclarationsExtendedCheck.class); + createModuleConfig(MultipleVariableDeclarationsExtendedCheck.class); final String[] expected = { "3:5: " + msgVarDeclarationsComa, @@ -96,7 +96,7 @@ public void testIgnoreMethods() throws Exception { @Test public void testIgnoreMethodsAndIgnoreCycles() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(MultipleVariableDeclarationsExtendedCheck.class); + createModuleConfig(MultipleVariableDeclarationsExtendedCheck.class); final String[] expected = { "3:5: " + msgVarDeclarationsComa, 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 15deda3a9b..1e225176dd 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 @@ -34,21 +34,19 @@ public class NameConventionForJunit4TestClassesCheckTest extends BaseCheckTestSu private final String msgFormat = getCheckMessage(NameConventionForJunit4TestClassesCheck.MSG_KEY); - private final String defaultTestClassName = - ".+Test\\d*|.+Tests\\d*|Test.+|Tests.+|.+IT|.+ITs|.+TestCase|.+TestCases"; - - private final DefaultConfiguration checkConfig = - buildConfiguration(defaultTestClassName, "", "Test"); - @Test public void testAnnotatedClass() throws Exception { - final DefaultConfiguration customConfig = - buildConfiguration(defaultTestClassName, "RunWith", ""); + createModuleConfig(NameConventionForJunit4TestClassesCheck.class); + customConfig.addAttribute("expectedClassNameRegex", + ".+Test\\d*|.+Tests\\d*|Test.+|Tests.+|.+IT|.+ITs|.+TestCase|.+TestCases"); + customConfig.addAttribute("classAnnotationNameRegex", "RunWith"); + customConfig.addAttribute("methodAnnotationNameRegex", ""); final String[] expected = { - buildMesssage("14:18: ", defaultTestClassName), + buildMesssage("14:18: ", + ".+Test\\d*|.+Tests\\d*|Test.+|Tests.+|.+IT|.+ITs|.+TestCase|.+TestCases"), }; verify(customConfig, getPath("InputNameConventionForJunit4TestClassesCheck1.java"), @@ -58,8 +56,16 @@ public void testAnnotatedClass() @Test public void testAnnotatedMethod() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(NameConventionForJunit4TestClassesCheck.class); + checkConfig.addAttribute("expectedClassNameRegex", + ".+Test\\d*|.+Tests\\d*|Test.+|Tests.+|.+IT|.+ITs|.+TestCase|.+TestCases"); + checkConfig.addAttribute("classAnnotationNameRegex", ""); + checkConfig.addAttribute("methodAnnotationNameRegex", "Test"); + final String[] expected = { - buildMesssage("8:18: ", defaultTestClassName), + buildMesssage("8:18: ", + ".+Test\\d*|.+Tests\\d*|Test.+|Tests.+|.+IT|.+ITs|.+TestCase|.+TestCases"), }; verify(checkConfig, getPath("InputNameConventionForJunit4TestClassesCheck2.java"), @@ -69,6 +75,13 @@ public void testAnnotatedMethod() @Test public void testClassIsNotTest() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(NameConventionForJunit4TestClassesCheck.class); + checkConfig.addAttribute("expectedClassNameRegex", + ".+Test\\d*|.+Tests\\d*|Test.+|Tests.+|.+IT|.+ITs|.+TestCase|.+TestCases"); + checkConfig.addAttribute("classAnnotationNameRegex", ""); + checkConfig.addAttribute("methodAnnotationNameRegex", "Test"); + final String[] expected = { }; @@ -79,8 +92,16 @@ public void testClassIsNotTest() @Test public void testRegex() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(NameConventionForJunit4TestClassesCheck.class); + checkConfig.addAttribute("expectedClassNameRegex", + ".+Test\\d*|.+Tests\\d*|Test.+|Tests.+|.+IT|.+ITs|.+TestCase|.+TestCases"); + checkConfig.addAttribute("classAnnotationNameRegex", ""); + checkConfig.addAttribute("methodAnnotationNameRegex", "Test"); + final String[] expected = { - buildMesssage("7:18: ", defaultTestClassName), + buildMesssage("7:18: ", + ".+Test\\d*|.+Tests\\d*|Test.+|Tests.+|.+IT|.+ITs|.+TestCase|.+TestCases"), }; verify(checkConfig, getPath("InputNameConventionForJunit4TestClassesCheck4.java"), @@ -91,10 +112,15 @@ public void testRegex() public void testQualifiedAnnotationName() throws Exception { final DefaultConfiguration customConfig = - buildConfiguration(defaultTestClassName, "", "org.junit.Test"); + createModuleConfig(NameConventionForJunit4TestClassesCheck.class); + customConfig.addAttribute("expectedClassNameRegex", + ".+Test\\d*|.+Tests\\d*|Test.+|Tests.+|.+IT|.+ITs|.+TestCase|.+TestCases"); + customConfig.addAttribute("classAnnotationNameRegex", ""); + customConfig.addAttribute("methodAnnotationNameRegex", "org.junit.Test"); final String[] expected = { - buildMesssage("8:18: ", defaultTestClassName), + buildMesssage("8:18: ", + ".+Test\\d*|.+Tests\\d*|Test.+|Tests.+|.+IT|.+ITs|.+TestCase|.+TestCases"), }; verify(customConfig, getPath("InputNameConventionForJunit4TestClassesCheck5.java"), @@ -105,10 +131,15 @@ public void testQualifiedAnnotationName() public void testJunitClassTestAnnotationNamesRegexOption() throws Exception { final DefaultConfiguration customConfig = - buildConfiguration(defaultTestClassName, "SomeTestAnnotation", ""); + createModuleConfig(NameConventionForJunit4TestClassesCheck.class); + customConfig.addAttribute("expectedClassNameRegex", + ".+Test\\d*|.+Tests\\d*|Test.+|Tests.+|.+IT|.+ITs|.+TestCase|.+TestCases"); + customConfig.addAttribute("classAnnotationNameRegex", "SomeTestAnnotation"); + customConfig.addAttribute("methodAnnotationNameRegex", ""); final String[] expected = { - buildMesssage("7:18: ", defaultTestClassName), + buildMesssage("7:18: ", + ".+Test\\d*|.+Tests\\d*|Test.+|Tests.+|.+IT|.+ITs|.+TestCase|.+TestCases"), }; verify(customConfig, getPath("InputNameConventionForJunit4TestClassesCheck6.java"), @@ -119,10 +150,15 @@ public void testJunitClassTestAnnotationNamesRegexOption() public void testJunitMethodTestAnnotationNamesRegexOption() throws Exception { final DefaultConfiguration customConfig = - buildConfiguration(defaultTestClassName, "", "SomeTestAnnotation"); + createModuleConfig(NameConventionForJunit4TestClassesCheck.class); + customConfig.addAttribute("expectedClassNameRegex", + ".+Test\\d*|.+Tests\\d*|Test.+|Tests.+|.+IT|.+ITs|.+TestCase|.+TestCases"); + customConfig.addAttribute("classAnnotationNameRegex", ""); + customConfig.addAttribute("methodAnnotationNameRegex", "SomeTestAnnotation"); final String[] expected = { - buildMesssage("6:18: ", defaultTestClassName), + buildMesssage("6:18: ", + ".+Test\\d*|.+Tests\\d*|Test.+|Tests.+|.+IT|.+ITs|.+TestCase|.+TestCases"), }; verify(customConfig, getPath("InputNameConventionForJunit4TestClassesCheck7.java"), @@ -133,7 +169,10 @@ public void testJunitMethodTestAnnotationNamesRegexOption() public void testCorrectTestClassNameRegexOption() throws Exception { final DefaultConfiguration customConfig = - buildConfiguration("Hello*", "", "Test"); + createModuleConfig(NameConventionForJunit4TestClassesCheck.class); + customConfig.addAttribute("expectedClassNameRegex", "Hello*"); + customConfig.addAttribute("classAnnotationNameRegex", ""); + customConfig.addAttribute("methodAnnotationNameRegex", "Test"); final String[] expected = { buildMesssage("5:14: ", "Hello*"), @@ -147,7 +186,10 @@ public void testCorrectTestClassNameRegexOption() public void testNullProperties() throws Exception { final DefaultConfiguration customConfig = - buildConfiguration(null, null, null); + createModuleConfig(NameConventionForJunit4TestClassesCheck.class); + customConfig.addAttribute("expectedClassNameRegex", null); + customConfig.addAttribute("classAnnotationNameRegex", null); + customConfig.addAttribute("methodAnnotationNameRegex", null); final String[] expected = {}; @@ -159,7 +201,10 @@ public void testNullProperties() public void testEmptyProperties() throws Exception { final DefaultConfiguration customConfig = - buildConfiguration("", "", ""); + createModuleConfig(NameConventionForJunit4TestClassesCheck.class); + customConfig.addAttribute("expectedClassNameRegex", ""); + customConfig.addAttribute("classAnnotationNameRegex", ""); + customConfig.addAttribute("methodAnnotationNameRegex", ""); final String[] expected = {}; @@ -167,18 +212,6 @@ public void testEmptyProperties() expected); } - private static DefaultConfiguration buildConfiguration(String expectedNameRegex, - String classAnnotationNameRegex, String methodAnnotationNameRegex) { - final DefaultConfiguration config = - createCheckConfig(NameConventionForJunit4TestClassesCheck.class); - - config.addAttribute("expectedClassNameRegex", expectedNameRegex); - config.addAttribute("classAnnotationNameRegex", classAnnotationNameRegex); - config.addAttribute("methodAnnotationNameRegex", methodAnnotationNameRegex); - - return config; - } - 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 0f10cfd600..8c687ff1dc 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 @@ -33,7 +33,7 @@ public class NoNullForCollectionReturnCheckTest extends BaseCheckTestSupport { @Test public void testArraysNotDeep() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(NoNullForCollectionReturnCheck.class); + createModuleConfig(NoNullForCollectionReturnCheck.class); final String[] expected = { "11: " + warningMessage, "46: " + warningMessage, @@ -47,7 +47,7 @@ public void testArraysNotDeep() throws Exception { @Test public void testArraysDeep() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(NoNullForCollectionReturnCheck.class); + createModuleConfig(NoNullForCollectionReturnCheck.class); checkConfig.addAttribute("searchThroughMethodBody", "true"); final String[] expected = { "11: " + warningMessage, @@ -63,10 +63,9 @@ 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"; - checkConfig.addAttribute("collectionList", listOfCollecton); + createModuleConfig(NoNullForCollectionReturnCheck.class); + checkConfig.addAttribute("collectionList", + "Collection ArrayList LinkedList Stack Vector HashSet TreeSet"); final String[] expected = { "7: " + warningMessage, "17: " + warningMessage, @@ -83,7 +82,7 @@ public void testCollections() throws Exception { @Test public void testRevereCode() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(NoNullForCollectionReturnCheck.class); + createModuleConfig(NoNullForCollectionReturnCheck.class); final String[] expected = { "13: " + warningMessage, "16: " + warningMessage, @@ -95,7 +94,7 @@ public void testRevereCode() throws Exception { @Test public void testRevereCodeDeep() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(NoNullForCollectionReturnCheck.class); + createModuleConfig(NoNullForCollectionReturnCheck.class); checkConfig.addAttribute("searchThroughMethodBody", "true"); final String[] expected = { "13: " + warningMessage, @@ -108,7 +107,7 @@ public void testRevereCodeDeep() throws Exception { @Test public void testInterface() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(NoNullForCollectionReturnCheck.class); + createModuleConfig(NoNullForCollectionReturnCheck.class); final String[] expected = { }; @@ -118,7 +117,7 @@ public void testInterface() throws Exception { @Test public void testInnerClasses() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(NoNullForCollectionReturnCheck.class); + createModuleConfig(NoNullForCollectionReturnCheck.class); final String[] expected = { "17: " + warningMessage, "25: " + warningMessage, @@ -132,7 +131,7 @@ public void testInnerClasses() throws Exception { @Test public void testRealCode() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(NoNullForCollectionReturnCheck.class); + createModuleConfig(NoNullForCollectionReturnCheck.class); checkConfig.addAttribute("searchThroughMethodBody", "true"); final String[] expected = { }; @@ -144,7 +143,7 @@ public void testRealCode() throws Exception { public void testIss148() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(NoNullForCollectionReturnCheck.class); + createModuleConfig(NoNullForCollectionReturnCheck.class); final String[] expected = { "8: " + warningMessage, }; @@ -156,7 +155,7 @@ public void testIss148() public void testIss148Deep() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(NoNullForCollectionReturnCheck.class); + createModuleConfig(NoNullForCollectionReturnCheck.class); checkConfig.addAttribute("searchThroughMethodBody", "true"); final String[] expected = { "8: " + warningMessage, @@ -169,7 +168,7 @@ public void testIss148Deep() public void testConstructor() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(NoNullForCollectionReturnCheck.class); + createModuleConfig(NoNullForCollectionReturnCheck.class); final String[] expected = { "5: " + warningMessage, }; 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 b5e308265c..0cd959d943 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 @@ -47,7 +47,7 @@ public class NumericLiteralNeedsUnderscoreCheckTest extends BaseCheckTestSupport @Test public void test() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(NumericLiteralNeedsUnderscoreCheck.class); + createModuleConfig(NumericLiteralNeedsUnderscoreCheck.class); final String[] expected = { "27: " + warningMessage, "28: " + warningMessage, @@ -89,7 +89,7 @@ public void test() throws Exception { @Test public void testWithConfig() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(NumericLiteralNeedsUnderscoreCheck.class); + createModuleConfig(NumericLiteralNeedsUnderscoreCheck.class); checkConfig.addAttribute("minDecimalSymbolLength", "1"); checkConfig.addAttribute("maxDecimalSymbolsUntilUnderscore", "3"); checkConfig.addAttribute("minHexSymbolLength", "1"); @@ -130,7 +130,7 @@ public void testWithConfig() throws Exception { @Test public void testIgnore() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(NumericLiteralNeedsUnderscoreCheck.class); + createModuleConfig(NumericLiteralNeedsUnderscoreCheck.class); final String[] expected = { "7: " + warningMessage, "8: " + warningMessage, @@ -155,7 +155,7 @@ public void testIgnore() throws Exception { @Test public void testConfiguredIgnore() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(NumericLiteralNeedsUnderscoreCheck.class); + createModuleConfig(NumericLiteralNeedsUnderscoreCheck.class); checkConfig.addAttribute("ignoreFieldNamePattern", "RED"); checkConfig.addAttribute("minDecimalSymbolLength", "1"); 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 2854a391dc..dbe1539515 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,11 +33,10 @@ 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); - @Test public final void revereCodeTest() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(OverridableMethodInConstructorCheck.class); checkConfig.addAttribute("checkCloneMethod", "false"); checkConfig.addAttribute("checkReadObjectMethod", "false"); checkConfig.addAttribute("matchMethodsByArgCount", "true"); @@ -51,6 +50,8 @@ public final void revereCodeTest() throws Exception { @Test public final void newFeauture() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(OverridableMethodInConstructorCheck.class); checkConfig.addAttribute("checkCloneMethod", "true"); checkConfig.addAttribute("checkReadObjectMethod", "true"); checkConfig.addAttribute("matchMethodsByArgCount", "true"); @@ -65,6 +66,8 @@ public final void newFeauture() throws Exception { @Test public final void newFeautureWithoutMethodsByArgCount() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(OverridableMethodInConstructorCheck.class); checkConfig.addAttribute("checkCloneMethod", "true"); checkConfig.addAttribute("checkReadObjectMethod", "true"); checkConfig.addAttribute("matchMethodsByArgCount", "false"); @@ -78,6 +81,8 @@ public final void newFeautureWithoutMethodsByArgCount() throws Exception { @Test public final void testNoWarnings() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(OverridableMethodInConstructorCheck.class); checkConfig.addAttribute("checkCloneMethod", "true"); checkConfig.addAttribute("checkReadObjectMethod", "true"); checkConfig.addAttribute("matchMethodsByArgCount", "true"); @@ -89,6 +94,8 @@ public final void testNoWarnings() throws Exception { @Test public final void testWarning() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(OverridableMethodInConstructorCheck.class); checkConfig.addAttribute("checkCloneMethod", "true"); checkConfig.addAttribute("checkReadObjectMethod", "true"); checkConfig.addAttribute("matchMethodsByArgCount", "false"); @@ -102,6 +109,8 @@ public final void testWarning() throws Exception { @Test public final void test2WarningsIn2Ctors() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(OverridableMethodInConstructorCheck.class); checkConfig.addAttribute("checkCloneMethod", "true"); checkConfig.addAttribute("checkReadObjectMethod", "true"); checkConfig.addAttribute("matchMethodsByArgCount", "true"); @@ -117,6 +126,8 @@ public final void test2WarningsIn2Ctors() throws Exception { @Test public final void testWarningInSecondDepth() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(OverridableMethodInConstructorCheck.class); checkConfig.addAttribute("checkCloneMethod", "true"); checkConfig.addAttribute("checkReadObjectMethod", "true"); checkConfig.addAttribute("matchMethodsByArgCount", "true"); @@ -130,6 +141,8 @@ public final void testWarningInSecondDepth() throws Exception { @Test public final void testWarningsInThirdDepth() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(OverridableMethodInConstructorCheck.class); checkConfig.addAttribute("checkCloneMethod", "true"); checkConfig.addAttribute("checkReadObjectMethod", "true"); checkConfig.addAttribute("matchMethodsByArgCount", "true"); @@ -144,6 +157,8 @@ public final void testWarningsInThirdDepth() throws Exception { @Test public final void testCloneNoWarningsSimple() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(OverridableMethodInConstructorCheck.class); checkConfig.addAttribute("checkCloneMethod", "true"); checkConfig.addAttribute("checkReadObjectMethod", "true"); checkConfig.addAttribute("matchMethodsByArgCount", "true"); @@ -155,6 +170,8 @@ public final void testCloneNoWarningsSimple() throws Exception { @Test public final void testCloneNoWarnings() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(OverridableMethodInConstructorCheck.class); checkConfig.addAttribute("checkCloneMethod", "true"); checkConfig.addAttribute("checkReadObjectMethod", "true"); checkConfig.addAttribute("matchMethodsByArgCount", "true"); @@ -166,6 +183,8 @@ public final void testCloneNoWarnings() throws Exception { @Test public final void testCloneWarnings() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(OverridableMethodInConstructorCheck.class); checkConfig.addAttribute("checkCloneMethod", "true"); checkConfig.addAttribute("checkReadObjectMethod", "true"); checkConfig.addAttribute("matchMethodsByArgCount", "true"); @@ -180,6 +199,8 @@ public final void testCloneWarnings() throws Exception { @Test public final void testCloneSecondDepth() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(OverridableMethodInConstructorCheck.class); checkConfig.addAttribute("checkCloneMethod", "true"); checkConfig.addAttribute("checkReadObjectMethod", "true"); checkConfig.addAttribute("matchMethodsByArgCount", "true"); @@ -194,6 +215,8 @@ public final void testCloneSecondDepth() throws Exception { @Test public final void testCloneThirdDepthImplementation() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(OverridableMethodInConstructorCheck.class); checkConfig.addAttribute("checkCloneMethod", "true"); checkConfig.addAttribute("checkReadObjectMethod", "true"); checkConfig.addAttribute("matchMethodsByArgCount", "true"); @@ -211,6 +234,8 @@ public final void testCloneThirdDepthImplementation() throws Exception { @Test public final void testSerializableNoWarnings() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(OverridableMethodInConstructorCheck.class); checkConfig.addAttribute("checkCloneMethod", "true"); checkConfig.addAttribute("checkReadObjectMethod", "true"); checkConfig.addAttribute("matchMethodsByArgCount", "true"); @@ -222,6 +247,8 @@ public final void testSerializableNoWarnings() throws Exception { @Test public final void testSerializableWarning() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(OverridableMethodInConstructorCheck.class); checkConfig.addAttribute("checkCloneMethod", "true"); checkConfig.addAttribute("checkReadObjectMethod", "true"); checkConfig.addAttribute("matchMethodsByArgCount", "true"); @@ -235,6 +262,8 @@ public final void testSerializableWarning() throws Exception { @Test public final void testStaticModifiers() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(OverridableMethodInConstructorCheck.class); checkConfig.addAttribute("checkCloneMethod", "true"); checkConfig.addAttribute("checkReadObjectMethod", "true"); checkConfig.addAttribute("matchMethodsByArgCount", "true"); @@ -248,6 +277,8 @@ public final void testStaticModifiers() throws Exception { @Test public final void testSerializableThirdDepthImplementation() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(OverridableMethodInConstructorCheck.class); checkConfig.addAttribute("checkCloneMethod", "true"); checkConfig.addAttribute("checkReadObjectMethod", "true"); checkConfig.addAttribute("matchMethodsByArgCount", "true"); @@ -269,6 +300,8 @@ public final void testSerializableThirdDepthImplementation() @Test public final void testCtorOverloadedMethods() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(OverridableMethodInConstructorCheck.class); checkConfig.addAttribute("checkCloneMethod", "true"); checkConfig.addAttribute("checkReadObjectMethod", "true"); checkConfig.addAttribute("matchMethodsByArgCount", "true"); @@ -280,6 +313,8 @@ public final void testCtorOverloadedMethods() throws Exception { @Test public final void test2EqualMethodNamesWithNoWarning() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(OverridableMethodInConstructorCheck.class); checkConfig.addAttribute("checkCloneMethod", "true"); checkConfig.addAttribute("checkReadObjectMethod", "true"); checkConfig.addAttribute("matchMethodsByArgCount", "true"); @@ -291,6 +326,8 @@ public final void test2EqualMethodNamesWithNoWarning() throws Exception { @Test public final void test2EqualMethodNamesWithoutWarning2() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(OverridableMethodInConstructorCheck.class); checkConfig.addAttribute("checkCloneMethod", "true"); checkConfig.addAttribute("checkReadObjectMethod", "true"); checkConfig.addAttribute("matchMethodsByArgCount", "true"); @@ -305,6 +342,8 @@ public final void test2EqualMethodNamesWithoutWarning2() throws Exception { @Test public final void testCallMethodIsNotInBuildPath2() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(OverridableMethodInConstructorCheck.class); checkConfig.addAttribute("checkCloneMethod", "true"); checkConfig.addAttribute("checkReadObjectMethod", "true"); checkConfig.addAttribute("matchMethodsByArgCount", "true"); @@ -316,6 +355,8 @@ public final void testCallMethodIsNotInBuildPath2() throws Exception { @Test public final void testCallMethodIsNotInBuildPath() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(OverridableMethodInConstructorCheck.class); checkConfig.addAttribute("checkCloneMethod", "true"); checkConfig.addAttribute("checkReadObjectMethod", "true"); checkConfig.addAttribute("matchMethodsByArgCount", "true"); @@ -327,6 +368,8 @@ public final void testCallMethodIsNotInBuildPath() throws Exception { @Test public final void testReadObjectInInterface() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(OverridableMethodInConstructorCheck.class); checkConfig.addAttribute("checkCloneMethod", "true"); checkConfig.addAttribute("checkReadObjectMethod", "true"); checkConfig.addAttribute("matchMethodsByArgCount", "true"); @@ -338,6 +381,8 @@ public final void testReadObjectInInterface() throws Exception { @Test public final void testStackOverFlowError() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(OverridableMethodInConstructorCheck.class); checkConfig.addAttribute("checkCloneMethod", "true"); checkConfig.addAttribute("checkReadObjectMethod", "true"); checkConfig.addAttribute("matchMethodsByArgCount", "true"); @@ -349,6 +394,8 @@ public final void testStackOverFlowError() throws Exception { @Test public final void testStackOverFlowErrorWithWarning() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(OverridableMethodInConstructorCheck.class); checkConfig.addAttribute("checkCloneMethod", "true"); checkConfig.addAttribute("checkReadObjectMethod", "true"); checkConfig.addAttribute("matchMethodsByArgCount", "true"); @@ -362,6 +409,8 @@ public final void testStackOverFlowErrorWithWarning() throws Exception { @Test public final void testStackOverFlowErrorWithoutWarning() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(OverridableMethodInConstructorCheck.class); checkConfig.addAttribute("checkCloneMethod", "true"); checkConfig.addAttribute("checkReadObjectMethod", "true"); checkConfig.addAttribute("matchMethodsByArgCount", "true"); @@ -373,6 +422,8 @@ public final void testStackOverFlowErrorWithoutWarning() throws Exception { @Test public final void testAbstractMethodCall() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(OverridableMethodInConstructorCheck.class); checkConfig.addAttribute("checkCloneMethod", "true"); checkConfig.addAttribute("checkReadObjectMethod", "true"); checkConfig.addAttribute("matchMethodsByArgCount", "true"); @@ -386,6 +437,8 @@ public final void testAbstractMethodCall() throws Exception { @Test public final void testFinalClass() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(OverridableMethodInConstructorCheck.class); checkConfig.addAttribute("checkCloneMethod", "true"); checkConfig.addAttribute("checkReadObjectMethod", "true"); checkConfig.addAttribute("matchMethodsByArgCount", "true"); 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 4689cd800c..7d5e2348a2 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 @@ -34,7 +34,7 @@ public class RedundantReturnCheckTest extends BaseCheckTestSupport { @Test public void testInputWithIgnoreEmptyConstructorsTrue() throws Exception { - final DefaultConfiguration checkConfig = createCheckConfig(RedundantReturnCheck.class); + final DefaultConfiguration checkConfig = createModuleConfig(RedundantReturnCheck.class); checkConfig.addAttribute("allowReturnInEmptyMethodsAndConstructors", "false"); @@ -63,7 +63,7 @@ public void testInputWithIgnoreEmptyConstructorsTrue() @Test public void testInputWithIgnoreEmptyConstructorsFalse() throws Exception { - final DefaultConfiguration checkConfig = createCheckConfig(RedundantReturnCheck.class); + final DefaultConfiguration checkConfig = createModuleConfig(RedundantReturnCheck.class); checkConfig.addAttribute("allowReturnInEmptyMethodsAndConstructors", "true"); @@ -90,7 +90,7 @@ public void testInputWithIgnoreEmptyConstructorsFalse() @Test public void testForNullPointerExceptionsPresence() throws Exception { - final DefaultConfiguration checkConfig = createCheckConfig(RedundantReturnCheck.class); + final DefaultConfiguration checkConfig = createModuleConfig(RedundantReturnCheck.class); final String[] expected = {}; @@ -102,7 +102,7 @@ public void testForNullPointerExceptionsPresence() @Test public void testForNullPointerExceptionsInInterface() throws Exception { - final DefaultConfiguration checkConfig = createCheckConfig(RedundantReturnCheck.class); + final DefaultConfiguration checkConfig = createModuleConfig(RedundantReturnCheck.class); final String[] expected = {}; @@ -113,7 +113,7 @@ public void testForNullPointerExceptionsInInterface() @Test public void testSomeFalsePositiveCase() throws Exception { - final DefaultConfiguration checkConfig = createCheckConfig(RedundantReturnCheck.class); + final DefaultConfiguration checkConfig = createModuleConfig(RedundantReturnCheck.class); final String[] expected = {}; 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 8e8916569f..f6cf7a19cd 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 @@ -35,7 +35,7 @@ public class RequireFailForTryCatchInJunitCheckTest extends BaseCheckTestSupport @Test public void testIndifferent1() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(RequireFailForTryCatchInJunitCheck.class); + createModuleConfig(RequireFailForTryCatchInJunitCheck.class); final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputRequireFailForTryCatchInJunitCheck1.java"), expected); } @@ -43,7 +43,7 @@ public void testIndifferent1() throws Exception { @Test public void testIndifferent2() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(RequireFailForTryCatchInJunitCheck.class); + createModuleConfig(RequireFailForTryCatchInJunitCheck.class); final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputRequireFailForTryCatchInJunitCheck2.java"), expected); } @@ -51,7 +51,7 @@ public void testIndifferent2() throws Exception { @Test public void testBad1() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(RequireFailForTryCatchInJunitCheck.class); + createModuleConfig(RequireFailForTryCatchInJunitCheck.class); final String[] expected = { "8:9: " + getCheckMessage(MSG_KEY), "12:9: " + getCheckMessage(MSG_KEY), @@ -73,7 +73,7 @@ public void testBad1() throws Exception { @Test public void testBad2() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(RequireFailForTryCatchInJunitCheck.class); + createModuleConfig(RequireFailForTryCatchInJunitCheck.class); final String[] expected = { "9:9: " + getCheckMessage(MSG_KEY), "14:9: " + getCheckMessage(MSG_KEY), @@ -84,7 +84,7 @@ public void testBad2() throws Exception { @Test public void testGood() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(RequireFailForTryCatchInJunitCheck.class); + createModuleConfig(RequireFailForTryCatchInJunitCheck.class); final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputRequireFailForTryCatchInJunitCheck5.java"), expected); } 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 fb5217fdab..b79aa35bd0 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 @@ -33,7 +33,7 @@ public class ReturnBooleanFromTernaryCheckTest extends BaseCheckTestSupport { @Test public void testDefault() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(ReturnBooleanFromTernaryCheck.class); + createModuleConfig(ReturnBooleanFromTernaryCheck.class); final String[] expected = { "6:35: " + warninigMessage, "7:38: " + warninigMessage, 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 5fa5658fa0..b64561fe1a 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,11 +30,10 @@ public class ReturnCountExtendedCheckTest extends BaseCheckTestSupport { - private final DefaultConfiguration checkConfig = - createCheckConfig(ReturnCountExtendedCheck.class); - @Test public void testNullOnIgnoreMethodsNames() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(ReturnCountExtendedCheck.class); checkConfig.addAttribute("maxReturnCount", "99"); checkConfig.addAttribute("ignoreMethodLinesCount", "99"); checkConfig.addAttribute("minIgnoreReturnDepth", "99"); @@ -49,7 +48,8 @@ public void testNullOnIgnoreMethodsNames() throws Exception { @Test public void testMethodsMaxReturnLiteralsIsOne() throws Exception { - + final DefaultConfiguration checkConfig = + createModuleConfig(ReturnCountExtendedCheck.class); checkConfig.addAttribute("maxReturnCount", "1"); checkConfig.addAttribute("ignoreMethodLinesCount", "0"); checkConfig.addAttribute("minIgnoreReturnDepth", "5"); @@ -69,7 +69,8 @@ public void testMethodsMaxReturnLiteralsIsOne() throws Exception { @Test public void testMethodsMaxReturnLiteralsIsTwo() throws Exception { - + final DefaultConfiguration checkConfig = + createModuleConfig(ReturnCountExtendedCheck.class); checkConfig.addAttribute("maxReturnCount", "2"); checkConfig.addAttribute("ignoreMethodLinesCount", "0"); checkConfig.addAttribute("minIgnoreReturnDepth", "5"); @@ -87,6 +88,8 @@ public void testMethodsMaxReturnLiteralsIsTwo() throws Exception { @Test public void testIgnoreEmptyReturns() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(ReturnCountExtendedCheck.class); checkConfig.addAttribute("maxReturnCount", "2"); checkConfig.addAttribute("ignoreMethodLinesCount", "0"); checkConfig.addAttribute("minIgnoreReturnDepth", "5"); @@ -103,7 +106,8 @@ public void testIgnoreEmptyReturns() throws Exception { @Test public void testConstructorsMaxReturnLiteralsIsOne() throws Exception { - + final DefaultConfiguration checkConfig = + createModuleConfig(ReturnCountExtendedCheck.class); checkConfig.addAttribute("maxReturnCount", "1"); checkConfig.addAttribute("ignoreMethodLinesCount", "0"); checkConfig.addAttribute("minIgnoreReturnDepth", "5"); @@ -121,7 +125,8 @@ public void testConstructorsMaxReturnLiteralsIsOne() throws Exception { @Test public void testignoreMethodLinesCount() throws Exception { - + final DefaultConfiguration checkConfig = + createModuleConfig(ReturnCountExtendedCheck.class); checkConfig.addAttribute("maxReturnCount", "1"); checkConfig.addAttribute("ignoreMethodLinesCount", "10"); checkConfig.addAttribute("minIgnoreReturnDepth", "5"); @@ -139,6 +144,8 @@ public void testignoreMethodLinesCount() throws Exception { @Test public void testignoreMethodLinesCount2() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(ReturnCountExtendedCheck.class); checkConfig.addAttribute("maxReturnCount", "1"); checkConfig.addAttribute("ignoreMethodLinesCount", "20"); checkConfig.addAttribute("minIgnoreReturnDepth", "5"); @@ -155,6 +162,8 @@ public void testignoreMethodLinesCount2() throws Exception { @Test public void testminIgnoreReturnDepth() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(ReturnCountExtendedCheck.class); checkConfig.addAttribute("maxReturnCount", "0"); checkConfig.addAttribute("ignoreMethodLinesCount", "0"); checkConfig.addAttribute("minIgnoreReturnDepth", "1"); @@ -173,6 +182,8 @@ public void testminIgnoreReturnDepth() throws Exception { @Test public void testIgnoreNonEmptyReturns() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(ReturnCountExtendedCheck.class); checkConfig.addAttribute("maxReturnCount", "1"); checkConfig.addAttribute("ignoreMethodLinesCount", "0"); checkConfig.addAttribute("minIgnoreReturnDepth", "5"); @@ -190,6 +201,8 @@ public void testIgnoreNonEmptyReturns() throws Exception { @Test public void testMethodsInMethods() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(ReturnCountExtendedCheck.class); checkConfig.addAttribute("maxReturnCount", "1"); checkConfig.addAttribute("ignoreMethodLinesCount", "0"); checkConfig.addAttribute("minIgnoreReturnDepth", "5"); @@ -206,6 +219,8 @@ public void testMethodsInMethods() throws Exception { @Test public void testIgnoreMethodsNamesProperty() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(ReturnCountExtendedCheck.class); checkConfig.addAttribute("maxReturnCount", "1"); checkConfig.addAttribute("ignoreMethodLinesCount", "0"); checkConfig.addAttribute("minIgnoreReturnDepth", "5"); @@ -224,6 +239,8 @@ public void testIgnoreMethodsNamesProperty() throws Exception { @Test public void testRegexIgnoreMethodsNamesProperty() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(ReturnCountExtendedCheck.class); checkConfig.addAttribute("maxReturnCount", "1"); checkConfig.addAttribute("ignoreMethodLinesCount", "0"); checkConfig.addAttribute("minIgnoreReturnDepth", "5"); @@ -242,6 +259,8 @@ public void testRegexIgnoreMethodsNamesProperty() throws Exception { @Test public void testAnonymousClass() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(ReturnCountExtendedCheck.class); checkConfig.addAttribute("maxReturnCount", "1"); checkConfig.addAttribute("ignoreMethodLinesCount", "0"); checkConfig.addAttribute("minIgnoreReturnDepth", "99"); @@ -259,6 +278,8 @@ public void testAnonymousClass() throws Exception { @Test public void testLambda() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(ReturnCountExtendedCheck.class); checkConfig.addAttribute("maxReturnCount", "1"); checkConfig.addAttribute("ignoreMethodLinesCount", "0"); checkConfig.addAttribute("minIgnoreReturnDepth", "99"); 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 9bb3c490b7..8b8d278516 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 @@ -37,7 +37,7 @@ public class ReturnNullInsteadOfBooleanCheckTest extends BaseCheckTestSupport { @Test public void testDefault() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(ReturnNullInsteadOfBooleanCheck.class); + createModuleConfig(ReturnNullInsteadOfBooleanCheck.class); final String[] expected = { "11:9: " + warningMessage, "22:25: " + warningMessage, 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 9dadb49852..404c55be15 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 @@ -35,7 +35,7 @@ public class SimpleAccessorNameNotationCheckTest extends BaseCheckTestSupport { @Test public void test() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(SimpleAccessorNameNotationCheck.class); + createModuleConfig(SimpleAccessorNameNotationCheck.class); checkConfig.addAttribute("prefix", "m"); @@ -54,7 +54,7 @@ public void test() throws Exception { @Test public void correctWithoutPrefix() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(SimpleAccessorNameNotationCheck.class); + createModuleConfig(SimpleAccessorNameNotationCheck.class); final String[] expected = { "17: " + warningSetterMessage, "22: " + warningGetterMessage, @@ -65,7 +65,7 @@ public void correctWithoutPrefix() throws Exception { @Test public void correctWithtPrefix() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(SimpleAccessorNameNotationCheck.class); + createModuleConfig(SimpleAccessorNameNotationCheck.class); checkConfig.addAttribute("prefix", "m"); final String[] expected = { "7: " + warningSetterMessage, @@ -77,7 +77,7 @@ public void correctWithtPrefix() throws Exception { @Test public void partlyWithoutPrefix() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(SimpleAccessorNameNotationCheck.class); + createModuleConfig(SimpleAccessorNameNotationCheck.class); final String[] expected = { "15: " + warningGetterMessage, "20: " + warningSetterMessage, @@ -92,7 +92,7 @@ public void partlyWithoutPrefix() throws Exception { @Test public void partlyWithPrefix() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(SimpleAccessorNameNotationCheck.class); + createModuleConfig(SimpleAccessorNameNotationCheck.class); checkConfig.addAttribute("prefix", "m"); final String[] expected = { "10: " + warningSetterMessage, @@ -108,7 +108,7 @@ public void partlyWithPrefix() throws Exception { @Test public void errorsWithoutPrefix() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(SimpleAccessorNameNotationCheck.class); + createModuleConfig(SimpleAccessorNameNotationCheck.class); final String[] expected = { "7: " + warningSetterMessage, "12: " + warningGetterMessage, @@ -121,7 +121,7 @@ public void errorsWithoutPrefix() throws Exception { @Test public void errorsWithPrefix() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(SimpleAccessorNameNotationCheck.class); + createModuleConfig(SimpleAccessorNameNotationCheck.class); checkConfig.addAttribute("prefix", "m"); final String[] expected = { "7: " + warningSetterMessage, @@ -135,7 +135,7 @@ public void errorsWithPrefix() throws Exception { @Test public void cleanWithoutPrefix() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(SimpleAccessorNameNotationCheck.class); + createModuleConfig(SimpleAccessorNameNotationCheck.class); final String[] expected = {}; verify(checkConfig, getPath("InputSimpleAccessorNameNotationCheck4.java"), expected); } @@ -143,7 +143,7 @@ public void cleanWithoutPrefix() throws Exception { @Test public void cleanWithPrefix() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(SimpleAccessorNameNotationCheck.class); + createModuleConfig(SimpleAccessorNameNotationCheck.class); checkConfig.addAttribute("prefix", "m"); final String[] expected = {}; verify(checkConfig, getPath("InputSimpleAccessorNameNotationCheck4.java"), expected); @@ -152,7 +152,7 @@ public void cleanWithPrefix() throws Exception { @Test public void testBoolean() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(SimpleAccessorNameNotationCheck.class); + createModuleConfig(SimpleAccessorNameNotationCheck.class); final String[] expected = { "28: " + warningSetterMessage, "33: " + warningGetterMessage, @@ -163,7 +163,7 @@ public void testBoolean() throws Exception { @Test public void testAnonymousCases() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(SimpleAccessorNameNotationCheck.class); + createModuleConfig(SimpleAccessorNameNotationCheck.class); final String[] expected = {}; verify(checkConfig, getPath("InputSimpleAccessorNameNotationCheck6.java"), expected); } @@ -171,7 +171,7 @@ public void testAnonymousCases() throws Exception { @Test public void testInterface() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(SimpleAccessorNameNotationCheck.class); + createModuleConfig(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 8b8e4c24ed..3ee69687b1 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 @@ -40,7 +40,7 @@ public class SingleBreakOrContinueCheckTest extends BaseCheckTestSupport { public void testDefault() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(SingleBreakOrContinueCheck.class); + createModuleConfig(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 fbd26f4809..79d60ea128 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,30 +33,26 @@ */ public class TernaryPerExpressionCountCheckTest extends BaseCheckTestSupport { - private final DefaultConfiguration checkConfig = - createCheckConfig(TernaryPerExpressionCountCheck.class); - @Test public void testWithDefaultTernaryPerExpressionCountValue() throws Exception { - final int maxTernaryOperatorsCount = 1; - final boolean ternaryInBraces = true; - final boolean oneLine = true; + final DefaultConfiguration checkConfig = + createModuleConfig(TernaryPerExpressionCountCheck.class); checkConfig.addAttribute("ignoreTernaryOperatorsInBraces", - Boolean.toString(ternaryInBraces)); + "true"); checkConfig.addAttribute("ignoreIsolatedTernaryOnLine", - Boolean.toString(oneLine)); + "true"); checkConfig.addAttribute("maxTernaryPerExpressionCount", - Integer.toString(maxTernaryOperatorsCount)); + "1"); final String[] expected = { - "14:26: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "18:32: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "20:33: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "21:26: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "25:56: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "26:50: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "30:47: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "47:36: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), + "14:26: " + getCheckMessage(MSG_KEY, 1), + "18:32: " + getCheckMessage(MSG_KEY, 1), + "20:33: " + getCheckMessage(MSG_KEY, 1), + "21:26: " + getCheckMessage(MSG_KEY, 1), + "25:56: " + getCheckMessage(MSG_KEY, 1), + "26:50: " + getCheckMessage(MSG_KEY, 1), + "30:47: " + getCheckMessage(MSG_KEY, 1), + "47:36: " + getCheckMessage(MSG_KEY, 1), }; verify(checkConfig, getPath("InputTernaryPerExpressionCountCheck.java"), expected); @@ -65,15 +61,14 @@ public void testWithDefaultTernaryPerExpressionCountValue() @Test public void testWithNegativeTernaryPerExpressionCountValue() throws Exception { - final int maxTernaryOperatorsCount = -1; - final boolean ternaryInBraces = true; - final boolean oneLine = false; + final DefaultConfiguration checkConfig = + createModuleConfig(TernaryPerExpressionCountCheck.class); checkConfig.addAttribute("ignoreTernaryOperatorsInBraces", - Boolean.toString(ternaryInBraces)); + "true"); checkConfig.addAttribute("ignoreIsolatedTernaryOnLine", - Boolean.toString(oneLine)); + "false"); checkConfig.addAttribute("maxTernaryPerExpressionCount", - Integer.toString(maxTernaryOperatorsCount)); + "-1"); final String[] expected = {}; try { @@ -95,46 +90,44 @@ public void testWithNegativeTernaryPerExpressionCountValue() @Test public void testWithDifferentTernaryPerExpressionCountValue() throws Exception { - final boolean ternaryInBraces = true; - final boolean oneLine = false; - final int maxTernaryOperatorsCount = 2; + final DefaultConfiguration checkConfig = + createModuleConfig(TernaryPerExpressionCountCheck.class); checkConfig.addAttribute("ignoreTernaryOperatorsInBraces", - Boolean.toString(ternaryInBraces)); + "true"); checkConfig.addAttribute("ignoreIsolatedTernaryOnLine", - Boolean.toString(oneLine)); + "false"); checkConfig.addAttribute("maxTernaryPerExpressionCount", - Integer.toString(maxTernaryOperatorsCount)); - final String[] expected = {"14:26: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount)}; + "2"); + final String[] expected = {"14:26: " + getCheckMessage(MSG_KEY, 2)}; verify(checkConfig, getPath("InputTernaryPerExpressionCountCheck.java"), expected); } @Test public void testWithZeroValue() throws Exception { - final boolean ternaryInBraces = false; - final boolean oneLine = true; - final int maxTernaryOperatorsCount = 0; + final DefaultConfiguration checkConfig = + createModuleConfig(TernaryPerExpressionCountCheck.class); checkConfig.addAttribute("ignoreTernaryOperatorsInBraces", - Boolean.toString(ternaryInBraces)); + "false"); checkConfig.addAttribute("ignoreIsolatedTernaryOnLine", - Boolean.toString(oneLine)); + "true"); checkConfig.addAttribute("maxTernaryPerExpressionCount", - Integer.toString(maxTernaryOperatorsCount)); + "0"); final String[] expected = { - "14:26: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "18:32: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "20:33: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "21:26: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "25:56: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "26:50: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "30:47: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "31:52: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "35:38: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "36:38: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "37:31: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "38:23: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "47:36: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "101:48: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), + "14:26: " + getCheckMessage(MSG_KEY, 0), + "18:32: " + getCheckMessage(MSG_KEY, 0), + "20:33: " + getCheckMessage(MSG_KEY, 0), + "21:26: " + getCheckMessage(MSG_KEY, 0), + "25:56: " + getCheckMessage(MSG_KEY, 0), + "26:50: " + getCheckMessage(MSG_KEY, 0), + "30:47: " + getCheckMessage(MSG_KEY, 0), + "31:52: " + getCheckMessage(MSG_KEY, 0), + "35:38: " + getCheckMessage(MSG_KEY, 0), + "36:38: " + getCheckMessage(MSG_KEY, 0), + "37:31: " + getCheckMessage(MSG_KEY, 0), + "38:23: " + getCheckMessage(MSG_KEY, 0), + "47:36: " + getCheckMessage(MSG_KEY, 0), + "101:48: " + getCheckMessage(MSG_KEY, 0), }; verify(checkConfig, getPath("InputTernaryPerExpressionCountCheck.java"), expected); @@ -142,28 +135,27 @@ public void testWithZeroValue() throws Exception { @Test public void testWithoutIgnoringExpressionInBraces() throws Exception { - final boolean ternaryInBraces = false; - final boolean oneLine = true; - final int maxTernaryOperatorsCount = 1; + final DefaultConfiguration checkConfig = + createModuleConfig(TernaryPerExpressionCountCheck.class); checkConfig.addAttribute("ignoreTernaryOperatorsInBraces", - Boolean.toString(ternaryInBraces)); + "false"); checkConfig.addAttribute("ignoreIsolatedTernaryOnLine", - Boolean.toString(oneLine)); + "true"); final String[] expected = { - "14:26: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "18:32: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "20:33: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "21:26: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "25:56: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "26:50: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "30:47: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "31:52: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "35:38: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "36:38: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "37:31: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "38:23: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "47:36: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "101:48: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), + "14:26: " + getCheckMessage(MSG_KEY, 1), + "18:32: " + getCheckMessage(MSG_KEY, 1), + "20:33: " + getCheckMessage(MSG_KEY, 1), + "21:26: " + getCheckMessage(MSG_KEY, 1), + "25:56: " + getCheckMessage(MSG_KEY, 1), + "26:50: " + getCheckMessage(MSG_KEY, 1), + "30:47: " + getCheckMessage(MSG_KEY, 1), + "31:52: " + getCheckMessage(MSG_KEY, 1), + "35:38: " + getCheckMessage(MSG_KEY, 1), + "36:38: " + getCheckMessage(MSG_KEY, 1), + "37:31: " + getCheckMessage(MSG_KEY, 1), + "38:23: " + getCheckMessage(MSG_KEY, 1), + "47:36: " + getCheckMessage(MSG_KEY, 1), + "101:48: " + getCheckMessage(MSG_KEY, 1), }; verify(checkConfig, getPath("InputTernaryPerExpressionCountCheck.java"), expected); @@ -171,35 +163,34 @@ public void testWithoutIgnoringExpressionInBraces() throws Exception { @Test public void testWithoutIgnoringSingleTernariesPerLine() throws Exception { - final boolean ternaryInBraces = false; - final boolean oneLine = false; - final int maxTernaryOperatorsCount = 1; + final DefaultConfiguration checkConfig = + createModuleConfig(TernaryPerExpressionCountCheck.class); checkConfig.addAttribute("ignoreTernaryOperatorsInBraces", - Boolean.toString(ternaryInBraces)); + "false"); checkConfig.addAttribute("ignoreIsolatedTernaryOnLine", - Boolean.toString(oneLine)); + "false"); final String[] expected = { - "14:26: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "18:32: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "20:33: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "21:26: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "25:56: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "26:50: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "30:47: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "31:52: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "35:38: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "36:38: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "37:31: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "38:23: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "47:36: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "49:47: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "57:41: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "67:39: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "79:41: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "91:29: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "94:29: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "99:29: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "101:48: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), + "14:26: " + getCheckMessage(MSG_KEY, 1), + "18:32: " + getCheckMessage(MSG_KEY, 1), + "20:33: " + getCheckMessage(MSG_KEY, 1), + "21:26: " + getCheckMessage(MSG_KEY, 1), + "25:56: " + getCheckMessage(MSG_KEY, 1), + "26:50: " + getCheckMessage(MSG_KEY, 1), + "30:47: " + getCheckMessage(MSG_KEY, 1), + "31:52: " + getCheckMessage(MSG_KEY, 1), + "35:38: " + getCheckMessage(MSG_KEY, 1), + "36:38: " + getCheckMessage(MSG_KEY, 1), + "37:31: " + getCheckMessage(MSG_KEY, 1), + "38:23: " + getCheckMessage(MSG_KEY, 1), + "47:36: " + getCheckMessage(MSG_KEY, 1), + "49:47: " + getCheckMessage(MSG_KEY, 1), + "57:41: " + getCheckMessage(MSG_KEY, 1), + "67:39: " + getCheckMessage(MSG_KEY, 1), + "79:41: " + getCheckMessage(MSG_KEY, 1), + "91:29: " + getCheckMessage(MSG_KEY, 1), + "94:29: " + getCheckMessage(MSG_KEY, 1), + "99:29: " + getCheckMessage(MSG_KEY, 1), + "101:48: " + getCheckMessage(MSG_KEY, 1), }; verify(checkConfig, getPath("InputTernaryPerExpressionCountCheck.java"), expected); @@ -207,30 +198,29 @@ public void testWithoutIgnoringSingleTernariesPerLine() throws Exception { @Test public void testWithIgnoringOneTernaryPerLine() throws Exception { - final boolean ternaryInBraces = false; - final boolean oneLine = true; - final int maxTernaryOperatorsCount = 0; + final DefaultConfiguration checkConfig = + createModuleConfig(TernaryPerExpressionCountCheck.class); checkConfig.addAttribute("ignoreTernaryOperatorsInBraces", - Boolean.toString(ternaryInBraces)); + "false"); checkConfig.addAttribute("ignoreIsolatedTernaryOnLine", - Boolean.toString(oneLine)); + "true"); checkConfig.addAttribute("maxTernaryPerExpressionCount", - Integer.toString(maxTernaryOperatorsCount)); + "0"); final String[] expected = { - "14:26: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "18:32: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "20:33: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "21:26: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "25:56: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "26:50: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "30:47: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "31:52: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "35:38: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "36:38: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "37:31: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "38:23: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "47:36: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), - "101:48: " + getCheckMessage(MSG_KEY, maxTernaryOperatorsCount), + "14:26: " + getCheckMessage(MSG_KEY, 0), + "18:32: " + getCheckMessage(MSG_KEY, 0), + "20:33: " + getCheckMessage(MSG_KEY, 0), + "21:26: " + getCheckMessage(MSG_KEY, 0), + "25:56: " + getCheckMessage(MSG_KEY, 0), + "26:50: " + getCheckMessage(MSG_KEY, 0), + "30:47: " + getCheckMessage(MSG_KEY, 0), + "31:52: " + getCheckMessage(MSG_KEY, 0), + "35:38: " + getCheckMessage(MSG_KEY, 0), + "36:38: " + getCheckMessage(MSG_KEY, 0), + "37:31: " + getCheckMessage(MSG_KEY, 0), + "38:23: " + getCheckMessage(MSG_KEY, 0), + "47:36: " + getCheckMessage(MSG_KEY, 0), + "101:48: " + getCheckMessage(MSG_KEY, 0), }; verify(checkConfig, getPath("InputTernaryPerExpressionCountCheck.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 d5a0e74d25..821c82766f 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 @@ -41,7 +41,7 @@ public class UnnecessaryParenthesesExtendedCheckTest extends BaseCheckTestSuppor @Test public void testDefault() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(UnnecessaryParenthesesExtendedCheck.class); + createModuleConfig(UnnecessaryParenthesesExtendedCheck.class); checkConfig.addAttribute("ignoreCalculationOfBooleanVariables", "false"); checkConfig.addAttribute("ignoreCalculationOfBooleanVariablesWithReturn", "false"); checkConfig.addAttribute("ignoreCalculationOfBooleanVariablesWithAssert", "false"); @@ -99,7 +99,7 @@ public void testDefault() throws Exception { @Test public void test15Extensions() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(UnnecessaryParenthesesExtendedCheck.class); + createModuleConfig(UnnecessaryParenthesesExtendedCheck.class); final String[] expected = {}; checkConfig.addAttribute("ignoreCalculationOfBooleanVariables", "false"); checkConfig.addAttribute("ignoreCalculationOfBooleanVariablesWithReturn", "false"); @@ -110,7 +110,7 @@ public void test15Extensions() throws Exception { @Test public void testUbv() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(UnnecessaryParenthesesExtendedCheck.class); + createModuleConfig(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/UselessSingleCatchCheckTest.java b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/coding/UselessSingleCatchCheckTest.java index 4fe85020d8..0245160c9a 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 @@ -29,10 +29,9 @@ public class UselessSingleCatchCheckTest extends BaseCheckTestSupport { private final String warningMessage = getCheckMessage(MSG_KEY); - private final DefaultConfiguration config = createCheckConfig(UselessSingleCatchCheck.class); - @Test public void testMultiCatch() throws Exception { + final DefaultConfiguration config = createModuleConfig(UselessSingleCatchCheck.class); final String[] expected = {}; verify(config, getPath("InputUselessSingleCatchCheck1.java"), expected); @@ -40,6 +39,7 @@ public void testMultiCatch() throws Exception { @Test public void testWrappingCatch() throws Exception { + final DefaultConfiguration config = createModuleConfig(UselessSingleCatchCheck.class); final String[] expected = {}; verify(config, getPath("InputUselessSingleCatchCheck2.java"), expected); @@ -47,6 +47,7 @@ public void testWrappingCatch() throws Exception { @Test public void testLoggingCatch() throws Exception { + final DefaultConfiguration config = createModuleConfig(UselessSingleCatchCheck.class); final String[] expected = {}; verify(config, getPath("InputUselessSingleCatchCheck3.java"), expected); @@ -54,6 +55,7 @@ public void testLoggingCatch() throws Exception { @Test public void testThrowsAnotherException() throws Exception { + final DefaultConfiguration config = createModuleConfig(UselessSingleCatchCheck.class); final String[] expected = {}; verify(config, getPath("InputUselessSingleCatchCheck4.java"), expected); @@ -61,6 +63,7 @@ public void testThrowsAnotherException() throws Exception { @Test public void testUselessCatch() throws Exception { + final DefaultConfiguration config = createModuleConfig(UselessSingleCatchCheck.class); final String[] expected = { "15:9: " + warningMessage, }; 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 f311dc0455..8c40b7c6b9 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,12 +28,11 @@ import com.puppycrawl.tools.checkstyle.DefaultConfiguration; public class UselessSuperCtorCallCheckTest extends BaseCheckTestSupport { - private final DefaultConfiguration mDefaultConfig = - createCheckConfig(UselessSuperCtorCallCheck.class); - @Test public void testSingleCtorWithSuperWithinNotDerivedClass() throws Exception { + final DefaultConfiguration mDefaultConfig = + createModuleConfig(UselessSuperCtorCallCheck.class); final String[] expected = { "7:9: " + getCheckMessage(MSG_IN_NOT_DERIVED_CLASS, "InputUselessSuperCtorCallCheck1"), }; @@ -44,6 +43,8 @@ public void testSingleCtorWithSuperWithinNotDerivedClass() @Test public void testSingleCtorWithSuperWithinDerivedClass() throws Exception { + final DefaultConfiguration mDefaultConfig = + createModuleConfig(UselessSuperCtorCallCheck.class); final String[] expected = { "7:9: " + getCheckMessage(MSG_WITHOUT_ARGS, "InputUselessSuperCtorCallCheck2"), }; @@ -54,6 +55,8 @@ public void testSingleCtorWithSuperWithinDerivedClass() @Test public void testMultipleCtorsWithSuperWithinNotDerivedClass() throws Exception { + final DefaultConfiguration mDefaultConfig = + createModuleConfig(UselessSuperCtorCallCheck.class); final String[] expected = { "7:9: " + getCheckMessage(MSG_IN_NOT_DERIVED_CLASS, "InputUselessSuperCtorCallCheck3"), "12:9: " + getCheckMessage(MSG_IN_NOT_DERIVED_CLASS, "InputUselessSuperCtorCallCheck3"), @@ -65,6 +68,8 @@ public void testMultipleCtorsWithSuperWithinNotDerivedClass() @Test public void testInnerClassWithCtorWithSuper() throws Exception { + final DefaultConfiguration mDefaultConfig = + createModuleConfig(UselessSuperCtorCallCheck.class); final String[] expected = { "9:13: " + getCheckMessage(MSG_IN_NOT_DERIVED_CLASS, "Inner"), }; @@ -75,6 +80,8 @@ public void testInnerClassWithCtorWithSuper() @Test public void testClassWithSuperCtorWithArgs() throws Exception { + final DefaultConfiguration mDefaultConfig = + createModuleConfig(UselessSuperCtorCallCheck.class); final String[] expected = {}; verify(mDefaultConfig, getPath("InputUselessSuperCtorCallCheck5.java"), expected); @@ -83,7 +90,8 @@ public void testClassWithSuperCtorWithArgs() @Test public void testOptionAllowCallToNoArgsSuperCtor() throws Exception { - final DefaultConfiguration checkConfig = createCheckConfig(UselessSuperCtorCallCheck.class); + final DefaultConfiguration checkConfig = + createModuleConfig(UselessSuperCtorCallCheck.class); checkConfig.addAttribute("allowCallToNoArgsSuperCtor", "true"); final String[] expected = {}; @@ -94,7 +102,8 @@ public void testOptionAllowCallToNoArgsSuperCtor() @Test public void testOptionAllowCallToNoArgsSuperCtorIfMultiplePublicCtor() throws Exception { - final DefaultConfiguration checkConfig = createCheckConfig(UselessSuperCtorCallCheck.class); + final DefaultConfiguration checkConfig = + createModuleConfig(UselessSuperCtorCallCheck.class); checkConfig.addAttribute("allowCallToNoArgsSuperCtorIfMultiplePublicCtor", "true"); final String[] 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 ea7d29a43c..906bb45df2 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,11 +27,10 @@ import com.puppycrawl.tools.checkstyle.DefaultConfiguration; public class WhitespaceBeforeArrayInitializerCheckTest extends BaseCheckTestSupport { - private final DefaultConfiguration mDefaultConfig = - createCheckConfig(WhitespaceBeforeArrayInitializerCheck.class); - @Test public void testWhitespaceBeforeArrayInitializer() throws Exception { + final DefaultConfiguration mDefaultConfig = + createModuleConfig(WhitespaceBeforeArrayInitializerCheck.class); final String[] expected = { "5:28: " + getCheckMessage(MSG_KEY), "13:32: " + getCheckMessage(MSG_KEY), 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 39f44a819b..820fa303b3 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,12 +36,10 @@ * */ public class AvoidConditionInversionCheckTest extends BaseCheckTestSupport { - private final DefaultConfiguration checkConfig = - createCheckConfig(AvoidConditionInversionCheck.class); - @Test public void defaultTest() throws Exception { - + final DefaultConfiguration checkConfig = + createModuleConfig(AvoidConditionInversionCheck.class); final String[] expected = { "7: " + getCheckMessage(MSG_KEY), "11: " + getCheckMessage(MSG_KEY), @@ -61,10 +59,10 @@ public void defaultTest() throws Exception { @Test public void avoidOnlyRelationalOperandsInCondition() throws Exception { - - final boolean applyOnlyToMathematicalOperands = true; + final DefaultConfiguration checkConfig = + createModuleConfig(AvoidConditionInversionCheck.class); checkConfig.addAttribute("applyOnlyToRelationalOperands", - Boolean.toString(applyOnlyToMathematicalOperands)); + "true"); final String[] expected = { "7: " + getCheckMessage(MSG_KEY), 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 8bd8881674..8bf4b20793 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,11 +35,10 @@ * Yaroslavtsev */ public class CauseParameterInExceptionCheckTest extends BaseCheckTestSupport { - private final DefaultConfiguration checkConfig = - createCheckConfig(CauseParameterInExceptionCheck.class); - @Test public void testNormalWork() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(CauseParameterInExceptionCheck.class); checkConfig.addAttribute("classNamesRegexp", ".+Exception"); checkConfig.addAttribute("ignoredClassNamesRegexp", null); checkConfig.addAttribute("allowedCauseTypes", "Throwable, Exception"); @@ -53,6 +52,8 @@ public void testNormalWork() throws Exception { @Test public void testNormalWork2() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(CauseParameterInExceptionCheck.class); checkConfig.addAttribute("classNamesRegexp", ".+Exception2"); checkConfig.addAttribute("ignoredClassNamesRegexp", null); checkConfig.addAttribute("allowedCauseTypes", "Throwable, Exception"); @@ -67,6 +68,8 @@ public void testNormalWork2() throws Exception { @Test public void testIgnorePattern() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(CauseParameterInExceptionCheck.class); checkConfig.addAttribute("classNamesRegexp", ".+Exception2"); checkConfig.addAttribute("ignoredClassNamesRegexp", "Test.+"); checkConfig.addAttribute("allowedCauseTypes", "Throwable, Exception"); @@ -80,6 +83,8 @@ public void testIgnorePattern() throws Exception { @Test public void testIgnorePattern2() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(CauseParameterInExceptionCheck.class); checkConfig.addAttribute("classNamesRegexp", ".+Exception2"); checkConfig.addAttribute("ignoredClassNamesRegexp", "My.+"); checkConfig.addAttribute("allowedCauseTypes", "Throwable, Exception"); @@ -93,6 +98,8 @@ public void testIgnorePattern2() throws Exception { @Test public void testStrangeSituation() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(CauseParameterInExceptionCheck.class); checkConfig.addAttribute("classNamesRegexp", ".+Exception"); checkConfig.addAttribute("ignoredClassNamesRegexp", ""); checkConfig.addAttribute("allowedCauseTypes", "Throwable, Exception"); @@ -105,6 +112,8 @@ public void testStrangeSituation() throws Exception { @Test public void testStrangeSituation2() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(CauseParameterInExceptionCheck.class); checkConfig.addAttribute("classNamesRegexp", null); checkConfig.addAttribute("ignoredClassNamesRegexp", null); checkConfig.addAttribute("allowedCauseTypes", "Throwable, Exception"); @@ -117,6 +126,8 @@ public void testStrangeSituation2() throws Exception { @Test public void testStrangeSituation3() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(CauseParameterInExceptionCheck.class); checkConfig.addAttribute("classNamesRegexp", null); checkConfig.addAttribute("ignoredClassNamesRegexp", null); checkConfig.addAttribute("allowedCauseTypes", "Throwable, Exception"); @@ -129,6 +140,8 @@ public void testStrangeSituation3() throws Exception { @Test public void testStrangeSituation4() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(CauseParameterInExceptionCheck.class); checkConfig.addAttribute("classNamesRegexp", null); checkConfig.addAttribute("ignoredClassNamesRegexp", null); checkConfig.addAttribute("allowedCauseTypes", "Throwable, 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 920b3eb268..e4473add1f 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,10 +31,9 @@ * Yaroslavtsev */ public class ChildBlockLengthCheckTest extends BaseCheckTestSupport { - private final DefaultConfiguration checkConfig = createCheckConfig(ChildBlockLengthCheck.class); - @Test public void testNpeOnAllBlockTypes() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(ChildBlockLengthCheck.class); checkConfig.addAttribute("maxChildBlockPercentage", "100"); checkConfig.addAttribute("blockTypes", "LITERAL_IF, LITERAL_SWITCH, LITERAL_FOR, " + "LITERAL_DO, LITERAL_WHILE, LITERAL_TRY, LITERAL_ELSE, LITERAL_CATCH"); @@ -47,6 +46,7 @@ public void testNpeOnAllBlockTypes() throws Exception { @Test public void testNestedConditions() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(ChildBlockLengthCheck.class); checkConfig.addAttribute("maxChildBlockPercentage", "100"); checkConfig.addAttribute("blockTypes", "LITERAL_IF, LITERAL_SWITCH, LITERAL_FOR, " + "LITERAL_DO, LITERAL_WHILE, LITERAL_TRY, LITERAL_ELSE, LITERAL_CATCH"); @@ -59,6 +59,7 @@ public void testNestedConditions() throws Exception { @Test public void testManyBadChildBlocks() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(ChildBlockLengthCheck.class); checkConfig.addAttribute("maxChildBlockPercentage", "20"); checkConfig.addAttribute("blockTypes", "LITERAL_IF, LITERAL_SWITCH, LITERAL_FOR, " + "LITERAL_DO, LITERAL_WHILE, LITERAL_TRY, LITERAL_ELSE, LITERAL_CATCH"); @@ -74,6 +75,7 @@ public void testManyBadChildBlocks() throws Exception { @Test public void testManyBadChildBlocks2() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(ChildBlockLengthCheck.class); checkConfig.addAttribute("maxChildBlockPercentage", "19"); checkConfig.addAttribute("blockTypes", "LITERAL_IF, LITERAL_SWITCH, LITERAL_FOR, " + "LITERAL_DO, LITERAL_WHILE, LITERAL_TRY, LITERAL_ELSE, LITERAL_CATCH"); @@ -90,6 +92,7 @@ public void testManyBadChildBlocks2() throws Exception { @Test public void testNestedBadChildBlocks() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(ChildBlockLengthCheck.class); checkConfig.addAttribute("maxChildBlockPercentage", "70"); checkConfig.addAttribute("blockTypes", "LITERAL_IF, LITERAL_SWITCH, LITERAL_FOR, " + "LITERAL_DO, LITERAL_WHILE, LITERAL_TRY, LITERAL_ELSE, LITERAL_CATCH"); @@ -105,6 +108,7 @@ public void testNestedBadChildBlocks() throws Exception { @Test public void testIgnoreBlockLinesCountOption() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(ChildBlockLengthCheck.class); checkConfig.addAttribute("maxChildBlockPercentage", "19"); checkConfig.addAttribute("blockTypes", "LITERAL_IF, LITERAL_SWITCH, LITERAL_FOR, " + "LITERAL_DO, LITERAL_WHILE, LITERAL_TRY, LITERAL_ELSE, LITERAL_CATCH"); @@ -119,6 +123,7 @@ public void testIgnoreBlockLinesCountOption() throws Exception { @Test public void testBadChildBlocksThatAreDoubleNested2() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(ChildBlockLengthCheck.class); checkConfig.addAttribute("maxChildBlockPercentage", "70"); checkConfig.addAttribute("blockTypes", "LITERAL_IF, LITERAL_SWITCH, LITERAL_FOR, " + "LITERAL_DO, LITERAL_WHILE, LITERAL_TRY, LITERAL_ELSE, LITERAL_CATCH"); @@ -131,6 +136,7 @@ public void testBadChildBlocksThatAreDoubleNested2() throws Exception { @Test public void testNestedClass() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(ChildBlockLengthCheck.class); checkConfig.addAttribute("maxChildBlockPercentage", "19"); checkConfig.addAttribute("blockTypes", "LITERAL_IF"); checkConfig.addAttribute("ignoreBlockLinesCount", "0"); 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 6534a89cce..a6de14b7b4 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 @@ -22,7 +22,6 @@ import static com.github.sevntu.checkstyle.checks.design.ConstructorWithoutParamsCheck.MSG_KEY; import static org.junit.Assert.assertArrayEquals; -import org.junit.Before; import org.junit.Test; import com.github.sevntu.checkstyle.BaseCheckTestSupport; @@ -31,15 +30,10 @@ public class ConstructorWithoutParamsCheckTest extends BaseCheckTestSupport { - private DefaultConfiguration defaultConfig; - - @Before - public void getDefaultConfiguration() { - defaultConfig = createCheckConfig(ConstructorWithoutParamsCheck.class); - } - @Test public void testDefaultConfigProhibitsExceptionsWithoutParams() throws Exception { + final DefaultConfiguration defaultConfig = + createModuleConfig(ConstructorWithoutParamsCheck.class); final String[] expectedViolationMsg = { "35:37: " + getCheckMessage(MSG_KEY, "RuntimeException"), }; @@ -49,6 +43,8 @@ public void testDefaultConfigProhibitsExceptionsWithoutParams() throws Exception @Test public void testUserDefinedConfigProhibitsCustomClasses() throws Exception { + final DefaultConfiguration defaultConfig = + createModuleConfig(ConstructorWithoutParamsCheck.class); defaultConfig.addAttribute("classNameFormat", "Clazz[1-9]"); defaultConfig.addAttribute("ignoredClassNameFormat", "Clazz4"); final String[] expectedViolationMsg = { 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 fd1728ff9f..47032700d6 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 @@ -94,10 +94,6 @@ public class ForbidWildcardAsReturnTypeCheckTest extends BaseCheckTestSupport { */ private static final SortedSet LINES_WITH_IGNORE_CLASS_NAMES = newSetOfLines(new Integer[] {214, 218, 221, }); - /** - * Ignore list for class names. Regexp. - */ - private static final String IGNORE_LIST_PATTERN = "(Compar.+)|Collection"; /** * Message for this check. */ @@ -122,7 +118,7 @@ public ForbidWildcardAsReturnTypeCheckTest() { public final void testDefault() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(ForbidWildcardAsReturnTypeCheck.class); + createModuleConfig(ForbidWildcardAsReturnTypeCheck.class); checkConfig.addAttribute("checkPublicMethods", "true"); checkConfig.addAttribute("checkPrivateMethods", "true"); checkConfig.addAttribute("checkProtectedMethods", "true"); @@ -148,7 +144,7 @@ public final void testDefault() public final void testOnlyPublicMethods() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(ForbidWildcardAsReturnTypeCheck.class); + createModuleConfig(ForbidWildcardAsReturnTypeCheck.class); checkConfig.addAttribute("checkPublicMethods", "true"); checkConfig.addAttribute("checkPrivateMethods", "false"); checkConfig.addAttribute("checkProtectedMethods", "false"); @@ -175,7 +171,7 @@ public final void testOnlyPublicMethods() public final void testOnlyPrivateMethods() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(ForbidWildcardAsReturnTypeCheck.class); + createModuleConfig(ForbidWildcardAsReturnTypeCheck.class); checkConfig.addAttribute("checkPublicMethods", "false"); checkConfig.addAttribute("checkPrivateMethods", "true"); checkConfig.addAttribute("checkProtectedMethods", "false"); @@ -202,7 +198,7 @@ public final void testOnlyPrivateMethods() public final void testOnlyProtectedMethods() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(ForbidWildcardAsReturnTypeCheck.class); + createModuleConfig(ForbidWildcardAsReturnTypeCheck.class); checkConfig.addAttribute("checkPublicMethods", "false"); checkConfig.addAttribute("checkPrivateMethods", "false"); checkConfig.addAttribute("checkProtectedMethods", "true"); @@ -229,7 +225,7 @@ public final void testOnlyProtectedMethods() public final void testOnlyPackageMethods() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(ForbidWildcardAsReturnTypeCheck.class); + createModuleConfig(ForbidWildcardAsReturnTypeCheck.class); checkConfig.addAttribute("checkPublicMethods", "false"); checkConfig.addAttribute("checkPrivateMethods", "false"); checkConfig.addAttribute("checkProtectedMethods", "false"); @@ -256,7 +252,7 @@ public final void testOnlyPackageMethods() public final void testAllowSuper() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(ForbidWildcardAsReturnTypeCheck.class); + createModuleConfig(ForbidWildcardAsReturnTypeCheck.class); checkConfig.addAttribute("checkPublicMethods", "true"); checkConfig.addAttribute("checkPrivateMethods", "true"); checkConfig.addAttribute("checkProtectedMethods", "true"); @@ -285,7 +281,7 @@ public final void testAllowSuper() public final void testAllowExtends() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(ForbidWildcardAsReturnTypeCheck.class); + createModuleConfig(ForbidWildcardAsReturnTypeCheck.class); checkConfig.addAttribute("checkPublicMethods", "true"); checkConfig.addAttribute("checkPrivateMethods", "true"); checkConfig.addAttribute("checkProtectedMethods", "true"); @@ -314,7 +310,7 @@ public final void testAllowExtends() public final void testAllowExtendsAndSuper() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(ForbidWildcardAsReturnTypeCheck.class); + createModuleConfig(ForbidWildcardAsReturnTypeCheck.class); checkConfig.addAttribute("checkPublicMethods", "true"); checkConfig.addAttribute("checkPrivateMethods", "true"); checkConfig.addAttribute("checkProtectedMethods", "true"); @@ -344,7 +340,7 @@ public final void testAllowExtendsAndSuper() public final void testWithIgnoreList() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(ForbidWildcardAsReturnTypeCheck.class); + createModuleConfig(ForbidWildcardAsReturnTypeCheck.class); checkConfig.addAttribute("checkPublicMethods", "true"); checkConfig.addAttribute("checkPrivateMethods", "true"); checkConfig.addAttribute("checkProtectedMethods", "true"); @@ -354,7 +350,7 @@ public final void testWithIgnoreList() checkConfig.addAttribute("allowReturnWildcardWithExtends", "false"); checkConfig.addAttribute("allowReturnWildcardWithSuper", "false"); checkConfig.addAttribute("returnTypeClassNamesIgnoreRegex", - IGNORE_LIST_PATTERN); + "(Compar.+)|Collection"); final SortedSet exceptSuperAndExtends = new TreeSet<>(LINES); exceptSuperAndExtends.removeAll(LINES_WITH_IGNORE_CLASS_NAMES); @@ -374,7 +370,7 @@ public final void testWithIgnoreList() public final void testAllExceptOverrideMethods() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(ForbidWildcardAsReturnTypeCheck.class); + createModuleConfig(ForbidWildcardAsReturnTypeCheck.class); checkConfig.addAttribute("checkPublicMethods", "true"); checkConfig.addAttribute("checkPrivateMethods", "true"); checkConfig.addAttribute("checkProtectedMethods", "true"); @@ -403,7 +399,7 @@ public final void testAllExceptOverrideMethods() public final void testAllExceptDeprecatedMethods() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(ForbidWildcardAsReturnTypeCheck.class); + createModuleConfig(ForbidWildcardAsReturnTypeCheck.class); checkConfig.addAttribute("checkPublicMethods", "true"); checkConfig.addAttribute("checkPrivateMethods", "true"); checkConfig.addAttribute("checkProtectedMethods", "true"); @@ -427,7 +423,7 @@ public final void testAllExceptDeprecatedMethods() public final void testFullyQualifiedAnnotation() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(ForbidWildcardAsReturnTypeCheck.class); + createModuleConfig(ForbidWildcardAsReturnTypeCheck.class); verify(checkConfig, getPath("InputForbidWildcardAsReturnTypeCheckQualifiedAnnotation.java"), 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 5208afcecc..37f137af67 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 @@ -32,7 +32,7 @@ public class HideUtilityClassConstructorCheckTest @Test public void testUtilClass() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(HideUtilityClassConstructorCheck.class); + createModuleConfig(HideUtilityClassConstructorCheck.class); final String[] expected = { "11:1: " + getCheckMessage(MSG_KEY), }; @@ -43,7 +43,7 @@ public void testUtilClass() throws Exception { @Test public void testNonUtilClass() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(HideUtilityClassConstructorCheck.class); + createModuleConfig(HideUtilityClassConstructorCheck.class); final String[] expected = { }; verify(checkConfig, getPath("InputHideUtilityClassConstructorCheck4.java"), expected); @@ -52,7 +52,7 @@ public void testNonUtilClass() throws Exception { @Test public void testDerivedNonUtilClass() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(HideUtilityClassConstructorCheck.class); + createModuleConfig(HideUtilityClassConstructorCheck.class); final String[] expected = { }; verify(checkConfig, getPath("InputHideUtilityClassConstructorCheck5.java"), expected); @@ -61,7 +61,7 @@ public void testDerivedNonUtilClass() throws Exception { @Test public void testOnlyNonstaticFieldNonUtilClass() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(HideUtilityClassConstructorCheck.class); + createModuleConfig(HideUtilityClassConstructorCheck.class); final String[] expected = { }; verify(checkConfig, getPath("InputHideUtilityClassConstructorCheck6.java"), expected); @@ -70,7 +70,7 @@ public void testOnlyNonstaticFieldNonUtilClass() throws Exception { @Test public void testEmptyAbstractClass() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(HideUtilityClassConstructorCheck.class); + createModuleConfig(HideUtilityClassConstructorCheck.class); final String[] expected = { }; verify(checkConfig, getPath("InputHideUtilityClassConstructorCheck1.java"), expected); @@ -79,7 +79,7 @@ public void testEmptyAbstractClass() throws Exception { @Test public void testEmptyClassWithOnlyPrivateFields() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(HideUtilityClassConstructorCheck.class); + createModuleConfig(HideUtilityClassConstructorCheck.class); final String[] expected = { }; verify(checkConfig, getPath("InputHideUtilityClassConstructorCheck2.java"), expected); @@ -88,7 +88,7 @@ public void testEmptyClassWithOnlyPrivateFields() throws Exception { @Test public void testClassWithStaticInnerClass() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(HideUtilityClassConstructorCheck.class); + createModuleConfig(HideUtilityClassConstructorCheck.class); final String[] expected = { }; verify(checkConfig, getPath("InputHideUtilityClassConstructorCheck3.java"), expected); 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 bef07ca609..f44e52cb66 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 @@ -33,7 +33,7 @@ public class InnerClassCheckTest extends BaseCheckTestSupport { @Test public void testMembersBeforeInner() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(InnerClassCheck.class); + createModuleConfig(InnerClassCheck.class); final String[] expected = { "15:17: " + warningMessage, "25:17: " + warningMessage, 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 94554df2ab..6c9b4e334f 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,10 +31,9 @@ * @author Damian Szczepanik (damianszczepanik@github) */ public class NestedSwitchCheckTest extends BaseCheckTestSupport { - private final DefaultConfiguration checkConfig = createCheckConfig(NestedSwitchCheck.class); - @Test public void testSimple() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(NestedSwitchCheck.class); final String[] expected = { "11:13: " + getCheckMessage(MSG_KEY), "23:13: " + getCheckMessage(MSG_KEY), @@ -53,6 +52,7 @@ public void testSimple() throws Exception { @Test public void testMax() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(NestedSwitchCheck.class); checkConfig.addAttribute("max", "99"); final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; 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 8d2fda9bad..505bca66de 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 @@ -49,7 +49,7 @@ public class NoMainMethodInAbstractClassCheckTest extends BaseCheckTestSupport { public final void testDefault() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(NoMainMethodInAbstractClassCheck.class); + createModuleConfig(NoMainMethodInAbstractClassCheck.class); final String[] expected = { "23: " + warningMessage, "26: " + warningMessage, 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 61aa059fa5..31c60596cb 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 @@ -44,7 +44,7 @@ public class PublicReferenceToPrivateTypeCheckTest extends public void noReturnProblemsTest() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(PublicReferenceToPrivateTypeCheck.class); + createModuleConfig(PublicReferenceToPrivateTypeCheck.class); final String[] expected = {}; verify(checkConfig, getPath("InputPublicReferenceToPrivateTypeCheck1.java"), @@ -61,7 +61,7 @@ public void returnPrivateTest() throws Exception { final String typeName = "PrivateInner"; final DefaultConfiguration checkConfig = - createCheckConfig(PublicReferenceToPrivateTypeCheck.class); + createModuleConfig(PublicReferenceToPrivateTypeCheck.class); final String[] expected = {"13: " + getCheckMessage(MSG_KEY, typeName), }; verify(checkConfig, getPath("InputPublicReferenceToPrivateTypeCheck2.java"), @@ -78,7 +78,7 @@ public void returnPrivateTest() public void returnPrivateThatImplimentTest() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(PublicReferenceToPrivateTypeCheck.class); + createModuleConfig(PublicReferenceToPrivateTypeCheck.class); final String[] expected = {}; verify(checkConfig, getPath("InputPublicReferenceToPrivateTypeCheck4.java"), @@ -95,7 +95,7 @@ public void returnPrivateThatImplimentTest() public void returnPrivateThatExtendsTest() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(PublicReferenceToPrivateTypeCheck.class); + createModuleConfig(PublicReferenceToPrivateTypeCheck.class); final String[] expected = {}; verify(checkConfig, getPath("InputPublicReferenceToPrivateTypeCheck3.java"), @@ -112,7 +112,7 @@ public void returnPrivateArrayTest() throws Exception { final String typeName = "PrivateInner"; final DefaultConfiguration checkConfig = - createCheckConfig(PublicReferenceToPrivateTypeCheck.class); + createModuleConfig(PublicReferenceToPrivateTypeCheck.class); final String[] expected = {"13: " + getCheckMessage(MSG_KEY, typeName), }; verify(checkConfig, getPath("InputPublicReferenceToPrivateTypeCheck5.java"), @@ -129,7 +129,7 @@ public void returnPrivateInShell() throws Exception { final String typeName = "PrivateInner"; final DefaultConfiguration checkConfig = - createCheckConfig(PublicReferenceToPrivateTypeCheck.class); + createModuleConfig(PublicReferenceToPrivateTypeCheck.class); final String[] expected = {"14: " + getCheckMessage(MSG_KEY, typeName), }; verify(checkConfig, getPath("InputPublicReferenceToPrivateTypeCheck6.java"), @@ -147,7 +147,7 @@ public void returnPrivateInCollectionInCollection() throws Exception { final String typeName = "PrivateInner"; final DefaultConfiguration checkConfig = - createCheckConfig(PublicReferenceToPrivateTypeCheck.class); + createModuleConfig(PublicReferenceToPrivateTypeCheck.class); final String[] expected = {"14: " + getCheckMessage(MSG_KEY, typeName), }; verify(checkConfig, getPath("InputPublicReferenceToPrivateTypeCheck7.java"), @@ -165,7 +165,7 @@ public void returnPrivateInMapInCollectionInCollection() throws Exception { final String typeName = "PrivateInner"; final DefaultConfiguration checkConfig = - createCheckConfig(PublicReferenceToPrivateTypeCheck.class); + createModuleConfig(PublicReferenceToPrivateTypeCheck.class); final String[] expected = {"14: " + getCheckMessage(MSG_KEY, typeName), }; verify(checkConfig, getPath("InputPublicReferenceToPrivateTypeCheck9.java"), @@ -184,7 +184,7 @@ public void complexTest() final String typeName = "PrivateInner"; final String typeName1 = "OutClass"; final DefaultConfiguration checkConfig = - createCheckConfig(PublicReferenceToPrivateTypeCheck.class); + createModuleConfig(PublicReferenceToPrivateTypeCheck.class); final String[] expected = { "25: " + getCheckMessage(MSG_KEY, typeName), "28: " + getCheckMessage(MSG_KEY, typeName1), @@ -205,7 +205,7 @@ public void methodModifiersTest() throws Exception { final String typeName = "PrivateInner"; final DefaultConfiguration checkConfig = - createCheckConfig(PublicReferenceToPrivateTypeCheck.class); + createModuleConfig(PublicReferenceToPrivateTypeCheck.class); final String[] expected = { "14: " + getCheckMessage(MSG_KEY, typeName), "20: " + getCheckMessage(MSG_KEY, typeName), @@ -226,7 +226,7 @@ public void wildcardsTest() throws Exception { final String typeName = "PrivateInner"; final DefaultConfiguration checkConfig = - createCheckConfig(PublicReferenceToPrivateTypeCheck.class); + createModuleConfig(PublicReferenceToPrivateTypeCheck.class); final String[] expected = { "14: " + getCheckMessage(MSG_KEY, typeName), "20: " + getCheckMessage(MSG_KEY, typeName), @@ -242,7 +242,7 @@ public void interfacesTest() throws Exception { final String typeName = "PrivateInner"; final DefaultConfiguration checkConfig = - createCheckConfig(PublicReferenceToPrivateTypeCheck.class); + createModuleConfig(PublicReferenceToPrivateTypeCheck.class); final String[] expected = { "13: " + getCheckMessage(MSG_KEY, typeName), "19: " + getCheckMessage(MSG_KEY, typeName), @@ -257,7 +257,7 @@ public void enumsTest() throws Exception { final String typeName = "First"; final DefaultConfiguration checkConfig = - createCheckConfig(PublicReferenceToPrivateTypeCheck.class); + createModuleConfig(PublicReferenceToPrivateTypeCheck.class); final String[] expected = { "8: " + getCheckMessage(MSG_KEY, typeName), "10: " + getCheckMessage(MSG_KEY, typeName), @@ -274,7 +274,7 @@ public void testClassEnumInterface() final String typeName1 = "PrivateInner1"; final String typeName2 = "First"; final DefaultConfiguration checkConfig = - createCheckConfig(PublicReferenceToPrivateTypeCheck.class); + createModuleConfig(PublicReferenceToPrivateTypeCheck.class); final String[] expected = { "15: " + getCheckMessage(MSG_KEY, typeName), "25: " + getCheckMessage(MSG_KEY, typeName1), @@ -291,7 +291,7 @@ public void testClassEnumInterface() public void returnFromInnerTypeTest() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(PublicReferenceToPrivateTypeCheck.class); + createModuleConfig(PublicReferenceToPrivateTypeCheck.class); final String[] expected = { "4: " + getCheckMessage(MSG_KEY, "Inner"), "4: " + getCheckMessage(MSG_KEY, "Inner1"), @@ -309,7 +309,7 @@ public void returnFromInnerTypeTest() public void returnFromInnerAnonymousClassTest() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(PublicReferenceToPrivateTypeCheck.class); + createModuleConfig(PublicReferenceToPrivateTypeCheck.class); final String[] expected = { "4: " + getCheckMessage(MSG_KEY, "Inner"), "4: " + getCheckMessage(MSG_KEY, "Inner2"), @@ -324,7 +324,7 @@ public void returnFromInnerAnonymousClassTest() public void returnFromPublicFieldTest() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(PublicReferenceToPrivateTypeCheck.class); + createModuleConfig(PublicReferenceToPrivateTypeCheck.class); final String[] expected = { "4: " + getCheckMessage(MSG_KEY, "Inner"), "9: " + getCheckMessage(MSG_KEY, "Inner1"), @@ -338,7 +338,7 @@ public void returnFromPublicFieldTest() public void implementingOrExtendingPrivateTypeTest() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(PublicReferenceToPrivateTypeCheck.class); + createModuleConfig(PublicReferenceToPrivateTypeCheck.class); final String[] expected = { "17: " + getCheckMessage(MSG_KEY, "InnerClass"), }; @@ -351,7 +351,7 @@ public void implementingOrExtendingPrivateTypeTest() public void usingPrivateTypeAsMethodParameterTest() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(PublicReferenceToPrivateTypeCheck.class); + createModuleConfig(PublicReferenceToPrivateTypeCheck.class); final String[] expected = { "4: " + getCheckMessage(MSG_KEY, "C1"), "6: " + getCheckMessage(MSG_KEY, "C1"), 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 09e66debd5..17e3e3bee1 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 @@ -35,7 +35,7 @@ public class StaticMethodCandidateCheckTest extends BaseCheckTestSupport { @Test public void testDefault() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(StaticMethodCandidateCheck.class); + createModuleConfig(StaticMethodCandidateCheck.class); final String[] expected = { "37: " + getCheckMessage(MSG_KEY, "foo11"), "56: " + getCheckMessage(MSG_KEY, "nestedFoo1"), @@ -55,7 +55,7 @@ public void testDefault() throws Exception { @Test public void testSkippedMethods() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(StaticMethodCandidateCheck.class); + createModuleConfig(StaticMethodCandidateCheck.class); checkConfig.addAttribute("skippedMethods", "foo, bar,foobar"); final String[] expected = {}; verify(checkConfig, getPath("InputStaticMethodCandidateCheckSkippedMethods.java"), @@ -127,7 +127,7 @@ public void testGetRequiredTokens() { @Test public void testLambda() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(StaticMethodCandidateCheck.class); + createModuleConfig(StaticMethodCandidateCheck.class); final String[] expected = { }; verify(checkConfig, "src/test/resources-noncompilable/com/github/sevntu/checkstyle/checks/" @@ -137,7 +137,7 @@ public void testLambda() throws Exception { @Test public void testInterface() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(StaticMethodCandidateCheck.class); + createModuleConfig(StaticMethodCandidateCheck.class); final String[] expected = { "16: " + getCheckMessage(MSG_KEY, "bar"), }; 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 5a67551eab..64cd91177d 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 @@ -32,7 +32,7 @@ public class EnumValueNameCheckTest extends BaseCheckTestSupport { public void testDefault() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(EnumValueNameCheck.class); + createModuleConfig(EnumValueNameCheck.class); final String[] expected = { "35:9: " + getCheckMessage(MSG_INVALID_PATTERN, "FirstSimple", DEFAULT_PATTERN), "43:9: " + getCheckMessage(MSG_INVALID_PATTERN, "FirstComplex", DEFAULT_PATTERN), @@ -45,20 +45,19 @@ public void testDefault() @Test public void testCustomFormat() throws Exception { - final String pattern = "[a-z]+"; final DefaultConfiguration checkConfig = - createCheckConfig(EnumValueNameCheck.class); + createModuleConfig(EnumValueNameCheck.class); - checkConfig.addAttribute("format", pattern); + checkConfig.addAttribute("format", "[a-z]+"); final String[] expected = { - "35:22: " + getCheckMessage(MSG_INVALID_PATTERN, "SECOND_SIMPLE", pattern), - "35:37: " + getCheckMessage(MSG_INVALID_PATTERN, "DB2", pattern), - "35:42: " + getCheckMessage(MSG_INVALID_PATTERN, "V1", pattern), - "43:26: " + getCheckMessage(MSG_INVALID_PATTERN, "SECOND_COMPLEX", pattern), - "43:45: " + getCheckMessage(MSG_INVALID_PATTERN, "V2", pattern), - "66:9: " + getCheckMessage(MSG_INVALID_PATTERN, "MO_FIRST", pattern), - "76:9: " + getCheckMessage(MSG_INVALID_PATTERN, "FO_FIRST", pattern), + "35:22: " + getCheckMessage(MSG_INVALID_PATTERN, "SECOND_SIMPLE", "[a-z]+"), + "35:37: " + getCheckMessage(MSG_INVALID_PATTERN, "DB2", "[a-z]+"), + "35:42: " + getCheckMessage(MSG_INVALID_PATTERN, "V1", "[a-z]+"), + "43:26: " + getCheckMessage(MSG_INVALID_PATTERN, "SECOND_COMPLEX", "[a-z]+"), + "43:45: " + getCheckMessage(MSG_INVALID_PATTERN, "V2", "[a-z]+"), + "66:9: " + getCheckMessage(MSG_INVALID_PATTERN, "MO_FIRST", "[a-z]+"), + "76:9: " + getCheckMessage(MSG_INVALID_PATTERN, "FO_FIRST", "[a-z]+"), }; 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 b01cec0f19..59cdeb8d99 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 @@ -33,7 +33,7 @@ public class InterfaceTypeParameterNameCheckTest public void testInterfaceDefault() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(InterfaceTypeParameterNameCheck.class); + createModuleConfig(InterfaceTypeParameterNameCheck.class); final String[] expected = { "5:56: " + getCheckMessage(MSG_KEY, "it", "^[A-Z]$"), @@ -48,7 +48,7 @@ public void testInterfaceDefault() public void testInterfaceFooName() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(InterfaceTypeParameterNameCheck.class); + createModuleConfig(InterfaceTypeParameterNameCheck.class); checkConfig.addAttribute("format", "^foo$"); final String[] expected = { "5:56: " + getCheckMessage(MSG_KEY, "it", "^foo$"), 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 46e46364e4..633489f827 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 @@ -52,7 +52,7 @@ public UniformEnumConstantNameCheckTest() { public void testDefault() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(UniformEnumConstantNameCheck.class); + createModuleConfig(UniformEnumConstantNameCheck.class); final String[] expected = { buildMessage(37, 9, "SECOND_SIMPLE", UniformEnumConstantNameCheck.CAMEL_PATTERN), @@ -74,18 +74,18 @@ public void testDefault() public void testUpperCase() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(UniformEnumConstantNameCheck.class); + createModuleConfig(UniformEnumConstantNameCheck.class); checkConfig.addAttribute("formats", - UniformEnumConstantNameCheck.UPPERCASE_PATTERN); + "^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"); final String[] expected = { buildMessage(35, 9, "FirstSimple", - UniformEnumConstantNameCheck.UPPERCASE_PATTERN), + "^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"), buildMessage(48, 9, "SecondComplex", - UniformEnumConstantNameCheck.UPPERCASE_PATTERN), + "^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"), buildMessage(82, 9, "CcFirst", - UniformEnumConstantNameCheck.UPPERCASE_PATTERN), + "^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"), buildMessage(90, 9, "WF_First", - UniformEnumConstantNameCheck.UPPERCASE_PATTERN), + "^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"), }; verify(checkConfig, inputFile, expected); } @@ -100,9 +100,9 @@ public void testUpperCase() public void testAllAfterUpper() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(UniformEnumConstantNameCheck.class); + createModuleConfig(UniformEnumConstantNameCheck.class); checkConfig.addAttribute("formats", - UniformEnumConstantNameCheck.UPPERCASE_PATTERN + ",.*"); + "^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$" + ",.*"); final String[] expected = {}; verify(checkConfig, inputFile, expected); } @@ -117,7 +117,7 @@ public void testAllAfterUpper() public void testInvalidFormat() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(UniformEnumConstantNameCheck.class); + createModuleConfig(UniformEnumConstantNameCheck.class); checkConfig.addAttribute("formats", "\\"); final String[] expected = {}; try { @@ -141,7 +141,7 @@ public void testInvalidFormat() public void testWrongToken() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(UniformEnumConstantNameCheck.class); + createModuleConfig(UniformEnumConstantNameCheck.class); checkConfig.addAttribute("tokens", "INTERFACE_DEF"); final String[] expected = {}; try { 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 fb8742302e..7cd823a9f2 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 @@ -34,7 +34,7 @@ public class LineLengthExtendedCheckTest extends BaseCheckTestSupport { public void testSimple() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(LineLengthExtendedCheck.class); + createModuleConfig(LineLengthExtendedCheck.class); checkConfig.addAttribute("max", "80"); checkConfig.addAttribute("ignorePattern", "^.*is OK.*regexp.*$"); final String[] expected = { @@ -48,7 +48,7 @@ public void testSimple() public void testSimpleIgnore() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(LineLengthExtendedCheck.class); + createModuleConfig(LineLengthExtendedCheck.class); checkConfig.addAttribute("max", "40"); checkConfig.addAttribute("ignorePattern", "^.*is OK.*regexp.*$"); final String[] expected = { @@ -79,7 +79,7 @@ public void testSimpleIgnore() @Test public void testProperty() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(LineLengthExtendedCheck.class); + createModuleConfig(LineLengthExtendedCheck.class); checkConfig.addAttribute("ignorePattern", "["); 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 447c485466..db00b756ed 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 @@ -11,7 +11,7 @@ public void testSimple() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(LineLengthCheck.class); + createModuleConfig(LineLengthCheck.class); checkConfig.addAttribute("max", "80"); checkConfig.addAttribute("ignorePattern", "^.*is OK.*regexp.*$"); final String[] expected = { @@ -26,7 +26,7 @@ public void testSimpleIgnore() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(LineLengthCheck.class); + createModuleConfig(LineLengthCheck.class); checkConfig.addAttribute("max", "40"); checkConfig.addAttribute("ignorePattern", "^.*is OK.*regexp.*$"); final String[] expected = { @@ -59,4 +59,4 @@ class LineLengthCheck { } -} \ No newline at end of file +} From 62195382328961773d532365ff7fd9997566a37d Mon Sep 17 00:00:00 2001 From: rnveach Date: Thu, 16 Nov 2017 18:48:19 -0500 Subject: [PATCH 132/208] Issue #610: added CheckstyleTestMakeupCheck --- .../design/checkstyle-metadata.properties | 5 + .../checks/design/checkstyle-metadata.xml | 19 + sevntu-checks/sevntu-checks.xml | 1 + .../design/CheckstyleTestMakeupCheck.java | 426 ++++++++++++++++++ .../checks/design/messages.properties | 5 + .../design/CheckstyleTestMakeupCheckTest.java | 122 +++++ .../InputCheckstyleTestMakeupCheck.java | 58 +++ ...InputCheckstyleTestMakeupCheckInvalid.java | 87 ++++ .../InputCheckstyleTestMakeupCheckValid.java | 99 ++++ .../sonar/checkstyle-extensions.xml | 16 + 10 files changed, 838 insertions(+) create mode 100644 sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/CheckstyleTestMakeupCheck.java create mode 100644 sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/CheckstyleTestMakeupCheckTest.java create mode 100644 sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCheckstyleTestMakeupCheck.java create mode 100644 sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCheckstyleTestMakeupCheckInvalid.java create mode 100644 sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCheckstyleTestMakeupCheckValid.java 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 88a66b4609..ecabd4ae42 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 @@ -50,3 +50,8 @@ HideUtilityClassConstructorCheck.desc = Make sure that utility classes (classes InnerClassCheck.name = Inner Class InnerClassCheck.desc = Check nested (internal) classes to be declared at the bottom of the class after all methods (fields) declaration. + +CheckstyleTestMakeupCheck.name = Checkstyle Test Makeup +CheckstyleTestMakeupCheck.desc = Custom check to ensure Checkstyle tests are designed correctly. +CheckstyleTestMakeupCheck.createMethodRegexp = Regular expression for matching a create configuration method by name. +CheckstyleTestMakeupCheck.verifyMethodRegexp = Regular expression for matching a verify method by name. 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 15f325fdc0..f31f099f3e 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 @@ -160,5 +160,24 @@ + + + %CheckstyleTestMakeupCheck.desc + + + %CheckstyleTestMakeupCheck.createMethodRegexp + + + + %CheckstyleTestMakeupCheck.verifyMethodRegexp + + + + + + + + + diff --git a/sevntu-checks/sevntu-checks.xml b/sevntu-checks/sevntu-checks.xml index 931a3ecc1d..7e624eca0a 100644 --- a/sevntu-checks/sevntu-checks.xml +++ b/sevntu-checks/sevntu-checks.xml @@ -188,6 +188,7 @@ + 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 new file mode 100644 index 0000000000..2cc0fc7b3e --- /dev/null +++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/design/CheckstyleTestMakeupCheck.java @@ -0,0 +1,426 @@ +//////////////////////////////////////////////////////////////////////////////// +// 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.design; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.regex.Pattern; + +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.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.AnnotationUtility; +import com.puppycrawl.tools.checkstyle.utils.ScopeUtils; + +/** + *

      + * Custom check to ensure Checkstyle tests are designed correctly. + *

      + * + *

      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 + * used in creating regression reports. + * + *

      + * Check have following options: + *

      + *
        + *
      • + * createMethodRegexp - Regular expression for matching a create configuration method by name. This + * is the name of the method that starts creating a custom module configuration to be used for + * verifying results for regression purposes. + * Default value is {@code create(Root|Module)Config|getModuleConfig}.
      • + * + *
      • + * verifyMethodRegexp - Regular expression for matching a verify method by name. This is the name + * of the method that verifies the execution results of the custom configuration created for + * regression. As such, it should accept the custom configuration as a parameter. + * Default value is {@code verify(Warns|Suppressed)?}.
      • + *
      + * + *

      + * To configure the check to report incorrectly made checkstyle tests: + *

      + * + *
      + * <module name="CheckstyleTestMakeup"/>
      + * 
      + * + * @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. */ + public static final String MSG_KEY_CONFIG_NOT_ASSIGNED_WITH = "tester.config.not.assigned.with"; + /** Violations message. */ + public static final String MSG_KEY_CONFIG_NOT_ASSIGNED_PROPERLY = + "tester.config.not.assigned.properly"; + /** Violations message. */ + public static final String MSG_KEY_UNKNOWN_PROPERTY = "tester.unknown.property"; + /** Violations message. */ + public static final String MSG_KEY_CONFIG_NOT_FOUND = "tester.config.not.found"; + + /** Name of 'getPath' method. */ + private static final String METHOD_GET_PATH = "getPath"; + + /** AST of method that is currently being examined. */ + private DetailAST methodAst; + /** List of variable names that reference a file. */ + private Set fileVariableNames = new HashSet<>(); + /** List of variable names that reference a configuration. */ + private Set checkConfigNames = new HashSet<>(); + /** {@code true} if the 'verify' method was found in the method. */ + private boolean foundVerify; + + /** List of violations generated for a method. */ + private final Map violations = new HashMap<>(); + + /** Regular expression for matching a create method by name. */ + private Pattern createMethodRegexp = Pattern + .compile("create(Root|Module)Config|getModuleConfig"); + + /** Regular expression for matching a verify method by name. */ + private Pattern verifyMethodRegexp = Pattern.compile("verify(Warns|Suppressed)?"); + + /** + * Setter for {@link #createMethodRegexp}. + * @param createMethodRegexp The value to set. + */ + public void setCreateMethodRegexp(Pattern createMethodRegexp) { + this.createMethodRegexp = createMethodRegexp; + } + + /** + * Setter for {@link #verifyMethodRegexp}. + * @param verifyMethodRegexp The value to set. + */ + public void setVerifyMethodRegexp(Pattern verifyMethodRegexp) { + this.verifyMethodRegexp = verifyMethodRegexp; + } + + @Override + public int[] getDefaultTokens() { + return new int[] { + TokenTypes.METHOD_DEF, + TokenTypes.VARIABLE_DEF, + TokenTypes.METHOD_CALL, + }; + } + + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + + @Override + public void beginTree(DetailAST rootAST) { + resetInternalFields(); + } + + @Override + public void visitToken(DetailAST ast) { + switch (ast.getType()) { + case TokenTypes.METHOD_DEF: + checkMethod(ast); + break; + case TokenTypes.VARIABLE_DEF: + checkVariable(ast); + break; + case TokenTypes.METHOD_CALL: + checkMethodCall(ast); + break; + default: + Utils.reportInvalidToken(ast.getType()); + break; + } + } + + /** + * Examines the method to see if it is part of a Test. + * @param ast The method to examine. + */ + private void checkMethod(DetailAST ast) { + if (methodAst == null && AnnotationUtility.containsAnnotation(ast, "Test") + || AnnotationUtility.containsAnnotation(ast, "org.junit.Test")) { + methodAst = ast; + } + } + + /** + * Examines the variable declaration to see if it is a specific variable type to track. + * Variables of type {@link Configuration} or {@link DefaultConfiguration} need to be assigned + * a {@code null}, createModuleConfig, or createRootConfig and is tracked for future purposes. + * Variables of type {@link File} with the modifier {@code final} are tracked for future + * purposes. + * @param ast The variable to examine. + */ + private void checkVariable(DetailAST ast) { + if (methodAst != null && ScopeUtils.isLocalVariableDef(ast)) { + final DetailAST type = ast.findFirstToken(TokenTypes.TYPE).findFirstToken( + TokenTypes.IDENT); + + if (type != null) { + final String typeText = type.getText(); + + if ("DefaultConfiguration".equals(typeText) || "Configuration".equals(typeText)) { + checkConfigurationVariable(ast); + } + else if ("File".equals(typeText) + && ast.findFirstToken(TokenTypes.MODIFIERS) + .findFirstToken(TokenTypes.FINAL) != null) { + fileVariableNames.add(ast.findFirstToken(TokenTypes.IDENT).getText()); + } + } + } + } + + /** + * Examines the configuration variable to see if it is defined as described in + * {@link #checkVariable(DetailAST)}. + * @param ast The variable to examine. + */ + private void checkConfigurationVariable(DetailAST ast) { + checkConfigNames.add(ast.findFirstToken(TokenTypes.IDENT).getText()); + final DetailAST assignment = ast.findFirstToken(TokenTypes.ASSIGN); + + if (assignment == null) { + violations.put(ast, MSG_KEY_CONFIG_NOT_ASSIGNED); + } + else if (assignment.getFirstChild().getFirstChild().getType() == TokenTypes.METHOD_CALL) { + final DetailAST assignmentMethod = assignment.getFirstChild() + .getFirstChild().findFirstToken(TokenTypes.IDENT); + + if (assignmentMethod != null + && !createMethodRegexp.matcher(assignmentMethod.getText()).matches()) { + violations.put(assignment, MSG_KEY_CONFIG_NOT_ASSIGNED_WITH); + } + } + else if (assignment.getFirstChild().getFirstChild().getType() != TokenTypes.LITERAL_NULL) { + violations.put(ast, MSG_KEY_CONFIG_NOT_ASSIGNED_PROPERLY); + } + } + + /** + * Examines the method call and verify it is defined correctly. + * addAttribute method which is called by one of the configurations found earlier, must have + * all it's parameters be acceptable to {@link #isValidMethodCallExpression(DetailAST)}. + * Any method that matches {@link #verifyMethodRegexp} are tracked for future purposes. + * @param ast The method call to examine. + */ + private void checkMethodCall(DetailAST ast) { + if (methodAst != null) { + final DetailAST firstChild = ast.getFirstChild(); + final String methodCallName = getMethodCallName(firstChild); + final String methodCallerName = getMethodCallerName(firstChild); + + if ("addAttribute".equals(methodCallName) + && checkConfigNames.contains(methodCallerName)) { + final DetailAST elist = ast.findFirstToken(TokenTypes.ELIST); + + for (DetailAST expression = elist.getFirstChild(); expression != null; + expression = expression.getNextSibling()) { + if (expression.getType() == TokenTypes.EXPR + && !isValidMethodCallExpression(expression.getFirstChild())) { + violations.put(expression, MSG_KEY_UNKNOWN_PROPERTY); + } + } + } + else if (methodCallerName.equals(methodCallName) + && ast.getParent().getParent().getType() != TokenTypes.METHOD_CALL + && verifyMethodRegexp.matcher(methodCallName).matches()) { + foundVerify = true; + } + } + } + + /** + * Retrieves the name of the method being called. + * @param ast The method call token to examine. + * @return The name of the method. + */ + private String getMethodCallName(DetailAST ast) { + final String result; + if (ast.getType() == TokenTypes.DOT) { + result = getMethodCallName(ast.getFirstChild().getNextSibling()); + } + else { + result = ast.getText(); + } + return result; + } + + /** + * Retrieves the name of the variable calling the method. + * @param ast The method call token to examine. + * @return The name of who is calling the method. + */ + private String getMethodCallerName(DetailAST ast) { + final String result; + if (ast.getType() == TokenTypes.DOT) { + result = getMethodCallName(ast.getFirstChild()); + } + else { + result = ast.getText(); + } + return result; + } + + /** + * Identifies if the parameter of the method call is valid. + * Plain string literal is allowed. + * Adding multiple string literals is allowed because of line length limits. + * Plain {@code null} is allowed due to backward compatibility. + * Method calls are allowed only if they are any form of getPath, converting an enum to a + * string, or retrieving the path of a final {@link File} variable. + * @param expression The expression to examine. + * @return {@code true} if the method call is defined correctly. + */ + private boolean isValidMethodCallExpression(DetailAST expression) { + boolean result = false; + final DetailAST firstChild = expression.getFirstChild(); + + switch (expression.getType()) { + case TokenTypes.STRING_LITERAL: + result = true; + break; + case TokenTypes.METHOD_CALL: + result = isValidMethodCallExpressionMethodCall(firstChild); + break; + case TokenTypes.PLUS: + result = isValidMethodCallExpression(firstChild) + && isValidMethodCallExpression(firstChild.getNextSibling()); + break; + case TokenTypes.LITERAL_NULL: + result = true; + break; + default: + break; + } + + return result; + } + + /** + * Identifies if the inner method call of a method call is valid as defined in + * {@link #isValidMethodCallExpression(DetailAST)}. + * @param firstChild The first child of the method call. + * @return {@code true} if the method call is defined correctly. + */ + private boolean isValidMethodCallExpressionMethodCall(DetailAST firstChild) { + boolean result = false; + + if (firstChild.getType() == TokenTypes.DOT) { + if (firstChild.getFirstChild().getType() == TokenTypes.DOT) { + result = isEnumerationCall(firstChild); + } + else if (isFileVariable(firstChild.getFirstChild())) { + result = true; + } + } + else { + final String methodName = firstChild.getText(); + + if (isMethodGetPath(methodName)) { + result = true; + } + } + + return result; + } + + /** + * Checks if the method call is calling toString, getName, or name on an enumeration. + * @param ast The AST to examine. + * @return {@code true} if the method call is on a enumeration. + */ + private static boolean isEnumerationCall(DetailAST ast) { + boolean result = false; + final DetailAST firstChild = ast.getFirstChild(); + final DetailAST methodCalled = firstChild.getNextSibling(); + final DetailAST parameters = ast.getNextSibling(); + + if (firstChild.getFirstChild().getType() == TokenTypes.IDENT + && ("toString".equals(methodCalled.getText()) + || "getName".equals(methodCalled.getText()) + || "name".equals(methodCalled.getText())) + && parameters.getChildCount() == 0) { + result = true; + } + + return result; + } + + /** + * Checks if the method call is 'getPath' on a {@link File} variable. + * @param firstChild The AST to examine. + * @return {@code true} if the method call is on a file variable. + */ + private boolean isFileVariable(DetailAST firstChild) { + return METHOD_GET_PATH.equals(firstChild.getNextSibling().getText()) + && fileVariableNames.contains(firstChild.getText()); + } + + /** + * Checks if the method name is a form of 'getPath'. + * @param methodName The name to examine. + * @return {@code true} if the method is of the form. + */ + private static boolean isMethodGetPath(String methodName) { + return METHOD_GET_PATH.equals(methodName) + || "getNonCompilablePath".equals(methodName) + || "getUriString".equals(methodName) + || "getResourcePath".equals(methodName); + } + + @Override + public void leaveToken(DetailAST ast) { + if (ast == methodAst) { + if (foundVerify) { + if (checkConfigNames.isEmpty()) { + violations.put(ast, MSG_KEY_CONFIG_NOT_FOUND); + } + + for (Map.Entry entry : violations.entrySet()) { + log(entry.getKey(), entry.getValue()); + } + } + + resetInternalFields(); + } + } + + /** Resets the internal fields when a new file/method is to be processed. */ + private void resetInternalFields() { + methodAst = null; + fileVariableNames.clear(); + checkConfigNames.clear(); + foundVerify = false; + violations.clear(); + } +} 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 c480b2c883..d5ecc9e63e 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 @@ -9,3 +9,8 @@ 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}. static.method.candidate=Method {0} should be declared as static. constructor.without.params=Calls to constructors of ''{0}'' should use at least one parameter. +tester.config.not.assigned=DefaultConfiguration not assigned. +tester.config.not.assigned.with=DefaultConfiguration was not assigned by an allowed create configuration method. +tester.config.not.assigned.properly=DefaultConfiguration was not assigned properly. +tester.unknown.property=Unknown property name/value. +tester.config.not.found=DefaultConfiguration was not found. 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 new file mode 100644 index 0000000000..07eb96291d --- /dev/null +++ b/sevntu-checks/src/test/java/com/github/sevntu/checkstyle/checks/design/CheckstyleTestMakeupCheckTest.java @@ -0,0 +1,122 @@ +//////////////////////////////////////////////////////////////////////////////// +// 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.design; + +import static com.github.sevntu.checkstyle.checks.design.CheckstyleTestMakeupCheck.MSG_KEY_CONFIG_NOT_ASSIGNED; +import static com.github.sevntu.checkstyle.checks.design.CheckstyleTestMakeupCheck.MSG_KEY_CONFIG_NOT_ASSIGNED_PROPERLY; +import static com.github.sevntu.checkstyle.checks.design.CheckstyleTestMakeupCheck.MSG_KEY_CONFIG_NOT_ASSIGNED_WITH; +import static com.github.sevntu.checkstyle.checks.design.CheckstyleTestMakeupCheck.MSG_KEY_CONFIG_NOT_FOUND; +import static com.github.sevntu.checkstyle.checks.design.CheckstyleTestMakeupCheck.MSG_KEY_UNKNOWN_PROPERTY; +import static org.junit.Assert.fail; + +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; + +public class CheckstyleTestMakeupCheckTest extends BaseCheckTestSupport { + @Test + public void testMiscFile() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(CheckstyleTestMakeupCheck.class); + + final String[] expected = {}; + + verify(checkConfig, getPath("InputCheckstyleTestMakeupCheck.java"), expected); + } + + @Test + public void testValidFile() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(CheckstyleTestMakeupCheck.class); + + final String[] expected = {}; + + verify(checkConfig, getPath("InputCheckstyleTestMakeupCheckValid.java"), expected); + } + + @Test + public void testInvalidFile() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(CheckstyleTestMakeupCheck.class); + + final String[] expected = { + "8:5: " + getCheckMessage(MSG_KEY_CONFIG_NOT_FOUND), + "15:9: " + getCheckMessage(MSG_KEY_CONFIG_NOT_ASSIGNED), + "21:37: " + getCheckMessage(MSG_KEY_CONFIG_NOT_ASSIGNED_WITH), + "27:9: " + getCheckMessage(MSG_KEY_CONFIG_NOT_ASSIGNED_PROPERLY), + "36:45: " + getCheckMessage(MSG_KEY_UNKNOWN_PROPERTY), + "37:53: " + getCheckMessage(MSG_KEY_UNKNOWN_PROPERTY), + "38:44: " + getCheckMessage(MSG_KEY_UNKNOWN_PROPERTY), + "39:50: " + getCheckMessage(MSG_KEY_UNKNOWN_PROPERTY), + "40:48: " + getCheckMessage(MSG_KEY_UNKNOWN_PROPERTY), + "41:55: " + getCheckMessage(MSG_KEY_UNKNOWN_PROPERTY), + "42:33: " + getCheckMessage(MSG_KEY_UNKNOWN_PROPERTY), + "43:36: " + getCheckMessage(MSG_KEY_UNKNOWN_PROPERTY), + "44:35: " + getCheckMessage(MSG_KEY_UNKNOWN_PROPERTY), + }; + + verify(checkConfig, getPath("InputCheckstyleTestMakeupCheckInvalid.java"), expected); + } + + @Test + public void testInvalidFileIgnoreVerifies() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(CheckstyleTestMakeupCheck.class); + checkConfig.addAttribute("verifyMethodRegexp", "BAD"); + + final String[] expected = {}; + + verify(checkConfig, getPath("InputCheckstyleTestMakeupCheckInvalid.java"), expected); + } + + @Test + public void testInvalidFileIgnoreCreates() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(CheckstyleTestMakeupCheck.class); + checkConfig.addAttribute("createMethodRegexp", "BAD"); + + final String[] expected = { + "16:36: " + getCheckMessage(MSG_KEY_CONFIG_NOT_ASSIGNED_WITH), + "22:43: " + getCheckMessage(MSG_KEY_CONFIG_NOT_ASSIGNED_WITH), + "28:36: " + getCheckMessage(MSG_KEY_CONFIG_NOT_ASSIGNED_WITH), + }; + + verify(checkConfig, getPath("InputCheckstyleTestMakeupCheckValid.java"), expected); + } + + @Test + public void testInvalidToken() { + final DetailAST parent = new DetailAST(); + parent.setType(TokenTypes.OBJBLOCK); + + final CheckstyleTestMakeupCheck check = new CheckstyleTestMakeupCheck(); + try { + check.visitToken(parent); + fail(); + } + catch (IllegalArgumentException ex) { + Assert.assertEquals("Found unsupported token: OBJBLOCK", ex.getMessage()); + } + } +} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCheckstyleTestMakeupCheck.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCheckstyleTestMakeupCheck.java new file mode 100644 index 0000000000..b1a0ef0f55 --- /dev/null +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCheckstyleTestMakeupCheck.java @@ -0,0 +1,58 @@ +package com.github.sevntu.checkstyle.checks.design; + +import org.junit.Test; + +public class InputCheckstyleTestMakeupCheck { + private String s; + + public void method1() { + } + + public void method2() { + String s = ""; + method1(); + } + + @Test + public void method3() { + } + + @org.junit.Test + public void method4() { + } + + @Test + public void method5() { + new Thread(new Runnable() { + private String s; + + @Override + public void run() { + } + }); + } + + @Test + public void method6() { + String s = ""; + java.util.List t; + method1(); + InputCheckstyleTestMakeupCheck.test(); + addAttribute("", ""); + test2().test3(); + } + + private static void test() { + } + + private static void addAttribute(String s, String t) { + } + + private InputCheckstyleTestMakeupCheck test2() { + return this; + } + + private InputCheckstyleTestMakeupCheck test3() { + return this; + } +} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCheckstyleTestMakeupCheckInvalid.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCheckstyleTestMakeupCheckInvalid.java new file mode 100644 index 0000000000..be8f62d9a4 --- /dev/null +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCheckstyleTestMakeupCheckInvalid.java @@ -0,0 +1,87 @@ +package com.github.sevntu.checkstyle.checks.design; + +import java.io.File; + +import org.junit.Test; + +public class InputCheckstyleTestMakeupCheckInvalid { + @Test + public void method1() { + verify(); + } + + @Test + public void method2() { + DefaultConfiguration config; + verify(); + } + + @Test + public void method3() { + DefaultConfiguration config = customCreateConfig(); + verify(); + } + + @Test + public void method4() { + DefaultConfiguration config = new DefaultConfiguration(); + verify(); + } + + @Test + public void method5() { + final Configuration config = createModuleConfig(); + File file = new File(""); + file = new File(""); + config.addAttribute("", file.getPath()); + config.addAttribute("", file.getAbsolutePath()); + config.addAttribute("", customValue()); + config.addAttribute("", ENUM.TEST.getName(0)); + config.addAttribute("", ENUM.TEST.other()); + config.addAttribute("", ENUM.TEST.same.getName(0)); + config.addAttribute("", 0); + config.addAttribute("", "" + 0); + config.addAttribute("", 0 + ""); + verify(); + } + + private static String customValue() { + return null; + } + + private static void verify() { + } + + private DefaultConfiguration customCreateConfig() { + return new DefaultConfiguration(); + } + + private static DefaultConfiguration createModuleConfig() { + return new DefaultConfiguration(); + } + + private static class Configuration { + public void addAttribute(String s, String t) { + } + + public void addAttribute(String s, int i) { + } + } + + private static class DefaultConfiguration extends Configuration { + } + + private enum ENUM { + TEST; + + private static final ENUM same = TEST; + + public String other() { + return name(); + } + + public String getName(int i) { + return name(); + } + } +} diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCheckstyleTestMakeupCheckValid.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCheckstyleTestMakeupCheckValid.java new file mode 100644 index 0000000000..f696a159ba --- /dev/null +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputCheckstyleTestMakeupCheckValid.java @@ -0,0 +1,99 @@ +package com.github.sevntu.checkstyle.checks.design; + +import java.io.File; + +import org.junit.Test; + +public class InputCheckstyleTestMakeupCheckValid { + @Test + public void method1() { + final Configuration config = null; + verify(); + } + + @Test + public void method2() { + final Configuration config = createModuleConfig(); + verify(); + } + + @Test + public void method3() { + final DefaultConfiguration config = createRootConfig(); + verifyWarns(); + } + + @Test + public void method4() { + final Configuration config = createModuleConfig(); + config.addAttribute("", null); + config.addAttribute("", ""); + config.addAttribute("", "" + ""); + final File file = new File(""); + config.addAttribute("", file.getPath()); + config.addAttribute("", ENUM.TEST.toString()); + config.addAttribute("", ENUM.TEST.getName()); + config.addAttribute("", ENUM.TEST.name()); + config.addAttribute("", getPath("")); + config.addAttribute("", getNonCompilablePath("")); + config.addAttribute("", getUriString("")); + config.addAttribute("", getResourcePath("")); + verify(); + } + + @Test + public void method5() { + // simulation of PowerMockito.mock(DefaultConfiguration.class); + DefaultConfiguration config = InputCheckstyleTestMakeupCheckValid.createModuleConfig(); + verify(); + } + + private String getPath(String s) { + return s; + } + + private String getNonCompilablePath(String s) { + return s; + } + + private String getUriString(String s) { + return s; + } + + private String getResourcePath(String s) { + return s; + } + + private static void verify() { + } + + private static void verifyWarns() { + } + + private static void verifySuppressed() { + } + + private static DefaultConfiguration createModuleConfig() { + return new DefaultConfiguration(); + } + + private static DefaultConfiguration createRootConfig() { + return new DefaultConfiguration(); + } + + private static class Configuration { + public void addAttribute(String s, String t) { + } + } + + private static class DefaultConfiguration extends Configuration { + } + + private enum ENUM { + TEST; + + public String getName() { + return name(); + } + } +} 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 8b13317639..978f232515 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 @@ -904,4 +904,20 @@ Checks if a try/catch block has a junit fail assertion inside the try for a junit method. Checker/TreeWalker/com.github.sevntu.checkstyle.checks.coding.RequireFailForTryCatchInJunitCheck + + + com.github.sevntu.checkstyle.checks.design.CheckstyleTestMakeupCheck + Custom check to ensure Checkstyle tests are designed correctly. + + Custom check to ensure Checkstyle tests are designed correctly. + Checker/TreeWalker/com.github.sevntu.checkstyle.checks.design.CheckstyleTestMakeupCheck + + create(Root|Module)Config|getModuleConfig + Regular expression for matching a create configuration method by name. + + + verify(Warns|Suppressed)? + Regular expression for matching a verify method by name. + + From 73c98bcdf3bb9e103b0dea5e9be8fd92fe6a047a Mon Sep 17 00:00:00 2001 From: Roman Ivanov Date: Sat, 25 Nov 2017 15:59:48 -0800 Subject: [PATCH 133/208] version bump to 1.25.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 | 4 ++-- 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, 13 insertions(+), 13 deletions(-) diff --git a/eclipse-pom.xml b/eclipse-pom.xml index ebcbfcdd0f..0f26d1af7a 100644 --- a/eclipse-pom.xml +++ b/eclipse-pom.xml @@ -5,7 +5,7 @@ com.github.sevntu-checkstyle parent - 1.24.2 + 1.25.0 pom diff --git a/eclipsecs-sevntu-plugin-feature/feature.xml b/eclipsecs-sevntu-plugin-feature/feature.xml index 4287f37f95..ad8cb451f0 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 a7b798d2da..b9cb9d05ba 100644 --- a/eclipsecs-sevntu-plugin-feature/pom.xml +++ b/eclipsecs-sevntu-plugin-feature/pom.xml @@ -7,7 +7,7 @@ ../eclipse-pom.xml com.github.sevntu-checkstyle parent - 1.24.2 + 1.25.0 com.github.sevntu-checkstyle diff --git a/eclipsecs-sevntu-plugin/META-INF/MANIFEST.MF b/eclipsecs-sevntu-plugin/META-INF/MANIFEST.MF index fc8c315933..6221a0eb58 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.24.2 +Bundle-Version: 1.25.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 4cbcd7cbc7..c9f5af6c00 100644 --- a/eclipsecs-sevntu-plugin/pom.xml +++ b/eclipsecs-sevntu-plugin/pom.xml @@ -9,7 +9,7 @@ ../eclipse-pom.xml com.github.sevntu-checkstyle parent - 1.24.2 + 1.25.0 com.github.sevntu-checkstyle diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml index e1b1455ef4..ff9085797d 100644 --- a/sevntu-checks/pom.xml +++ b/sevntu-checks/pom.xml @@ -11,7 +11,7 @@ com.github.sevntu-checkstyle sevntu-checks - 1.24.2 + 1.25.0 iso-8859-1 @@ -289,7 +289,7 @@ .ci/eclipse-compiler-javac.sh test - + ${checkstyle.version} 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-checkstyle sevntu-checkstyle-idea-extension - 1.24.2 + 1.25.0 jar Sevntu 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-checkstyle sevntu-checkstyle-maven-plugin Sevntu Checkstyle Maven Plugin - 1.24.2 + 1.25.0 @@ -25,7 +25,7 @@ com.github.sevntu-checkstyle sevntu-checks - 1.24.2 + 1.25.0 org.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-checkstyle sevntu-checkstyle-sonar-plugin - 1.24.2 + 1.25.0 sonar-plugin SevNTU 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.xml com.github.sevntu-checkstyle parent - 1.24.2 + 1.25.0 com.github.sevntu.checkstyle.p2updatesite From bc0a3cadf8312ac0a458b0a319ec03abd0fcdc48 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.5 https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.version}/config/checkstyle_checks.xml 7.6 From 37eef1c982799d90bf7d5d342cfb80d86a4a4fda 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-staging https://oss.sonatype.org/ - false + true true 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-staging https://oss.sonatype.org/ - false + true true 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-staging https://oss.sonatype.org/ - false + true true 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-staging https://oss.sonatype.org/ - false + true true From 801f617b4f78e4dd124a07166f8dcd96ec566737 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 15e9eb21af14f26a439d80f61ddf39b176f74315 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 879fcda2ca44327fbee9d7ed58b7e47ad1d9eefe 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.6 https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.version}/config/checkstyle_checks.xml 7.6 From 3f95bd567d9cba32ac735d645d24a038624b0417 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.7 https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.version}/config/checkstyle_checks.xml 7.6 From cbaabb83c7a251dd6eadef9bd8057c7a20416c57 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.7 https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.version}/config/checkstyle_checks.xml - 7.6 + 8.5 2.17 RELEASE 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.5 2.17 From 1cd1b20f2523db7b5cb4cccc08c28fb7072f694f 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-checkstyle parent - 1.25.0 + 1.26.0 pom 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.xml com.github.sevntu-checkstyle parent - 1.25.0 + 1.26.0 com.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.xml com.github.sevntu-checkstyle parent - 1.25.0 + 1.26.0 com.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-checkstyle sevntu-checks - 1.25.0 + 1.26.0 iso-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-checkstyle sevntu-checkstyle-idea-extension - 1.25.0 + 1.26.0 jar Sevntu 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-checkstyle sevntu-checkstyle-maven-plugin Sevntu Checkstyle Maven Plugin - 1.25.0 + 1.26.0 @@ -25,7 +25,7 @@ com.github.sevntu-checkstyle sevntu-checks - 1.25.0 + 1.26.0 org.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-checkstyle sevntu-checkstyle-sonar-plugin - 1.25.0 + 1.26.0 sonar-plugin SevNTU 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.xml com.github.sevntu-checkstyle parent - 1.25.0 + 1.26.0 com.github.sevntu.checkstyle.p2updatesite From 68da85a8204ce047862d95e13e56137e4419f4ce 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 70aad13937f61086d9083e177a43c8343e6d0905 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.xml 8.5 + https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.eclipse-cs.version}/config/checkstyle_checks.xml 2.17 RELEASE @@ -172,7 +170,7 @@ com.puppycrawl.tools checkstyle - ${checkstyle.version} + ${checkstyle.eclipse-cs.version} @@ -290,7 +288,7 @@ test - ${checkstyle.version} + ${checkstyle.eclipse-cs.version} @@ -335,7 +333,7 @@ com.puppycrawl.tools checkstyle - ${checkstyle.version} + ${checkstyle.eclipse-cs.version} From c8eed13256afab9350a8b4fe18148dde8dcb293b 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 5d1e45e797a700df895b639057bda3b563c012fe 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 ad217170e13d3f34049d3729ef0919c4f4607ffa 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 249834a8427765ec9d525f1849349cd6d416c798 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 2bd4673a35fe5f9f7d8a7a7376b5bdc5a7bbffcb 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 78aba1809fe48ccba9fdb0b7ede3a84469b9ca61 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 079529ef9308e7b5864f79e85a0238a3dadd984f 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 5c506d982b4439433fb4fe69a0679b1225250fa8 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.7 https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.eclipse-cs.version}/config/checkstyle_checks.xml 2.17 RELEASE 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.7 2.17 From 58726d677003f541141ff0978a9f1c1639bce770 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-checkstyle parent - 1.26.0 + 1.27.0 pom 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.xml com.github.sevntu-checkstyle parent - 1.26.0 + 1.27.0 com.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.xml com.github.sevntu-checkstyle parent - 1.26.0 + 1.27.0 com.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-checkstyle sevntu-checks - 1.26.0 + 1.27.0 iso-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-checkstyle sevntu-checkstyle-idea-extension - 1.26.0 + 1.27.0 jar Sevntu 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-checkstyle sevntu-checkstyle-maven-plugin Sevntu Checkstyle Maven Plugin - 1.26.0 + 1.27.0 @@ -25,7 +25,7 @@ com.github.sevntu-checkstyle sevntu-checks - 1.26.0 + 1.27.0 org.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-checkstyle sevntu-checkstyle-sonar-plugin - 1.26.0 + 1.27.0 sonar-plugin SevNTU 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.xml com.github.sevntu-checkstyle parent - 1.26.0 + 1.27.0 com.github.sevntu.checkstyle.p2updatesite From a4c6feb638c9d74be6754cad984bba7643ce3f1e 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 9fa1db9f4a4859c4bc5b7bd6f6c25c3433d66dd3 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 c99f4072fa50cd475a396ae3c19130f124919d6a 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-test prepare-agent - report + post-unit-test report - prepare-package + test org.eluder.coveralls coveralls-maven-plugin - 2.2.0 + 4.3.0 @@ -313,15 +307,7 @@ selftesting - true - true - true - true - true - true - true - true - true + false From f196b84297df7d4b9de0ee244076e5691f704e5f 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, 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 9be14868c0ffed2d86bf394549e523cd237f5255 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.8 https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.eclipse-cs.version}/config/checkstyle_checks.xml 2.17 RELEASE From 6f893c90fd8ebc5962829bbc5a4fa31ce3ad8084 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 9a44205336a69789c628e748e7a97e32015dc5a7 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:
      1. Method name regexp;
      2. 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:

    2. Method name regexp = "assert(True|False)"
    3. Argument count range = "1"


    4. . 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-". + *
      + * + *

      An example configuration: + *

      + * <module name="ForbidCertainMethodCheck">
      + *    <property name="methodName" value="exit"/>
      + * </module>
      + * <module name="ForbidCertainMethodCheck">
      + *    <property name="methodName" value="assert(True|False)"/>
      + *    <property name="argumentCount" value="1"/>
      + * </module>
      + * <module name="ForbidCertainMethodCheck">
      + *    <property name="methodName" value="assertEquals"/>
      + *    <property name="argumentCount" value="2"/>
      + * </module>
      + * 
      + * 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. + * + *
      + * <module name="ForbidCertainMethodCheck">
      + *    <property name="methodName" value="asList"/>
      + *    <property name="argumentCount" value="-3, 5-7, 9-"/>
      + * </module>
      + * 
      + * + *

      + * 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.ForbidInstantiationCheck Forbid Instantiation From b5cbdf9eff5f56a53ab0bb4adc53c115d9f6d941 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-checkstyle parent - 1.27.0 + 1.28.0 pom 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.xml com.github.sevntu-checkstyle parent - 1.27.0 + 1.28.0 com.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.xml com.github.sevntu-checkstyle parent - 1.27.0 + 1.28.0 com.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-checkstyle sevntu-checks - 1.27.0 + 1.28.0 iso-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-checkstyle sevntu-checkstyle-idea-extension - 1.27.0 + 1.28.0 jar Sevntu 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-checkstyle sevntu-checkstyle-maven-plugin Sevntu Checkstyle Maven Plugin - 1.27.0 + 1.28.0 @@ -25,7 +25,7 @@ com.github.sevntu-checkstyle sevntu-checks - 1.27.0 + 1.28.0 org.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-checkstyle sevntu-checkstyle-sonar-plugin - 1.27.0 + 1.28.0 sonar-plugin SevNTU 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.xml com.github.sevntu-checkstyle parent - 1.27.0 + 1.28.0 com.github.sevntu.checkstyle.p2updatesite From 3797be217b0c5053821c96fc79fe91a30acd6a07 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 893e1f4335a48c031a58284438e3772017d6a1b3 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 7f181e84c00626ea2ab6b23f2aaf29876dc21f93 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 5acceeb4975f1d9f6016335d55721edbd5d3be5b 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 078af38adf6488118d64ba1db59eddc1c8235857 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 607ef7e29ff3ae6f389c55ec676bd29d6b7ae42d 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.8 https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.eclipse-cs.version}/config/checkstyle_checks.xml 2.17 @@ -321,7 +321,7 @@ checkstyle ${checkstyle.eclipse-cs.version} - + com.github.sevntu-checkstyle sevntu-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:

        * *
        - * <module name="SimpleAccesorNameNotationCheck"> <
        + * <module name="SimpleAccessorNameNotationCheck"> <
          * property name="prefix" value="m_"/>
          * </module>
          * 
        @@ -285,7 +285,7 @@ private static boolean containsOnlyReturn(DetailAST methodBody) { * Return true when getter has correct arguments of return. *

        * @param literalReturn - * - DeailAST contains LITERAL_RETURN + * - DetailAST contains LITERAL_RETURN * @return - true when getter has correct return. */ private static boolean isCorrectReturn(DetailAST literalReturn) { 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 9f3cfc7dea..4598c02e59 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 @@ -37,7 +37,7 @@ *

        * 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:
          * 
        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 8f8bff487e..3226bfbdc5 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
        @@ -38,7 +38,7 @@
          * 

        * *

        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, 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.NoMainMethodInAbstractClassCheck
             No 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.PublicReferenceToPrivateTypeCheck
             Public 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 0c0296b3a3fa325e0173dcf3d1e21ee0f5478cd0 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 met1() { From 781731b6db487799ca397bacdf4f381d292276b6 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.9 https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.eclipse-cs.version}/config/checkstyle_checks.xml 2.17 RELEASE From 525fe9bc0eaf2f2ff86d78104b7c23aa182a3f11 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.:

        String str = null;
        String x = str != null ? "A" : "B" + str == null ? "C" : "D";
        System.out.println(x);

        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:

        callString = "{? = call " +
        (StringUtils.hasLength(catalogNameToUse) ? catalogNameToUse + "." : "") +
        (StringUtils.hasLength(schemaNameToUse) ? schemaNameToUse + "." : "") +
        procedureNameToUse + "(";

        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.:

        String str = null;
        String x = str != null ? "A" : "B" + str == null ? "C" : "D";
        System.out.println(x);

        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:

        callString = "{? = call " +
        (StringUtils.hasLength(catalogNameToUse) ? catalogNameToUse + "." : "") +
        (StringUtils.hasLength(schemaNameToUse) ? schemaNameToUse + "." : "") +
        procedureNameToUse + "(";

        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.
        }
        }

        @author Zuy Alexey +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 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.

        Joshua Bloch, "Effective Java (2nd edition)" Item 28: page 137 :

        "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 c19588f94b3edd11dd23d8bf262e80bc155ddb18 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):

        1. "Field" to denote the Fields
        2. "DeclareAnnonClassField" to denote the fields keeping objects of anonymous classes
        3. "Ctor" to denote the Constructors
        4. "Method" to denote the Methods
        5. "GetterSetter" to denote the group of getter and setter methods
        6. "MainMethod" to denote the main method
        7. "InnerClass" to denote the Inner Classes
        8. "InnerInterface" to denote the Inner Interfaces
        9. "InnerEnum" to denote the Inner Enums

        RegExp can include:

        1. Annotations
        2. Modifiers(public, protected, private, abstract, static,final)
        3. Type
        4. Name

        ATTENTION!

        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.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):

        1. "Field" to denote the Fields
        2. "DeclareAnonClassField" to denote the fields keeping objects of anonymous classes
        3. "Ctor" to denote the Constructors
        4. "Method" to denote the Methods
        5. "GetterSetter" to denote the group of getter and setter methods
        6. "MainMethod" to denote the main method
        7. "InnerClass" to denote the Inner Classes
        8. "InnerInterface" to denote the Inner Interfaces
        9. "InnerEnum" to denote the Inner Enums

        RegExp can include:

        1. Annotations
        2. Modifiers(public, protected, private, abstract, static,final)
        3. Type
        4. Name

        ATTENTION!

        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): *
          *
        1. "Field" to denote the Fields
        2. - *
        3. "DeclareAnnonClassField" to denote the fields keeping objects of anonymous classes
        4. + *
        5. "DeclareAnonClassField" to denote the fields keeping objects of anonymous classes
        6. *
        7. "Ctor" to denote the Constructors
        8. *
        9. "Method" to denote the Methods
        10. *
        11. "GetterSetter" to denote the group of getter and setter methods
        12. @@ -203,7 +203,7 @@ public class CustomDeclarationOrderCheck extends AbstractCheck { private static final String METHOD_MACRO = "Method"; - private static final String ANNON_CLASS_FIELD_MACRO = "DeclareAnnonClassField"; + private static final String ANON_CLASS_FIELD_MACRO = "DeclareAnonClassField"; private static final String FIELD_MACRO = "Field"; @@ -454,7 +454,7 @@ private static int convertMacroToTokenType( String inputMemberName) { int result = -1; if (FIELD_MACRO.equalsIgnoreCase(inputMemberName) - || ANNON_CLASS_FIELD_MACRO.equalsIgnoreCase(inputMemberName)) { + || ANON_CLASS_FIELD_MACRO.equalsIgnoreCase(inputMemberName)) { result = TokenTypes.VARIABLE_DEF; } else if (GETTER_SETTER_MACRO.equalsIgnoreCase(inputMemberName) @@ -605,7 +605,7 @@ private int getPositionInOrderDeclaration(final DetailAST ast) { final FormatMatcher currentRule = customOrderDeclaration.get(index); if (currentRule.getClassMember() == ast.getType() && currentRule.getRegexp().matcher(modifiers).find()) { - if (currentRule.hasRule(ANNON_CLASS_FIELD_MACRO) + if (currentRule.hasRule(ANON_CLASS_FIELD_MACRO) || currentRule.hasRule(GETTER_SETTER_MACRO) || currentRule.hasRule(MAIN_METHOD_MACRO)) { final String methodName = getIdentifier(ast); 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 7567ecea66..83fc7d2750 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 @@ -91,22 +91,22 @@ public void anonymousClasses() final DefaultConfiguration checkConfig = createModuleConfig(CustomDeclarationOrderCheck.class); final String[] expected = { - "39:5: " + getCheckMessage(MSG_KEY_FIELD, "DeclareAnnonClassField(private .*)", + "39:5: " + getCheckMessage(MSG_KEY_FIELD, "DeclareAnonClassField(private .*)", "Field(public .*)"), - "54:5: " + getCheckMessage(MSG_KEY_FIELD, "DeclareAnnonClassField(private .*)", + "54:5: " + getCheckMessage(MSG_KEY_FIELD, "DeclareAnonClassField(private .*)", "Field(private .*)"), - "66:5: " + getCheckMessage(MSG_KEY_FIELD, "DeclareAnnonClassField()", + "66:5: " + getCheckMessage(MSG_KEY_FIELD, "DeclareAnonClassField()", "Ctor(public .*)"), - "95:9: " + getCheckMessage(MSG_KEY_FIELD, "DeclareAnnonClassField(private .*)", + "95:9: " + getCheckMessage(MSG_KEY_FIELD, "DeclareAnonClassField(private .*)", "Field(private .*)"), }; checkConfig .addAttribute( "customDeclarationOrder", - "DeclareAnnonClassField(private .*) ###" - + "DeclareAnnonClassField(protected .*) ###" - + "DeclareAnnonClassField() ###" - + "DeclareAnnonClassField(public .*) ###" + "DeclareAnonClassField(private .*) ###" + + "DeclareAnonClassField(protected .*) ###" + + "DeclareAnonClassField() ###" + + "DeclareAnonClassField(public .*) ###" + "Field(private .*) ###" + "Field(public .*) ###" + "Ctor(public .*) ###" From b01320a365e777cd78e6e9d30150aab29396753a Mon Sep 17 00:00:00 2001 From: Roman Ivanov Date: Fri, 6 Apr 2018 05:39:22 -0700 Subject: [PATCH 171/208] config: version bump to 1.29.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 9420f5510b..198cf2f29f 100644 --- a/eclipse-pom.xml +++ b/eclipse-pom.xml @@ -5,7 +5,7 @@ com.github.sevntu-checkstyle parent - 1.28.0 + 1.29.0 pom diff --git a/eclipsecs-sevntu-plugin-feature/feature.xml b/eclipsecs-sevntu-plugin-feature/feature.xml index 229abef370..e38f226ce2 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 a433339008..09aa736fb5 100644 --- a/eclipsecs-sevntu-plugin-feature/pom.xml +++ b/eclipsecs-sevntu-plugin-feature/pom.xml @@ -7,7 +7,7 @@ ../eclipse-pom.xml com.github.sevntu-checkstyle parent - 1.28.0 + 1.29.0 com.github.sevntu-checkstyle diff --git a/eclipsecs-sevntu-plugin/META-INF/MANIFEST.MF b/eclipsecs-sevntu-plugin/META-INF/MANIFEST.MF index a28b2ff93d..34e4c943cb 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.28.0 +Bundle-Version: 1.29.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 ab763f9b27..dd3f92bd69 100644 --- a/eclipsecs-sevntu-plugin/pom.xml +++ b/eclipsecs-sevntu-plugin/pom.xml @@ -9,7 +9,7 @@ ../eclipse-pom.xml com.github.sevntu-checkstyle parent - 1.28.0 + 1.29.0 com.github.sevntu-checkstyle diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml index 097246993e..13e79ac8ee 100644 --- a/sevntu-checks/pom.xml +++ b/sevntu-checks/pom.xml @@ -11,7 +11,7 @@ com.github.sevntu-checkstyle sevntu-checks - 1.28.0 + 1.29.0 iso-8859-1 diff --git a/sevntu-checkstyle-idea-extension/pom.xml b/sevntu-checkstyle-idea-extension/pom.xml index bc69779c3e..1187ee7c13 100644 --- a/sevntu-checkstyle-idea-extension/pom.xml +++ b/sevntu-checkstyle-idea-extension/pom.xml @@ -11,7 +11,7 @@ com.github.sevntu-checkstyle sevntu-checkstyle-idea-extension - 1.28.0 + 1.29.0 jar Sevntu Checkstyle Idea extension diff --git a/sevntu-checkstyle-maven-plugin/pom.xml b/sevntu-checkstyle-maven-plugin/pom.xml index 5b4bb09255..a9658cc456 100644 --- a/sevntu-checkstyle-maven-plugin/pom.xml +++ b/sevntu-checkstyle-maven-plugin/pom.xml @@ -12,7 +12,7 @@ com.github.sevntu-checkstyle sevntu-checkstyle-maven-plugin Sevntu Checkstyle Maven Plugin - 1.28.0 + 1.29.0 @@ -25,7 +25,7 @@ com.github.sevntu-checkstyle sevntu-checks - 1.28.0 + 1.29.0 org.apache.maven.plugins diff --git a/sevntu-checkstyle-sonar-plugin/pom.xml b/sevntu-checkstyle-sonar-plugin/pom.xml index e46eb6403d..fcc0ccb192 100644 --- a/sevntu-checkstyle-sonar-plugin/pom.xml +++ b/sevntu-checkstyle-sonar-plugin/pom.xml @@ -11,7 +11,7 @@ com.github.sevntu-checkstyle sevntu-checkstyle-sonar-plugin - 1.28.0 + 1.29.0 sonar-plugin SevNTU Checkstyle Sonar Extension Plugin diff --git a/update-site/pom.xml b/update-site/pom.xml index ff74847374..20830bdc41 100644 --- a/update-site/pom.xml +++ b/update-site/pom.xml @@ -7,7 +7,7 @@ ../eclipse-pom.xml com.github.sevntu-checkstyle parent - 1.28.0 + 1.29.0 com.github.sevntu.checkstyle.p2updatesite From 34e5938bcaf7ac472143b99d810fff0b34f421c5 Mon Sep 17 00:00:00 2001 From: Roman Ivanov Date: Mon, 30 Apr 2018 09:47:46 -0700 Subject: [PATCH 172/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 13e79ac8ee..9dd029ed0d 100644 --- a/sevntu-checks/pom.xml +++ b/sevntu-checks/pom.xml @@ -16,7 +16,7 @@ iso-8859-1 - 8.9 + 8.10 https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.eclipse-cs.version}/config/checkstyle_checks.xml 2.17 RELEASE From 703f8e50511065d51a2d1aa9185c38bbe5fac39f Mon Sep 17 00:00:00 2001 From: rnveach Date: Sat, 26 May 2018 20:31:58 -0400 Subject: [PATCH 173/208] Issue #662: moved easy Checks to log AST --- .../checkstyle/checks/coding/ForbidCertainMethodCheck.java | 2 +- .../checks/coding/WhitespaceBeforeArrayInitializerCheck.java | 2 +- .../checks/design/HideUtilityClassConstructorCheck.java | 2 +- .../github/sevntu/checkstyle/checks/design/InnerClassCheck.java | 2 +- .../checkstyle/checks/naming/UniformEnumConstantNameCheck.java | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) 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 716bc66ae1..9ed480851b 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 @@ -162,7 +162,7 @@ public void visitToken(DetailAST ast) { } final int numArgsInCode = dot.getNextSibling().getChildCount(TokenTypes.EXPR); if (isForbiddenMethod(ast, methodNameInCode, numArgsInCode)) { - log(ast.getLineNo(), ast.getColumnNo(), MSG_KEY, methodNameInCode, methodName, + log(ast, MSG_KEY, methodNameInCode, methodName, numArgsInCode, argumentCount); } break; 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 f518157671..0901a66228 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 @@ -78,7 +78,7 @@ public int[] getRequiredTokens() { public void visitToken(DetailAST ast) { final DetailAST previousAst = getPreviousAst(ast); if (!areTokensSeparatedByWhitespace(previousAst, ast) && isNestedArrayInitializer(ast)) { - log(ast.getLineNo(), ast.getColumnNo(), MSG_KEY); + log(ast, MSG_KEY); } } 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 489e8f6f5b..c4375723de 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 @@ -119,7 +119,7 @@ public void visitToken(DetailAST ast) { && hasNonPrivateStaticMethodOrField; if (isUtilClass && (hasAccessibleCtor && !hasStaticModifier)) { - log(ast.getLineNo(), ast.getColumnNo(), MSG_KEY); + log(ast, MSG_KEY); } } } 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 53e83693a2..2c0f407450 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 @@ -70,7 +70,7 @@ public void visitToken(DetailAST ast) { && nextSibling.getType() != TokenTypes.CLASS_DEF) { if (nextSibling.getType() == TokenTypes.VARIABLE_DEF || nextSibling.getType() == TokenTypes.METHOD_DEF) { - log(nextSibling.getLineNo(), nextSibling.getColumnNo(), MSG_KEY); + log(nextSibling, MSG_KEY); } nextSibling = nextSibling.getNextSibling(); } 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 1a006ac322..68cbee5a95 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 @@ -200,7 +200,7 @@ private void logViolation(DetailAST member, String enumName, BitSet violated) { } patternsString = violatedPatterns.toString(); } - log(member.getLineNo(), member.getColumnNo(), msgKey, enumName, + log(member, msgKey, enumName, patternsString); } From 52b1c17689a6395277226e2c35ae32af5d80de60 Mon Sep 17 00:00:00 2001 From: rnveach Date: Sat, 26 May 2018 21:17:27 -0400 Subject: [PATCH 174/208] Issue #662: moved line only Checks to log AST (part 1) --- .../annotation/ForbidAnnotationCheck.java | 2 +- ...onstantAsFirstOperandInConditionCheck.java | 2 +- ...efaultSerializableInInnerClassesCheck.java | 2 +- .../coding/ConfusingConditionCheck.java | 2 +- .../coding/CustomDeclarationOrderCheck.java | 2 +- .../coding/FinalizeImplementationCheck.java | 2 +- .../coding/ForbidCertainImportsCheck.java | 2 +- .../ForbidReturnInFinallyBlockCheck.java | 2 +- .../ForbidThrowAnonymousExceptionsCheck.java | 4 +- .../annotation/ForbidAnnotationCheckTest.java | 40 +++--- ...antAsFirstOperandInConditionCheckTest.java | 120 +++++++++--------- ...ltSerializableInInnerClassesCheckTest.java | 54 ++++---- .../coding/ConfusingConditionCheckTest.java | 110 ++++++++-------- .../CustomDeclarationOrderCheckTest.java | 10 +- .../FinalizeImplementationCheckTest.java | 14 +- .../coding/ForbidCertainImportsCheckTest.java | 16 +-- .../ForbidReturnInFinallyBlockCheckTest.java | 10 +- ...rbidThrowAnonymousExceptionsCheckTest.java | 22 ++-- 18 files changed, 209 insertions(+), 207 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 036e0cb0b2..d8db5db57b 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 @@ -109,7 +109,7 @@ public void visitToken(DetailAST annotation) { && isForbiddenAnnotationTarget(targetType)) { final String currentTarget = annotationTarget.getText(); - log(annotation.getLineNo(), MSG_KEY, + log(annotation, MSG_KEY, currentTarget, annotationName); } } 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 b48ae43500..6df86449ff 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 @@ -109,7 +109,7 @@ public int[] getRequiredTokens() { @Override public void visitToken(DetailAST detailAST) { if (isRefactoringRequired(detailAST)) { - log(detailAST.getLineNo(), MSG_KEY, + log(detailAST, MSG_KEY, detailAST.getText()); } } 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 763bfab221..bd60b0075f 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 @@ -83,7 +83,7 @@ public void visitToken(DetailAST detailAST) { && !hasSerialazableMethods(detailAST)) { final DetailAST implementsBlock = detailAST .findFirstToken(TokenTypes.IMPLEMENTS_CLAUSE); - log(implementsBlock.getLineNo(), + log(implementsBlock, MSG_KEY); } } 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 108cab65f6..808bbad9e6 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 @@ -177,7 +177,7 @@ public void visitToken(DetailAST literalIf) { if (isRatioBetweenIfAndElseBlockSuitable(literalIf) && !(ignoreNullCaseInIf && isIfWithNull(literalIf)) && isConditionAllNegative(literalIf)) { - log(literalIf.getLineNo(), MSG_KEY); + log(literalIf, MSG_KEY); } } } 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 4d11850ab7..3281660e10 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 @@ -558,7 +558,7 @@ private void logWrongOrderedSetters(Map gettersSetters) { final DetailAST setterAst = entry.getKey(); final DetailAST getterAst = entry.getValue(); - log(setterAst.getLineNo(), + log(setterAst, MSG_KEY_INVALID_SETTER, getIdentifier(setterAst), getIdentifier(getterAst)); 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 fef76f0341..25e5f7f6a2 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 @@ -109,7 +109,7 @@ public void visitToken(DetailAST methodDefToken) { final String warningMessage = validateFinalizeMethod(methodDefToken); if (warningMessage != null) { - log(methodDefToken.getLineNo(), warningMessage); + log(methodDefToken, warningMessage); } } } 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 d1be90e5aa..22449a9d9f 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 @@ -206,7 +206,7 @@ private boolean isImportForbidden(String importText) { * import to be warned. */ private void log(DetailAST nodeToWarn, String importText) { - log(nodeToWarn.getLineNo(), MSG_KEY, + log(nodeToWarn, MSG_KEY, getForbiddenImportRegexp(), importText); } 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 ef6713ba2e..36f891f082 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 @@ -70,7 +70,7 @@ public void visitToken(DetailAST finallyNode) { for (DetailAST returnNode : listOfReturnNodes) { if (!isReturnInMethodDefinition(returnNode)) { - log(finallyNode.getLineNo(), MSG_KEY); + log(finallyNode, MSG_KEY); } } } 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 f5cd575567..320031a827 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 @@ -124,7 +124,7 @@ private void identifyThrowingAnonymousException(DetailAST throwDefAst) { if (throwingLiteralNewAst != null && hasObjectBlock(throwingLiteralNewAst)) { - log(throwDefAst.getLineNo(), MSG_KEY); + log(throwDefAst, MSG_KEY); } else if (throwingLiteralNewAst == null) { final DetailAST throwingExceptionNameAst = getThrowingExceptionNameAst(throwDefAst @@ -132,7 +132,7 @@ else if (throwingLiteralNewAst == null) { if (throwingExceptionNameAst != null && anonymousExceptions.contains(throwingExceptionNameAst .getText())) { - log(throwDefAst.getLineNo(), MSG_KEY); + log(throwDefAst, MSG_KEY); } } } 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 fe13c014b4..8f9df149e4 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 @@ -80,10 +80,10 @@ public void testVariableIsForbidden() throws Exception { checkConfig.addAttribute("annotationTargets", "VARIABLE_DEF"); final String[] expected2 = { - "13: " + getCheckMessage(MSG_KEY, "VARIABLE_DEF", "Edible"), - "20: " + getCheckMessage(MSG_KEY, "VARIABLE_DEF", "Author"), - "21: " + getCheckMessage(MSG_KEY, "VARIABLE_DEF", "Author2"), - "59: " + getCheckMessage(MSG_KEY, "VARIABLE_DEF", "SuppressWarnings"), + "13:5: " + getCheckMessage(MSG_KEY, "VARIABLE_DEF", "Edible"), + "20:7: " + getCheckMessage(MSG_KEY, "VARIABLE_DEF", "Author"), + "21:7: " + getCheckMessage(MSG_KEY, "VARIABLE_DEF", "Author2"), + "59:7: " + getCheckMessage(MSG_KEY, "VARIABLE_DEF", "SuppressWarnings"), }; verify(checkConfig, getPath("InputForbidAnnotationCheck.java"), expected2); @@ -97,11 +97,11 @@ public void testMethodIsForbidden() throws Exception { checkConfig.addAttribute("annotationTargets", "METHOD_DEF"); final String[] expected3 = { - "28: " + getCheckMessage(MSG_KEY, "METHOD_DEF", "Twizzle"), - "39: " + getCheckMessage(MSG_KEY, "METHOD_DEF", "One"), - "40: " + getCheckMessage(MSG_KEY, "METHOD_DEF", "Two"), - "41: " + getCheckMessage(MSG_KEY, "METHOD_DEF", "Three"), - "47: " + getCheckMessage(MSG_KEY, "METHOD_DEF", "B"), + "28:7: " + getCheckMessage(MSG_KEY, "METHOD_DEF", "Twizzle"), + "39:7: " + getCheckMessage(MSG_KEY, "METHOD_DEF", "One"), + "40:7: " + getCheckMessage(MSG_KEY, "METHOD_DEF", "Two"), + "41:7: " + getCheckMessage(MSG_KEY, "METHOD_DEF", "Three"), + "47:9: " + getCheckMessage(MSG_KEY, "METHOD_DEF", "B"), }; verify(checkConfig, getPath("InputForbidAnnotationCheck.java"), expected3); @@ -115,9 +115,9 @@ public void testClassAndConstuctorIsForbidden() throws Exception { checkConfig.addAttribute("annotationTargets", "CLASS_DEF,CTOR_DEF"); final String[] expected4 = { - "6: " + getCheckMessage(MSG_KEY, "CLASS_DEF", "Test"), - "8: " + getCheckMessage(MSG_KEY, "CTOR_DEF", "ctor"), - "9: " + getCheckMessage(MSG_KEY, "CTOR_DEF", "ctor2"), + "6:1: " + getCheckMessage(MSG_KEY, "CLASS_DEF", "Test"), + "8:5: " + getCheckMessage(MSG_KEY, "CTOR_DEF", "ctor"), + "9:5: " + getCheckMessage(MSG_KEY, "CTOR_DEF", "ctor2"), }; verify(checkConfig, getPath("InputForbidAnnotationCheck.java"), expected4); @@ -131,8 +131,8 @@ public void testAnnotationIsForbidden() throws Exception { checkConfig.addAttribute("annotationTargets", "ANNOTATION_DEF"); final String[] expected5 = { - "34: " + getCheckMessage(MSG_KEY, "ANNOTATION_DEF", "Retention"), - "35: " + getCheckMessage(MSG_KEY, "ANNOTATION_DEF", "Target"), + "34:7: " + getCheckMessage(MSG_KEY, "ANNOTATION_DEF", "Retention"), + "35:7: " + getCheckMessage(MSG_KEY, "ANNOTATION_DEF", "Target"), }; verify(checkConfig, getPath("InputForbidAnnotationCheck.java"), expected5); @@ -147,8 +147,8 @@ public void testParameterAndInterfaceIsForbidden() throws Exception { "PARAMETER_DEF,INTERFACE_DEF"); final String[] expected6 = { - "43: " + getCheckMessage(MSG_KEY, "PARAMETER_DEF", "MyAnnotation"), - "45: " + getCheckMessage(MSG_KEY, "INTERFACE_DEF", "A"), + "43:17: " + getCheckMessage(MSG_KEY, "PARAMETER_DEF", "MyAnnotation"), + "45:7: " + getCheckMessage(MSG_KEY, "INTERFACE_DEF", "A"), }; verify(checkConfig, getPath("InputForbidAnnotationCheck.java"), expected6); @@ -163,10 +163,10 @@ public void testEnumIsForbidden() throws Exception { "ENUM_DEF,ENUM_CONSTANT_DEF"); final String[] expected7 = { - "50: " + getCheckMessage(MSG_KEY, "ENUM_DEF", "C"), - "52: " + getCheckMessage(MSG_KEY, "ENUM_CONSTANT_DEF", "int1"), - "54: " + getCheckMessage(MSG_KEY, "ENUM_CONSTANT_DEF", "int2"), - "56: " + getCheckMessage(MSG_KEY, "ENUM_CONSTANT_DEF", "int3"), + "50:7: " + getCheckMessage(MSG_KEY, "ENUM_DEF", "C"), + "52:12: " + getCheckMessage(MSG_KEY, "ENUM_CONSTANT_DEF", "int1"), + "54:12: " + getCheckMessage(MSG_KEY, "ENUM_CONSTANT_DEF", "int2"), + "56:12: " + getCheckMessage(MSG_KEY, "ENUM_CONSTANT_DEF", "int3"), }; verify(checkConfig, getPath("InputForbidAnnotationCheck.java"), expected7); 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 5e582afb52..17805277e1 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 @@ -38,34 +38,35 @@ public void testAll() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(AvoidConstantAsFirstOperandInConditionCheck.class); final String[] expected = { - "24: " + getCheckMessage(MSG_KEY, "=="), - "25: " + getCheckMessage(MSG_KEY, "=="), - "27: " + getCheckMessage(MSG_KEY, "=="), - "28: " + getCheckMessage(MSG_KEY, "=="), - "29: " + getCheckMessage(MSG_KEY, "=="), - "30: " + getCheckMessage(MSG_KEY, "=="), - "31: " + getCheckMessage(MSG_KEY, "=="), - "46: " + getCheckMessage(MSG_KEY, "=="), - "47: " + getCheckMessage(MSG_KEY, "!="), - "52: " + getCheckMessage(MSG_KEY, "=="), - "53: " + getCheckMessage(MSG_KEY, "!="), - "58: " + getCheckMessage(MSG_KEY, "=="), - "59: " + getCheckMessage(MSG_KEY, "!="), - "67: " + getCheckMessage(MSG_KEY, "=="), - "71: " + getCheckMessage(MSG_KEY, "=="), - "72: " + getCheckMessage(MSG_KEY, "=="), - "73: " + getCheckMessage(MSG_KEY, "=="), - "74: " + getCheckMessage(MSG_KEY, "=="), - "76: " + getCheckMessage(MSG_KEY, "=="), - "77: " + getCheckMessage(MSG_KEY, "=="), - "78: " + getCheckMessage(MSG_KEY, "=="), - "84: " + getCheckMessage(MSG_KEY, "=="), - "85: " + getCheckMessage(MSG_KEY, "=="), - "86: " + getCheckMessage(MSG_KEY, "=="), - "97: " + getCheckMessage(MSG_KEY, "=="), - "101: " + getCheckMessage(MSG_KEY, "=="), - "111: " + getCheckMessage(MSG_KEY, "=="), - "112: " + getCheckMessage(MSG_KEY, "=="), + "24:20: " + getCheckMessage(MSG_KEY, "=="), + "25:15: " + getCheckMessage(MSG_KEY, "=="), + "27:18: " + getCheckMessage(MSG_KEY, "=="), + "28:18: " + getCheckMessage(MSG_KEY, "=="), + "29:16: " + getCheckMessage(MSG_KEY, "=="), + "30:18: " + getCheckMessage(MSG_KEY, "=="), + "31:19: " + getCheckMessage(MSG_KEY, "=="), + "46:18: " + getCheckMessage(MSG_KEY, "=="), + "47:18: " + getCheckMessage(MSG_KEY, "!="), + "52:18: " + getCheckMessage(MSG_KEY, "=="), + "53:18: " + getCheckMessage(MSG_KEY, "!="), + "58:18: " + getCheckMessage(MSG_KEY, "=="), + "59:18: " + getCheckMessage(MSG_KEY, "!="), + "67:30: " + getCheckMessage(MSG_KEY, "=="), + "71:36: " + getCheckMessage(MSG_KEY, "=="), + "72:37: " + getCheckMessage(MSG_KEY, "=="), + "73:19: " + getCheckMessage(MSG_KEY, "=="), + "74:37: " + getCheckMessage(MSG_KEY, "=="), + "76:42: " + getCheckMessage(MSG_KEY, "=="), + "77:18: " + getCheckMessage(MSG_KEY, "=="), + "78:18: " + getCheckMessage(MSG_KEY, "=="), + "78:42: " + getCheckMessage(MSG_KEY, "=="), + "84:25: " + getCheckMessage(MSG_KEY, "=="), + "85:23: " + getCheckMessage(MSG_KEY, "=="), + "86:33: " + getCheckMessage(MSG_KEY, "=="), + "97:21: " + getCheckMessage(MSG_KEY, "=="), + "101:23: " + getCheckMessage(MSG_KEY, "=="), + "111:19: " + getCheckMessage(MSG_KEY, "=="), + "112:40: " + getCheckMessage(MSG_KEY, "=="), }; verify(checkConfig, getPath("InputAvoidConstantAsFirstOperandInConditionCheck.java"), expected); @@ -77,9 +78,9 @@ public void testAttributes() throws Exception { createModuleConfig(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, "=="), + "25:15: " + getCheckMessage(MSG_KEY, "=="), + "28:18: " + getCheckMessage(MSG_KEY, "=="), + "31:19: " + getCheckMessage(MSG_KEY, "=="), }; verify(checkConfig, getPath("InputAvoidConstantAsFirstOperandInConditionCheck.java"), expected); @@ -93,34 +94,35 @@ public void testNullProperties() throws Exception { checkConfig.addAttribute("targetConstantTypes", null); final String[] expected = { - "24: " + getCheckMessage(MSG_KEY, "=="), - "25: " + getCheckMessage(MSG_KEY, "=="), - "27: " + getCheckMessage(MSG_KEY, "=="), - "28: " + getCheckMessage(MSG_KEY, "=="), - "29: " + getCheckMessage(MSG_KEY, "=="), - "30: " + getCheckMessage(MSG_KEY, "=="), - "31: " + getCheckMessage(MSG_KEY, "=="), - "46: " + getCheckMessage(MSG_KEY, "=="), - "47: " + getCheckMessage(MSG_KEY, "!="), - "52: " + getCheckMessage(MSG_KEY, "=="), - "53: " + getCheckMessage(MSG_KEY, "!="), - "58: " + getCheckMessage(MSG_KEY, "=="), - "59: " + getCheckMessage(MSG_KEY, "!="), - "67: " + getCheckMessage(MSG_KEY, "=="), - "71: " + getCheckMessage(MSG_KEY, "=="), - "72: " + getCheckMessage(MSG_KEY, "=="), - "73: " + getCheckMessage(MSG_KEY, "=="), - "74: " + getCheckMessage(MSG_KEY, "=="), - "76: " + getCheckMessage(MSG_KEY, "=="), - "77: " + getCheckMessage(MSG_KEY, "=="), - "78: " + getCheckMessage(MSG_KEY, "=="), - "84: " + getCheckMessage(MSG_KEY, "=="), - "85: " + getCheckMessage(MSG_KEY, "=="), - "86: " + getCheckMessage(MSG_KEY, "=="), - "97: " + getCheckMessage(MSG_KEY, "=="), - "101: " + getCheckMessage(MSG_KEY, "=="), - "111: " + getCheckMessage(MSG_KEY, "=="), - "112: " + getCheckMessage(MSG_KEY, "=="), + "24:20: " + getCheckMessage(MSG_KEY, "=="), + "25:15: " + getCheckMessage(MSG_KEY, "=="), + "27:18: " + getCheckMessage(MSG_KEY, "=="), + "28:18: " + getCheckMessage(MSG_KEY, "=="), + "29:16: " + getCheckMessage(MSG_KEY, "=="), + "30:18: " + getCheckMessage(MSG_KEY, "=="), + "31:19: " + getCheckMessage(MSG_KEY, "=="), + "46:18: " + getCheckMessage(MSG_KEY, "=="), + "47:18: " + getCheckMessage(MSG_KEY, "!="), + "52:18: " + getCheckMessage(MSG_KEY, "=="), + "53:18: " + getCheckMessage(MSG_KEY, "!="), + "58:18: " + getCheckMessage(MSG_KEY, "=="), + "59:18: " + getCheckMessage(MSG_KEY, "!="), + "67:30: " + getCheckMessage(MSG_KEY, "=="), + "71:36: " + getCheckMessage(MSG_KEY, "=="), + "72:37: " + getCheckMessage(MSG_KEY, "=="), + "73:19: " + getCheckMessage(MSG_KEY, "=="), + "74:37: " + getCheckMessage(MSG_KEY, "=="), + "76:42: " + getCheckMessage(MSG_KEY, "=="), + "77:18: " + getCheckMessage(MSG_KEY, "=="), + "78:18: " + getCheckMessage(MSG_KEY, "=="), + "78:42: " + getCheckMessage(MSG_KEY, "=="), + "84:25: " + getCheckMessage(MSG_KEY, "=="), + "85:23: " + getCheckMessage(MSG_KEY, "=="), + "86:33: " + getCheckMessage(MSG_KEY, "=="), + "97:21: " + getCheckMessage(MSG_KEY, "=="), + "101:23: " + getCheckMessage(MSG_KEY, "=="), + "111:19: " + getCheckMessage(MSG_KEY, "=="), + "112:40: " + getCheckMessage(MSG_KEY, "=="), }; verify(checkConfig, getPath("InputAvoidConstantAsFirstOperandInConditionCheck.java"), 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 dcb16fbd78..69cce8b6ce 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 @@ -42,21 +42,21 @@ public void testWithAllowPartialFalse() createModuleConfig(AvoidDefaultSerializableInInnerClassesCheck.class); final String[] expected = { - "33: " + warningMessage, - "45: " + warningMessage, - "52: " + warningMessage, - "59: " + warningMessage, - "67: " + warningMessage, - "74: " + warningMessage, - "97: " + warningMessage, - "104: " + warningMessage, - "121: " + warningMessage, - "134: " + warningMessage, - "145: " + warningMessage, - "159: " + warningMessage, - "171: " + warningMessage, - "179: " + warningMessage, - "187: " + warningMessage, + "33:48: " + warningMessage, + "45:31: " + warningMessage, + "52:31: " + warningMessage, + "59:30: " + warningMessage, + "67:9: " + warningMessage, + "74:30: " + warningMessage, + "97:30: " + warningMessage, + "104:34: " + warningMessage, + "121:30: " + warningMessage, + "134:30: " + warningMessage, + "145:36: " + warningMessage, + "159:42: " + warningMessage, + "171:39: " + warningMessage, + "179:42: " + warningMessage, + "187:35: " + warningMessage, }; verify(checkConfig, getPath("InputAvoidDefaultSerializableInInnerClassesCheck1.java"), expected); @@ -70,7 +70,7 @@ public void testPrivateNotRealReadObject() checkConfig.addAttribute("allowPartialImplementation", "true"); final String[] expected = { - "10: " + warningMessage, + "10:22: " + warningMessage, }; verify(checkConfig, getPath("InputAvoidDefaultSerializableInInnerClassesCheck2.java"), @@ -96,17 +96,17 @@ public void testWithAllowPartialTrue() createModuleConfig(AvoidDefaultSerializableInInnerClassesCheck.class); checkConfig.addAttribute("allowPartialImplementation", "true"); final String[] expected = { - "33: " + warningMessage, - "59: " + warningMessage, - "67: " + warningMessage, - "74: " + warningMessage, - "97: " + warningMessage, - "104: " + warningMessage, - "121: " + warningMessage, - "134: " + warningMessage, - "145: " + warningMessage, - "171: " + warningMessage, - "187: " + warningMessage, + "33:48: " + warningMessage, + "59:30: " + warningMessage, + "67:9: " + warningMessage, + "74:30: " + warningMessage, + "97:30: " + warningMessage, + "104:34: " + warningMessage, + "121:30: " + warningMessage, + "134:30: " + warningMessage, + "145:36: " + warningMessage, + "171:39: " + warningMessage, + "187:35: " + warningMessage, }; verify(checkConfig, getPath("InputAvoidDefaultSerializableInInnerClassesCheck1.java"), expected); 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 1a89a56333..dbc85bb2d9 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 @@ -43,23 +43,23 @@ public void testDefault() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(ConfusingConditionCheck.class); final String[] expected = { - "10: " + warningMessage, - "13: " + warningMessage, - "16: " + warningMessage, - "19: " + warningMessage, - "22: " + warningMessage, - "105: " + warningMessage, - "108: " + warningMessage, - "111: " + warningMessage, - "149: " + warningMessage, - "166: " + warningMessage, - "177: " + warningMessage, - "181: " + warningMessage, - "200: " + warningMessage, - "215: " + warningMessage, - "231: " + warningMessage, - "250: " + warningMessage, - "259: " + warningMessage, + "10:9: " + warningMessage, + "13:9: " + warningMessage, + "16:9: " + warningMessage, + "19:9: " + warningMessage, + "22:9: " + warningMessage, + "105:9: " + warningMessage, + "108:9: " + warningMessage, + "111:9: " + warningMessage, + "149:9: " + warningMessage, + "166:9: " + warningMessage, + "177:14: " + warningMessage, + "181:9: " + warningMessage, + "200:13: " + warningMessage, + "215:9: " + warningMessage, + "231:13: " + warningMessage, + "250:14: " + warningMessage, + "259:14: " + warningMessage, }; verify(checkConfig, getPath("InputConfusingConditionCheck.java"), @@ -76,34 +76,34 @@ public void testFalseProperties() throws Exception { checkConfig.addAttribute("ignoreThrowInElse", "false"); final String[] expected = { - "10: " + warningMessage, - "13: " + warningMessage, - "16: " + warningMessage, - "19: " + warningMessage, - "22: " + warningMessage, - "105: " + warningMessage, - "108: " + warningMessage, - "111: " + warningMessage, - "127: " + warningMessage, - "134: " + warningMessage, - "138: " + warningMessage, - "145: " + warningMessage, - "149: " + warningMessage, - "157: " + warningMessage, - "160: " + warningMessage, - "162: " + warningMessage, - "166: " + warningMessage, - "177: " + warningMessage, - "181: " + warningMessage, - "199: " + warningMessage, - "200: " + warningMessage, - "215: " + warningMessage, - "227: " + warningMessage, - "231: " + warningMessage, - "247: " + warningMessage, - "250: " + warningMessage, - "257: " + warningMessage, - "259: " + warningMessage, + "10:9: " + warningMessage, + "13:9: " + warningMessage, + "16:9: " + warningMessage, + "19:9: " + warningMessage, + "22:9: " + warningMessage, + "105:9: " + warningMessage, + "108:9: " + warningMessage, + "111:9: " + warningMessage, + "127:21: " + warningMessage, + "134:9: " + warningMessage, + "138:9: " + warningMessage, + "145:9: " + warningMessage, + "149:9: " + warningMessage, + "157:9: " + warningMessage, + "160:9: " + warningMessage, + "162:9: " + warningMessage, + "166:9: " + warningMessage, + "177:14: " + warningMessage, + "181:9: " + warningMessage, + "199:9: " + warningMessage, + "200:13: " + warningMessage, + "215:9: " + warningMessage, + "227:9: " + warningMessage, + "231:13: " + warningMessage, + "247:9: " + warningMessage, + "250:14: " + warningMessage, + "257:9: " + warningMessage, + "259:14: " + warningMessage, }; verify(checkConfig, getPath("InputConfusingConditionCheck.java"), @@ -117,16 +117,16 @@ public void testMultiplyFactor() throws Exception { checkConfig.addAttribute("multiplyFactorForElseBlocks", "0"); final String[] expected = { - "10: " + warningMessage, - "13: " + warningMessage, - "16: " + warningMessage, - "19: " + warningMessage, - "22: " + warningMessage, - "105: " + warningMessage, - "108: " + warningMessage, - "111: " + warningMessage, - "177: " + warningMessage, - "259: " + warningMessage, + "10:9: " + warningMessage, + "13:9: " + warningMessage, + "16:9: " + warningMessage, + "19:9: " + warningMessage, + "22:9: " + warningMessage, + "105:9: " + warningMessage, + "108:9: " + warningMessage, + "111:9: " + warningMessage, + "177:14: " + warningMessage, + "259:14: " + warningMessage, }; verify(checkConfig, getPath("InputConfusingConditionCheck.java"), 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 83fc7d2750..fcf2c9141d 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 @@ -129,11 +129,11 @@ public void gettersSetters() "66:5: " + getCheckMessage(MSG_KEY_METHOD, "GetterSetter(.*)", "Method(.*)"), "71:5: " + getCheckMessage(MSG_KEY_METHOD, "GetterSetter(.*)", "Method(.*)"), "76:5: " + getCheckMessage(MSG_KEY_METHOD, "GetterSetter(.*)", "Method(.*)"), - "91: " + getCheckMessage(MSG_KEY_INVALID_SETTER, "setField", "getField"), - "128: " + getCheckMessage(MSG_KEY_INVALID_SETTER, "setField", "getField"), - "133: " + getCheckMessage(MSG_KEY_INVALID_SETTER, "setX", "getX"), - "138: " + getCheckMessage(MSG_KEY_INVALID_SETTER, "setVisible", "isVisible"), - "168: " + getCheckMessage(MSG_KEY_INVALID_SETTER, "setField", "getField"), + "91:5: " + getCheckMessage(MSG_KEY_INVALID_SETTER, "setField", "getField"), + "128:5: " + getCheckMessage(MSG_KEY_INVALID_SETTER, "setField", "getField"), + "133:5: " + getCheckMessage(MSG_KEY_INVALID_SETTER, "setX", "getX"), + "138:5: " + getCheckMessage(MSG_KEY_INVALID_SETTER, "setVisible", "isVisible"), + "168:5: " + getCheckMessage(MSG_KEY_INVALID_SETTER, "setField", "getField"), "176:5: " + getCheckMessage(MSG_KEY_METHOD, "GetterSetter(.*)", "Method(.*)"), "180:5: " + getCheckMessage(MSG_KEY_METHOD, "GetterSetter(.*)", "Method(.*)"), "282:5: " + getCheckMessage(MSG_KEY_METHOD, "GetterSetter(.*)", "Method(.*)"), 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 c6d6cd988d..e54560826a 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 @@ -41,11 +41,11 @@ public final void basicTest() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(FinalizeImplementationCheck.class); final String[] expected = { - "22: " + getCheckMessage(MSG_KEY_MISSED_TRY_FINALLY), - "35: " + getCheckMessage(MSG_KEY_MISSED_TRY_FINALLY), - "48: " + getCheckMessage(MSG_KEY_PUBLIC_FINALIZE), - "62: " + getCheckMessage(MSG_KEY_USELESS_FINALIZE), - "75: " + getCheckMessage(MSG_KEY_MISSED_SUPER_FINALIZE_CALL), + "22:5: " + getCheckMessage(MSG_KEY_MISSED_TRY_FINALLY), + "35:5: " + getCheckMessage(MSG_KEY_MISSED_TRY_FINALLY), + "48:5: " + getCheckMessage(MSG_KEY_PUBLIC_FINALIZE), + "62:5: " + getCheckMessage(MSG_KEY_USELESS_FINALIZE), + "75:3: " + getCheckMessage(MSG_KEY_MISSED_SUPER_FINALIZE_CALL), }; verify(checkConfig, @@ -57,8 +57,8 @@ public final void testSpecialFinalize() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(FinalizeImplementationCheck.class); final String[] expected = { - "5: " + getCheckMessage(MSG_KEY_MISSED_TRY_FINALLY), - "18: " + getCheckMessage(MSG_KEY_MISSED_TRY_FINALLY), + "5:5: " + getCheckMessage(MSG_KEY_MISSED_TRY_FINALLY), + "18:5: " + getCheckMessage(MSG_KEY_MISSED_TRY_FINALLY), }; verify(checkConfig, getPath("InputFinalizeImplementationCheckSpecial.java"), 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 9843057e21..c3dc6f239f 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 @@ -50,11 +50,11 @@ public void testNormalWork() throws Exception { checkConfig.addAttribute("forbiddenImportsExcludesRegexp", ""); final String[] expected = { - "3: " + getCheckMessage(MSG_KEY, ".+\\.api\\..+", + "3:1: " + getCheckMessage(MSG_KEY, ".+\\.api\\..+", "com.puppycrawl.tools.checkstyle.api.AutomaticBean"), - "9: " + getCheckMessage(MSG_KEY, ".+\\.api\\..+", + "9:1: " + getCheckMessage(MSG_KEY, ".+\\.api\\..+", "com.puppycrawl.tools.checkstyle.api.AutomaticBean"), - "21: " + getCheckMessage(MSG_KEY, ".+\\.api\\..+", + "21:30: " + getCheckMessage(MSG_KEY, ".+\\.api\\..+", "com.puppycrawl.tools.checkstyle.api.AutomaticBean"), }; @@ -154,11 +154,11 @@ public void testPackageForbiddenImportMatchButNullExclude() throws Exception { checkConfig.addAttribute("forbiddenImportsExcludesRegexp", null); final String[] expected = { - "3: " + getCheckMessage(MSG_KEY, ".+\\.api\\..+", + "3:1: " + getCheckMessage(MSG_KEY, ".+\\.api\\..+", "com.puppycrawl.tools.checkstyle.api.AutomaticBean"), - "9: " + getCheckMessage(MSG_KEY, ".+\\.api\\..+", + "9:1: " + getCheckMessage(MSG_KEY, ".+\\.api\\..+", "com.puppycrawl.tools.checkstyle.api.AutomaticBean"), - "21: " + getCheckMessage(MSG_KEY, ".+\\.api\\..+", + "21:30: " + getCheckMessage(MSG_KEY, ".+\\.api\\..+", "com.puppycrawl.tools.checkstyle.api.AutomaticBean"), }; @@ -189,9 +189,9 @@ public void testSinglePackage() throws Exception { checkConfig.addAttribute("forbiddenImportsExcludesRegexp", ""); final String[] expected = { - "3: " + getCheckMessage(MSG_KEY, ".+\\.api\\..+", + "3:1: " + getCheckMessage(MSG_KEY, ".+\\.api\\..+", "com.puppycrawl.tools.checkstyle.api.AutomaticBean"), - "10: " + getCheckMessage(MSG_KEY, ".+\\.api\\..+", + "10:30: " + getCheckMessage(MSG_KEY, ".+\\.api\\..+", "com.puppycrawl.tools.checkstyle.api.AutomaticBean"), }; 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 d90757d957..4467855e3a 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 @@ -44,11 +44,11 @@ public void testDefault() final DefaultConfiguration checkConfig = createModuleConfig(ForbidReturnInFinallyBlockCheck.class); final String[] expected = { - "13: " + warningMessage, - "28: " + warningMessage, - "49: " + warningMessage, - "56: " + warningMessage, - "82: " + warningMessage, + "13:13: " + warningMessage, + "28:13: " + warningMessage, + "49:13: " + warningMessage, + "56:17: " + warningMessage, + "82:13: " + warningMessage, }; verify(checkConfig, getPath("InputForbidReturnInFinallyBlockCheck.java"), expected); 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 abcea970ba..621e0ee4ca 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 @@ -38,7 +38,7 @@ public final void anonymousExceptionTest() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(ForbidThrowAnonymousExceptionsCheck.class); final String[] expected = { - "8: " + getCheckMessage(MSG_KEY), + "8:23: " + getCheckMessage(MSG_KEY), }; verify(checkConfig, @@ -50,8 +50,8 @@ public final void preDefinedAnonymousExceptionTest() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(ForbidThrowAnonymousExceptionsCheck.class); final String[] expected = { - "8: " + getCheckMessage(MSG_KEY), - "30: " + getCheckMessage(MSG_KEY), + "8:15: " + getCheckMessage(MSG_KEY), + "30:13: " + getCheckMessage(MSG_KEY), }; verify(checkConfig, @@ -63,12 +63,12 @@ public final void sameNameExceptionsTest() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(ForbidThrowAnonymousExceptionsCheck.class); final String[] expected = { - "12: " + getCheckMessage(MSG_KEY), - "23: " + getCheckMessage(MSG_KEY), - "66: " + getCheckMessage(MSG_KEY), - "88: " + getCheckMessage(MSG_KEY), - "107: " + getCheckMessage(MSG_KEY), - "127: " + getCheckMessage(MSG_KEY), + "12:15: " + getCheckMessage(MSG_KEY), + "23:13: " + getCheckMessage(MSG_KEY), + "66:9: " + getCheckMessage(MSG_KEY), + "88:9: " + getCheckMessage(MSG_KEY), + "107:9: " + getCheckMessage(MSG_KEY), + "127:9: " + getCheckMessage(MSG_KEY), }; verify(checkConfig, @@ -81,8 +81,8 @@ public final void nonStandardExceptionClassNameTest() throws Exception { createModuleConfig(ForbidThrowAnonymousExceptionsCheck.class); checkConfig.addAttribute("exceptionClassNameRegex", "^.*bla"); final String[] expected = { - "10: " + getCheckMessage(MSG_KEY), - "12: " + getCheckMessage(MSG_KEY), + "10:13: " + getCheckMessage(MSG_KEY), + "12:13: " + getCheckMessage(MSG_KEY), }; verify(checkConfig, From 55b26af41d26317a5fed11543b2151ed790578e5 Mon Sep 17 00:00:00 2001 From: rnveach Date: Sat, 26 May 2018 23:19:26 -0400 Subject: [PATCH 175/208] minor: fix eclipse violations --- .../checks/coding/CustomDeclarationOrderCheck.java | 2 +- .../checkstyle/checks/coding/ForbidCertainMethodCheck.java | 5 ++--- .../checks/naming/UniformEnumConstantNameCheck.java | 2 +- .../checks/design/ForbidWildcardAsReturnTypeCheckTest.java | 2 +- .../com/github/sevntu/checkstyle/internal/AllChecksTest.java | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) 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 3281660e10..a14cc0eb4d 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 @@ -802,7 +802,7 @@ private static String getCombinedModifiersList(final DetailAST ast) { } while (astNode.getType() != TokenTypes.IDENT) { - if (astNode != null && astNode.getFirstChild() != null) { + if (astNode.getFirstChild() != null) { modifiers.append(getModifiersAsText(astNode.getFirstChild())); modifiers.append(" "); } 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 9ed480851b..e15ae5b2f5 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 @@ -161,7 +161,7 @@ public void visitToken(DetailAST ast) { methodNameInCode = dot.getLastChild().getText(); } final int numArgsInCode = dot.getNextSibling().getChildCount(TokenTypes.EXPR); - if (isForbiddenMethod(ast, methodNameInCode, numArgsInCode)) { + if (isForbiddenMethod(methodNameInCode, numArgsInCode)) { log(ast, MSG_KEY, methodNameInCode, methodName, numArgsInCode, argumentCount); } @@ -174,12 +174,11 @@ public void visitToken(DetailAST ast) { /** * 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) { + private boolean isForbiddenMethod(String name, int argCount) { boolean matched = false; if (methodName.matcher(name).matches()) { for (IntRange intRange : argumentCountRanges) { 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 68cbee5a95..39b9f76e4d 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 @@ -125,7 +125,7 @@ public UniformEnumConstantNameCheck() { * @param regexps format to check against */ public final void setFormats(String[] regexps) { - this.patterns = new ArrayList(regexps.length); + this.patterns = new ArrayList<>(regexps.length); for (final String regexp: regexps) { final Pattern pattern = Pattern.compile(regexp, 0); patterns.add(pattern); 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 52546f7819..659141f66a 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 @@ -443,7 +443,7 @@ public final void testFullyQualifiedAnnotation() * @return sorted set of line numbers. */ private static SortedSet newSetOfLines(Integer[] aLines) { - return new TreeSet(Arrays.asList(aLines)); + return new TreeSet<>(Arrays.asList(aLines)); } /** 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 065a9e92d6..ba44737299 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 @@ -241,7 +241,7 @@ private static void grabAllTests(Map> allTests, File file) List classes = allTests.get(pkg); if (classes == null) { - classes = new ArrayList(); + classes = new ArrayList<>(); allTests.put(pkg, classes); } From cfe29243fabe0f9303a26333f1412e4f050b4a94 Mon Sep 17 00:00:00 2001 From: rnveach Date: Sat, 26 May 2018 22:47:58 -0400 Subject: [PATCH 176/208] Issue #662: moved complicated line Checks to log AST (part 1) --- .../checks/coding/EitherLogOrThrowCheck.java | 6 ++-- .../design/StaticMethodCandidateCheck.java | 14 ++++----- .../coding/EitherLogOrThrowCheckTest.java | 30 +++++++++---------- .../StaticMethodCandidateCheckTest.java | 24 +++++++-------- 4 files changed, 37 insertions(+), 37 deletions(-) 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 1f5da3df8f..6c42e30655 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 @@ -345,7 +345,7 @@ && isLoggerVariableDefinition(variableDefAst)) { */ private void processCatchNode(final DetailAST catchAst) { boolean isLoggingExceptionFound = false; - int loggingExceptionLineNumber = 0; + DetailAST loggingExceptionAst = null; final List exceptionVariableNames = new LinkedList<>(); final String catchParameterName = getCatchParameterName(catchAst); final DetailAST statementsAst = @@ -377,7 +377,7 @@ && isInstanceCreationBasedOnException( && (isLoggingExceptionArgument(currentStatementAst, catchParameterName) || isPrintStackTrace(currentStatementAst, catchParameterName))) { isLoggingExceptionFound = true; - loggingExceptionLineNumber = currentStatementAst.getLineNo(); + loggingExceptionAst = currentStatementAst; } break; // throw exception @@ -389,7 +389,7 @@ && isInstanceCreationBasedOnException( if (exceptionVariableNames.contains(getIdentifier(thrownExceptionAst)) || isInstanceCreationBasedOnException( thrownExceptionAst, catchParameterName)) { - log(loggingExceptionLineNumber, MSG_KEY); + log(loggingExceptionAst, MSG_KEY); break; } } 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 bd66f68488..a5e5e1e86d 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 @@ -251,7 +251,7 @@ private Frame createMethodFrame(Frame parentFrame, DetailAST ast) { && !modifiersAst.branchContains(TokenTypes.LITERAL_STATIC) && !skippedMethods.contains(methodName)) { frame.isPrivateMethod = true; - frame.lineNo = ast.getLineNo(); + frame.ast = ast; frame.frameName = getIdentText(ast); } else { @@ -332,7 +332,7 @@ && isFrameExpressionsAcceptable(frame) && isFrameTypesAcceptable(frame); if (frame.isPrivateMethod) { if (isStaticCandidate) { - log(frame.lineNo, MSG_KEY, frame.frameName); + log(frame.ast, MSG_KEY, frame.frameName); } } else if (!isStaticCandidate) { @@ -740,8 +740,8 @@ private static class Frame { /** Whether the frame has LITERAL_THIS or LITERAL_SUPER. */ private boolean hasLiteralThisOrSuper; - /** Number of the line where the frame is declared. */ - private int lineNo; + /** AST where the frame is declared. */ + private DetailAST ast; /** * Creates new frame. @@ -753,10 +753,10 @@ private static class Frame { /** * Add method call to this Frame. - * @param ast EXPR ast. + * @param exprAst EXPR ast. */ - public void addExpr(DetailAST ast) { - expressions.add(ast); + public void addExpr(DetailAST exprAst) { + expressions.add(exprAst); } /** 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 de18fd02a1..a57219b820 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 @@ -46,21 +46,21 @@ public void test() throws Exception { checkConfig.addAttribute("loggingMethodNames", "error, warn"); final String[] expected = { - "19: " + warningMessage, - "31: " + warningMessage, - "43: " + warningMessage, - "82: " + warningMessage, - "93: " + warningMessage, - "102: " + warningMessage, - "112: " + warningMessage, - "124: " + warningMessage, - "154: " + warningMessage, - "164: " + warningMessage, - "207: " + warningMessage, - "231: " + warningMessage, - "241: " + warningMessage, - "252: " + warningMessage, - "262: " + warningMessage, + "19:28: " + warningMessage, + "31:27: " + warningMessage, + "43:31: " + warningMessage, + "82:28: " + warningMessage, + "93:28: " + warningMessage, + "102:28: " + warningMessage, + "112:22: " + warningMessage, + "124:23: " + warningMessage, + "154:28: " + warningMessage, + "164:28: " + warningMessage, + "207:28: " + warningMessage, + "231:30: " + warningMessage, + "241:30: " + warningMessage, + "252:25: " + warningMessage, + "262:38: " + warningMessage, }; verify(checkConfig, getPath("InputEitherLogOrThrowCheck.java"), expected); 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 0a3041bbe0..cea4552fe4 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 @@ -42,17 +42,17 @@ public void testDefault() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(StaticMethodCandidateCheck.class); final String[] expected = { - "37: " + getCheckMessage(MSG_KEY, "foo11"), - "56: " + getCheckMessage(MSG_KEY, "nestedFoo1"), - "86: " + getCheckMessage(MSG_KEY, "doSomething"), - "123: " + getCheckMessage(MSG_KEY, "main"), - "176: " + getCheckMessage(MSG_KEY, "bar"), - "184: " + getCheckMessage(MSG_KEY, "fooBar"), - "186: " + getCheckMessage(MSG_KEY, "barFoo"), - "188: " + getCheckMessage(MSG_KEY, "fooo"), - "190: " + getCheckMessage(MSG_KEY, "baar"), - "192: " + getCheckMessage(MSG_KEY, "fOo"), - "194: " + getCheckMessage(MSG_KEY, "foO"), + "37:5: " + getCheckMessage(MSG_KEY, "foo11"), + "56:9: " + getCheckMessage(MSG_KEY, "nestedFoo1"), + "86:9: " + getCheckMessage(MSG_KEY, "doSomething"), + "123:5: " + getCheckMessage(MSG_KEY, "main"), + "176:5: " + getCheckMessage(MSG_KEY, "bar"), + "184:5: " + getCheckMessage(MSG_KEY, "fooBar"), + "186:5: " + getCheckMessage(MSG_KEY, "barFoo"), + "188:5: " + getCheckMessage(MSG_KEY, "fooo"), + "190:5: " + getCheckMessage(MSG_KEY, "baar"), + "192:5: " + getCheckMessage(MSG_KEY, "fOo"), + "194:5: " + getCheckMessage(MSG_KEY, "foO"), }; verify(checkConfig, getPath("InputStaticMethodCandidateCheck.java"), expected); } @@ -144,7 +144,7 @@ public void testInterface() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(StaticMethodCandidateCheck.class); final String[] expected = { - "16: " + getCheckMessage(MSG_KEY, "bar"), + "16:5: " + getCheckMessage(MSG_KEY, "bar"), }; verify(checkConfig, new File("src/test/resources-noncompilable/com/github/" + "sevntu/checkstyle/checks/design/InputStaticMethodCandidateCheckInterfaceMethod.java") From 655de55b68a142eb487a41f76d8aa997b02c8e7a Mon Sep 17 00:00:00 2001 From: rnveach Date: Sat, 26 May 2018 23:53:58 -0400 Subject: [PATCH 177/208] Issue #669: removed branchContains for modifiers --- .../checks/coding/NumericLiteralNeedsUnderscoreCheck.java | 6 ++++-- .../checks/design/HideUtilityClassConstructorCheck.java | 8 ++++---- .../checks/design/StaticMethodCandidateCheck.java | 8 ++++---- 3 files changed, 12 insertions(+), 10 deletions(-) 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 961ff250ab..2c36c77fa0 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 @@ -368,8 +368,10 @@ private static boolean isField(final DetailAST ast) { current = current.getParent(); } return current.getType() == TokenTypes.VARIABLE_DEF - && current.branchContains(TokenTypes.LITERAL_STATIC) - && current.branchContains(TokenTypes.FINAL); + && current.findFirstToken(TokenTypes.MODIFIERS) + .findFirstToken(TokenTypes.LITERAL_STATIC) != null + && current.findFirstToken(TokenTypes.MODIFIERS) + .findFirstToken(TokenTypes.FINAL) != null; } /** 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 c4375723de..a060ce2aa5 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 @@ -79,9 +79,9 @@ public void visitToken(DetailAST ast) { final DetailAST modifiers = child.findFirstToken(TokenTypes.MODIFIERS); final boolean isStatic = - modifiers.branchContains(TokenTypes.LITERAL_STATIC); + modifiers.findFirstToken(TokenTypes.LITERAL_STATIC) != null; final boolean isPrivate = - modifiers.branchContains(TokenTypes.LITERAL_PRIVATE); + modifiers.findFirstToken(TokenTypes.LITERAL_PRIVATE) != null; if (!isStatic && !isPrivate) { hasNonStaticMethodOrField = true; @@ -94,8 +94,8 @@ public void visitToken(DetailAST ast) { hasDefaultCtor = false; final DetailAST modifiers = child.findFirstToken(TokenTypes.MODIFIERS); - if (!modifiers.branchContains(TokenTypes.LITERAL_PRIVATE) - && !modifiers.branchContains(TokenTypes.LITERAL_PROTECTED)) { + if (modifiers.findFirstToken(TokenTypes.LITERAL_PRIVATE) == null + && modifiers.findFirstToken(TokenTypes.LITERAL_PROTECTED) == null) { // treat package visible as public // for the purpose of this Check hasPublicCtor = true; 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 a5e5e1e86d..14a335cc64 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 @@ -247,8 +247,8 @@ private Frame createMethodFrame(Frame parentFrame, DetailAST ast) { final DetailAST modifiersAst = ast.findFirstToken(TokenTypes.MODIFIERS); final String methodName = ast.findFirstToken(TokenTypes.IDENT).getText(); final Frame frame = new Frame(parentFrame); - if (modifiersAst.branchContains(TokenTypes.LITERAL_PRIVATE) - && !modifiersAst.branchContains(TokenTypes.LITERAL_STATIC) + if (modifiersAst.findFirstToken(TokenTypes.LITERAL_PRIVATE) != null + && modifiersAst.findFirstToken(TokenTypes.LITERAL_STATIC) == null && !skippedMethods.contains(methodName)) { frame.isPrivateMethod = true; frame.ast = ast; @@ -360,7 +360,7 @@ private static String getIdentText(DetailAST field) { */ private static boolean hasStaticModifier(DetailAST ast) { return ast.findFirstToken(TokenTypes.MODIFIERS) - .branchContains(TokenTypes.LITERAL_STATIC); + .findFirstToken(TokenTypes.LITERAL_STATIC) != null; } /** @@ -643,7 +643,7 @@ private static boolean findStaticMethod(Frame startFrame, DetailAST methodCall, || parametersAst.branchContains(TokenTypes.ELLIPSIS))) { final DetailAST modifiersAst = method.findFirstToken(TokenTypes.MODIFIERS); - if (modifiersAst.branchContains(TokenTypes.LITERAL_STATIC)) { + if (modifiersAst.findFirstToken(TokenTypes.LITERAL_STATIC) != null) { // if a static method is found, we keep searching for a similar // non-static one to the end of the frame and if a non-static // method is not found, then the checked method is still From f7560e0721b0e1407646230a343cb8c6ba7f46bd Mon Sep 17 00:00:00 2001 From: rnveach Date: Sat, 26 May 2018 22:09:53 -0400 Subject: [PATCH 178/208] Issue #662: moved line only Checks to log AST (part 3) --- .../SimpleAccessorNameNotationCheck.java | 6 +- .../ForbidWildcardAsReturnTypeCheck.java | 2 +- .../PublicReferenceToPrivateTypeCheck.java | 2 +- .../SimpleAccessorNameNotationCheckTest.java | 64 ++++++++-------- .../ForbidWildcardAsReturnTypeCheckTest.java | 18 ++++- ...PublicReferenceToPrivateTypeCheckTest.java | 74 +++++++++---------- 6 files changed, 91 insertions(+), 75 deletions(-) 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 ac2f83b065..1f2b868068 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 @@ -109,17 +109,17 @@ public void visitToken(DetailAST methodDef) { if (methodName.startsWith(BOOLEAN_GETTER_PREFIX)) { if (!isGetterCorrect(methodDef, methodName.substring(BOOLEAN_GETTER_PREFIX.length()))) { - log(methodDef.getLineNo(), MSG_KEY_GETTER); + log(methodDef, MSG_KEY_GETTER); } } else if (methodName.startsWith(SETTER_PREFIX)) { if (!isSetterCorrect(methodDef, methodName.substring(SETTER_PREFIX.length()))) { - log(methodDef.getLineNo(), MSG_KEY_SETTER); + log(methodDef, MSG_KEY_SETTER); } } else if (methodName.startsWith(GETTER_PREFIX)) { if (!isGetterCorrect(methodDef, methodName.substring(GETTER_PREFIX.length()))) { - log(methodDef.getLineNo(), MSG_KEY_GETTER); + log(methodDef, MSG_KEY_GETTER); } } } 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 03316e4c1f..649aa62873 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 @@ -242,7 +242,7 @@ public void visitToken(DetailAST methodDefAst) { getWildcardArgumentsAsMethodReturnType(methodDefAst); if (!wildcardTypeArguments.isEmpty() && !isIgnoreCase(methodDefAst, wildcardTypeArguments)) { - log(methodDefAst.getLineNo(), MSG_KEY); + log(methodDefAst, MSG_KEY); } } } 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 558c3f21d3..4ff4bbb20f 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 @@ -152,7 +152,7 @@ public void finishTree(DetailAST rootAst) { outReturnedType.getText()) && !isExtendsOrImplementsSmth(privateType .getParent())) { - log(outReturnedType.getLineNo(), MSG_KEY, + log(outReturnedType, MSG_KEY, outReturnedType.getText()); } } 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 9a5f1d4b6b..360f4c4974 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 @@ -45,12 +45,12 @@ public void test() throws Exception { checkConfig.addAttribute("prefix", "m"); final String[] expected = { - "7: " + warningSetterMessage, - "10: " + warningGetterMessage, - "13: " + warningSetterMessage, - "16: " + warningGetterMessage, - "25: " + warningSetterMessage, - "28: " + warningGetterMessage, + "7:9: " + warningSetterMessage, + "10:9: " + warningGetterMessage, + "13:9: " + warningSetterMessage, + "16:9: " + warningGetterMessage, + "25:9: " + warningSetterMessage, + "28:9: " + warningGetterMessage, }; verify(checkConfig, getPath("InputSimpleAccessorNameNotationCheck.java"), expected); @@ -61,8 +61,8 @@ public void correctWithoutPrefix() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(SimpleAccessorNameNotationCheck.class); final String[] expected = { - "17: " + warningSetterMessage, - "22: " + warningGetterMessage, + "17:5: " + warningSetterMessage, + "22:5: " + warningGetterMessage, }; verify(checkConfig, getPath("InputSimpleAccessorNameNotationCheck1.java"), expected); } @@ -73,8 +73,8 @@ public void correctWithPrefix() throws Exception { createModuleConfig(SimpleAccessorNameNotationCheck.class); checkConfig.addAttribute("prefix", "m"); final String[] expected = { - "7: " + warningSetterMessage, - "12: " + warningGetterMessage, + "7:5: " + warningSetterMessage, + "12:5: " + warningGetterMessage, }; verify(checkConfig, getPath("InputSimpleAccessorNameNotationCheck1.java"), expected); } @@ -84,12 +84,12 @@ public void partlyWithoutPrefix() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(SimpleAccessorNameNotationCheck.class); final String[] expected = { - "15: " + warningGetterMessage, - "20: " + warningSetterMessage, - "30: " + warningSetterMessage, - "35: " + warningGetterMessage, - "40: " + warningSetterMessage, - "45: " + warningGetterMessage, + "15:5: " + warningGetterMessage, + "20:5: " + warningSetterMessage, + "30:5: " + warningSetterMessage, + "35:5: " + warningGetterMessage, + "40:5: " + warningSetterMessage, + "45:5: " + warningGetterMessage, }; verify(checkConfig, getPath("InputSimpleAccessorNameNotationCheck2.java"), expected); } @@ -100,12 +100,12 @@ public void partlyWithPrefix() throws Exception { createModuleConfig(SimpleAccessorNameNotationCheck.class); checkConfig.addAttribute("prefix", "m"); final String[] expected = { - "10: " + warningSetterMessage, - "15: " + warningGetterMessage, - "20: " + warningSetterMessage, - "25: " + warningGetterMessage, - "35: " + warningGetterMessage, - "40: " + warningSetterMessage, + "10:5: " + warningSetterMessage, + "15:5: " + warningGetterMessage, + "20:5: " + warningSetterMessage, + "25:5: " + warningGetterMessage, + "35:5: " + warningGetterMessage, + "40:5: " + warningSetterMessage, }; verify(checkConfig, getPath("InputSimpleAccessorNameNotationCheck2.java"), expected); } @@ -115,10 +115,10 @@ public void errorsWithoutPrefix() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(SimpleAccessorNameNotationCheck.class); final String[] expected = { - "7: " + warningSetterMessage, - "12: " + warningGetterMessage, - "17: " + warningSetterMessage, - "22: " + warningGetterMessage, + "7:5: " + warningSetterMessage, + "12:5: " + warningGetterMessage, + "17:5: " + warningSetterMessage, + "22:5: " + warningGetterMessage, }; verify(checkConfig, getPath("InputSimpleAccessorNameNotationCheck3.java"), expected); } @@ -129,10 +129,10 @@ public void errorsWithPrefix() throws Exception { createModuleConfig(SimpleAccessorNameNotationCheck.class); checkConfig.addAttribute("prefix", "m"); final String[] expected = { - "7: " + warningSetterMessage, - "12: " + warningGetterMessage, - "17: " + warningSetterMessage, - "22: " + warningGetterMessage, + "7:5: " + warningSetterMessage, + "12:5: " + warningGetterMessage, + "17:5: " + warningSetterMessage, + "22:5: " + warningGetterMessage, }; verify(checkConfig, getPath("InputSimpleAccessorNameNotationCheck3.java"), expected); } @@ -159,8 +159,8 @@ public void testBoolean() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(SimpleAccessorNameNotationCheck.class); final String[] expected = { - "28: " + warningSetterMessage, - "33: " + warningGetterMessage, + "28:5: " + warningSetterMessage, + "33:5: " + warningGetterMessage, }; verify(checkConfig, getPath("InputSimpleAccessorNameNotationCheck5.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 659141f66a..6323c9f955 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 @@ -455,10 +455,26 @@ private String[] createExpectedMessages(SortedSet aLines) { final String[] expected = new String[aLines.size()]; int index = 0; for (Integer element : aLines) { - expected[index] = element + ": " + warningMessage; + expected[index] = element + ":" + getColumnNumber(element) + ": " + warningMessage; index++; } return expected; } + private static int getColumnNumber(int lineNumber) { + final int result; + + if (lineNumber >= 264 && lineNumber < 280) { + result = 13; + } + else if (lineNumber < 228 || lineNumber >= 280 && lineNumber < 290 || lineNumber >= 304) { + result = 5; + } + else { + result = 9; + } + + return result; + } + } 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 e05a85c438..4c9d7aa478 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 @@ -67,7 +67,7 @@ public void returnPrivateTest() final String typeName = "PrivateInner"; final DefaultConfiguration checkConfig = createModuleConfig(PublicReferenceToPrivateTypeCheck.class); - final String[] expected = {"13: " + getCheckMessage(MSG_KEY, typeName), }; + final String[] expected = {"13:12: " + getCheckMessage(MSG_KEY, typeName), }; verify(checkConfig, getPath("InputPublicReferenceToPrivateTypeCheck2.java"), expected); @@ -118,7 +118,7 @@ public void returnPrivateArrayTest() final String typeName = "PrivateInner"; final DefaultConfiguration checkConfig = createModuleConfig(PublicReferenceToPrivateTypeCheck.class); - final String[] expected = {"13: " + getCheckMessage(MSG_KEY, typeName), }; + final String[] expected = {"13:12: " + getCheckMessage(MSG_KEY, typeName), }; verify(checkConfig, getPath("InputPublicReferenceToPrivateTypeCheck5.java"), expected); @@ -135,7 +135,7 @@ public void returnPrivateInShell() final String typeName = "PrivateInner"; final DefaultConfiguration checkConfig = createModuleConfig(PublicReferenceToPrivateTypeCheck.class); - final String[] expected = {"14: " + getCheckMessage(MSG_KEY, typeName), }; + final String[] expected = {"14:16: " + getCheckMessage(MSG_KEY, typeName), }; verify(checkConfig, getPath("InputPublicReferenceToPrivateTypeCheck6.java"), expected); @@ -153,7 +153,7 @@ public void returnPrivateInCollectionInCollection() final String typeName = "PrivateInner"; final DefaultConfiguration checkConfig = createModuleConfig(PublicReferenceToPrivateTypeCheck.class); - final String[] expected = {"14: " + getCheckMessage(MSG_KEY, typeName), }; + final String[] expected = {"14:24: " + getCheckMessage(MSG_KEY, typeName), }; verify(checkConfig, getPath("InputPublicReferenceToPrivateTypeCheck7.java"), expected); @@ -171,7 +171,7 @@ public void returnPrivateInMapInCollectionInCollection() final String typeName = "PrivateInner"; final DefaultConfiguration checkConfig = createModuleConfig(PublicReferenceToPrivateTypeCheck.class); - final String[] expected = {"14: " + getCheckMessage(MSG_KEY, typeName), }; + final String[] expected = {"14:40: " + getCheckMessage(MSG_KEY, typeName), }; verify(checkConfig, getPath("InputPublicReferenceToPrivateTypeCheck9.java"), expected); @@ -191,8 +191,8 @@ public void complexTest() final DefaultConfiguration checkConfig = createModuleConfig(PublicReferenceToPrivateTypeCheck.class); final String[] expected = { - "25: " + getCheckMessage(MSG_KEY, typeName), - "28: " + getCheckMessage(MSG_KEY, typeName1), + "25:40: " + getCheckMessage(MSG_KEY, typeName), + "28:12: " + getCheckMessage(MSG_KEY, typeName1), }; verify(checkConfig, getPath("InputPublicReferenceToPrivateTypeCheck8.java"), @@ -212,9 +212,9 @@ public void methodModifiersTest() final DefaultConfiguration checkConfig = createModuleConfig(PublicReferenceToPrivateTypeCheck.class); final String[] expected = { - "14: " + getCheckMessage(MSG_KEY, typeName), - "20: " + getCheckMessage(MSG_KEY, typeName), - "23: " + getCheckMessage(MSG_KEY, typeName), + "14:40: " + getCheckMessage(MSG_KEY, typeName), + "20:43: " + getCheckMessage(MSG_KEY, typeName), + "23:33: " + getCheckMessage(MSG_KEY, typeName), }; verify(checkConfig, getPath("InputPublicReferenceToPrivateTypeCheck10.java"), @@ -233,9 +233,9 @@ public void wildcardsTest() final DefaultConfiguration checkConfig = createModuleConfig(PublicReferenceToPrivateTypeCheck.class); final String[] expected = { - "14: " + getCheckMessage(MSG_KEY, typeName), - "20: " + getCheckMessage(MSG_KEY, typeName), - "23: " + getCheckMessage(MSG_KEY, typeName), + "14:24: " + getCheckMessage(MSG_KEY, typeName), + "20:29: " + getCheckMessage(MSG_KEY, typeName), + "23:33: " + getCheckMessage(MSG_KEY, typeName), }; verify(checkConfig, getPath("InputPublicReferenceToPrivateTypeCheck11.java"), @@ -249,8 +249,8 @@ public void interfacesTest() final DefaultConfiguration checkConfig = createModuleConfig(PublicReferenceToPrivateTypeCheck.class); final String[] expected = { - "13: " + getCheckMessage(MSG_KEY, typeName), - "19: " + getCheckMessage(MSG_KEY, typeName), + "13:24: " + getCheckMessage(MSG_KEY, typeName), + "19:16: " + getCheckMessage(MSG_KEY, typeName), }; verify(checkConfig, getPath("InputPublicReferenceToPrivateTypeCheck12.java"), @@ -264,8 +264,8 @@ public void enumsTest() final DefaultConfiguration checkConfig = createModuleConfig(PublicReferenceToPrivateTypeCheck.class); final String[] expected = { - "8: " + getCheckMessage(MSG_KEY, typeName), - "10: " + getCheckMessage(MSG_KEY, typeName), + "8:5: " + getCheckMessage(MSG_KEY, typeName), + "10:15: " + getCheckMessage(MSG_KEY, typeName), }; verify(checkConfig, getPath("InputPublicReferenceToPrivateTypeCheck13.java"), @@ -281,11 +281,11 @@ public void testClassEnumInterface() final DefaultConfiguration checkConfig = createModuleConfig(PublicReferenceToPrivateTypeCheck.class); final String[] expected = { - "15: " + getCheckMessage(MSG_KEY, typeName), - "25: " + getCheckMessage(MSG_KEY, typeName1), - "31: " + getCheckMessage(MSG_KEY, typeName1), - "35: " + getCheckMessage(MSG_KEY, typeName2), - "37: " + getCheckMessage(MSG_KEY, typeName2), + "15:12: " + getCheckMessage(MSG_KEY, typeName), + "25:24: " + getCheckMessage(MSG_KEY, typeName1), + "31:16: " + getCheckMessage(MSG_KEY, typeName1), + "35:5: " + getCheckMessage(MSG_KEY, typeName2), + "37:15: " + getCheckMessage(MSG_KEY, typeName2), }; verify(checkConfig, getPath("InputPublicReferenceToPrivateTypeCheck14.java"), @@ -298,12 +298,12 @@ public void returnFromInnerTypeTest() final DefaultConfiguration checkConfig = createModuleConfig(PublicReferenceToPrivateTypeCheck.class); final String[] expected = { - "4: " + getCheckMessage(MSG_KEY, "Inner"), - "4: " + getCheckMessage(MSG_KEY, "Inner1"), - "9: " + getCheckMessage(MSG_KEY, "Inner"), - "9: " + getCheckMessage(MSG_KEY, "Inner2"), - "9: " + getCheckMessage(MSG_KEY, "Inner3"), - "14: " + getCheckMessage(MSG_KEY, "Inner"), + "4:12: " + getCheckMessage(MSG_KEY, "Inner"), + "4:18: " + getCheckMessage(MSG_KEY, "Inner1"), + "9:12: " + getCheckMessage(MSG_KEY, "Inner"), + "9:18: " + getCheckMessage(MSG_KEY, "Inner2"), + "9:25: " + getCheckMessage(MSG_KEY, "Inner3"), + "14:12: " + getCheckMessage(MSG_KEY, "Inner"), }; verify(checkConfig, getPath("InputPublicReferenceToPrivateTypeCheck15.java"), @@ -316,9 +316,9 @@ public void returnFromInnerAnonymousClassTest() final DefaultConfiguration checkConfig = createModuleConfig(PublicReferenceToPrivateTypeCheck.class); final String[] expected = { - "4: " + getCheckMessage(MSG_KEY, "Inner"), - "4: " + getCheckMessage(MSG_KEY, "Inner2"), - "4: " + getCheckMessage(MSG_KEY, "Inner3"), + "4:12: " + getCheckMessage(MSG_KEY, "Inner"), + "4:18: " + getCheckMessage(MSG_KEY, "Inner2"), + "4:25: " + getCheckMessage(MSG_KEY, "Inner3"), }; verify(checkConfig, getPath("InputPublicReferenceToPrivateTypeCheck16.java"), @@ -331,8 +331,8 @@ public void returnFromPublicFieldTest() final DefaultConfiguration checkConfig = createModuleConfig(PublicReferenceToPrivateTypeCheck.class); final String[] expected = { - "4: " + getCheckMessage(MSG_KEY, "Inner"), - "9: " + getCheckMessage(MSG_KEY, "Inner1"), + "4:12: " + getCheckMessage(MSG_KEY, "Inner"), + "9:12: " + getCheckMessage(MSG_KEY, "Inner1"), }; verify(checkConfig, getPath("InputPublicReferenceToPrivateTypeCheck17.java"), @@ -345,7 +345,7 @@ public void implementingOrExtendingPrivateTypeTest() final DefaultConfiguration checkConfig = createModuleConfig(PublicReferenceToPrivateTypeCheck.class); final String[] expected = { - "17: " + getCheckMessage(MSG_KEY, "InnerClass"), + "17:12: " + getCheckMessage(MSG_KEY, "InnerClass"), }; verify(checkConfig, getPath("InputPublicReferenceToPrivateTypeCheck18.java"), @@ -358,9 +358,9 @@ public void usingPrivateTypeAsMethodParameterTest() final DefaultConfiguration checkConfig = createModuleConfig(PublicReferenceToPrivateTypeCheck.class); final String[] expected = { - "4: " + getCheckMessage(MSG_KEY, "C1"), - "6: " + getCheckMessage(MSG_KEY, "C1"), - "8: " + getCheckMessage(MSG_KEY, "C1"), + "4:31: " + getCheckMessage(MSG_KEY, "C1"), + "6:23: " + getCheckMessage(MSG_KEY, "C1"), + "8:43: " + getCheckMessage(MSG_KEY, "C1"), }; verify(checkConfig, getPath("InputPublicReferenceToPrivateTypeCheck19.java"), From 28e0659f02cd3e05216bd7e94e02d88bac73b44e Mon Sep 17 00:00:00 2001 From: rnveach Date: Sat, 26 May 2018 21:52:47 -0400 Subject: [PATCH 179/208] Issue #662: moved line only Checks to log AST (part 2) --- .../LogicConditionNeedOptimizationCheck.java | 2 +- .../NoNullForCollectionReturnCheck.java | 2 +- .../NumericLiteralNeedsUnderscoreCheck.java | 2 +- .../checks/coding/RedundantReturnCheck.java | 2 +- .../coding/SingleBreakOrContinueCheck.java | 2 +- .../design/AvoidConditionInversionCheck.java | 2 +- .../NoMainMethodInAbstractClassCheck.java | 2 +- ...gicConditionNeedOptimizationCheckTest.java | 34 ++-- .../NoNullForCollectionReturnCheckTest.java | 54 +++--- ...umericLiteralNeedsUnderscoreCheckTest.java | 166 +++++++++--------- .../coding/RedundantReturnCheckTest.java | 58 +++--- .../SingleBreakOrContinueCheckTest.java | 24 +-- .../AvoidConditionInversionCheckTest.java | 34 ++-- .../NoMainMethodInAbstractClassCheckTest.java | 46 ++--- 14 files changed, 215 insertions(+), 215 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 b70e16819a..8864fb7949 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 @@ -60,7 +60,7 @@ public int[] getRequiredTokens() { @Override public void visitToken(DetailAST detailAST) { if (needOptimization(detailAST)) { - log(detailAST.getLineNo(), MSG_KEY, + log(detailAST, MSG_KEY, detailAST.getText(), detailAST.getLineNo(), detailAST.getColumnNo()); } 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 f8a527dc21..472c65a6de 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 @@ -160,7 +160,7 @@ public void visitToken(DetailAST detailAST) { && (hasNullLiteralInReturn(detailAST) || (searchThroughMethodBody && isReturnedValueBeNull(detailAST)))) { - log(detailAST.getLineNo(), MSG_KEY); + log(detailAST, MSG_KEY); } } break; 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 2c36c77fa0..355828b1d5 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 @@ -352,7 +352,7 @@ public int[] getRequiredTokens() { @Override public void visitToken(final DetailAST ast) { if (!passesCheck(ast)) { - log(ast.getLineNo(), MSG_KEY); + log(ast, MSG_KEY); } } 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 b05ad5ed64..fe09d1d494 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 @@ -181,7 +181,7 @@ private static boolean isVoidMethodWithNonEmptyBody(DetailAST methodDefAst) { */ private void log(List redundantReturnsAst) { for (DetailAST redundantLiteralReturnAst : redundantReturnsAst) { - log(redundantLiteralReturnAst.getLineNo(), MSG_KEY); + log(redundantLiteralReturnAst, MSG_KEY); } } 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 8debb6132e..898d41640c 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 @@ -138,7 +138,7 @@ public int[] getRequiredTokens() { @Override public void visitToken(DetailAST ast) { if (getNumberOfContinueAndBreaks(ast.getFirstChild()) > 1) { - log(ast.getLineNo(), MSG_KEY); + log(ast, MSG_KEY); } } 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 3d2942b6d4..dcb141ab11 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 @@ -323,7 +323,7 @@ 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); + log(inversionAst, MSG_KEY); } } 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 0916e7ee36..cfc52e238d 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 @@ -79,7 +79,7 @@ public final void visitToken(final DetailAST ast) { } // type of token is METHOD_DEF else if (isChildOfCurrentObjBlockToken(ast) && isMainMethod(ast)) { - log(ast.getLineNo(), MSG_KEY); + log(ast, MSG_KEY); // remove current objblock objBlockTokensStack.pop(); } 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 be23c1cb5b..c844d3baec 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 @@ -38,23 +38,23 @@ public void test() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(LogicConditionNeedOptimizationCheck.class); final String[] expected = { - "26: " + getCheckMessage(MSG_KEY, "&&", 26, 27), - "28: " + getCheckMessage(MSG_KEY, "&&", 28, 21), - "28: " + getCheckMessage(MSG_KEY, "||", 28, 31), - "38: " + getCheckMessage(MSG_KEY, "&&", 38, 21), - "40: " + getCheckMessage(MSG_KEY, "&&", 40, 38), - "45: " + getCheckMessage(MSG_KEY, "&&", 45, 25), - "47: " + getCheckMessage(MSG_KEY, "&&", 47, 42), - "57: " + getCheckMessage(MSG_KEY, "&&", 57, 18), - "59: " + getCheckMessage(MSG_KEY, "&&", 59, 35), - "60: " + getCheckMessage(MSG_KEY, "&&", 60, 19), - "60: " + getCheckMessage(MSG_KEY, "&&", 60, 29), - "62: " + getCheckMessage(MSG_KEY, "&&", 62, 21), - "66: " + getCheckMessage(MSG_KEY, "&&", 66, 19), - "67: " + getCheckMessage(MSG_KEY, "&&", 67, 38), - "69: " + getCheckMessage(MSG_KEY, "&&", 69, 35), - "72: " + getCheckMessage(MSG_KEY, "&&", 72, 19), - "93: " + getCheckMessage(MSG_KEY, "||", 93, 33), + "26:42: " + getCheckMessage(MSG_KEY, "&&", 26, 27), + "28:36: " + getCheckMessage(MSG_KEY, "&&", 28, 21), + "28:46: " + getCheckMessage(MSG_KEY, "||", 28, 31), + "38:36: " + getCheckMessage(MSG_KEY, "&&", 38, 21), + "40:53: " + getCheckMessage(MSG_KEY, "&&", 40, 38), + "45:40: " + getCheckMessage(MSG_KEY, "&&", 45, 25), + "47:57: " + getCheckMessage(MSG_KEY, "&&", 47, 42), + "57:33: " + getCheckMessage(MSG_KEY, "&&", 57, 18), + "59:50: " + getCheckMessage(MSG_KEY, "&&", 59, 35), + "60:34: " + getCheckMessage(MSG_KEY, "&&", 60, 19), + "60:44: " + getCheckMessage(MSG_KEY, "&&", 60, 29), + "62:36: " + getCheckMessage(MSG_KEY, "&&", 62, 21), + "66:34: " + getCheckMessage(MSG_KEY, "&&", 66, 19), + "67:53: " + getCheckMessage(MSG_KEY, "&&", 67, 38), + "69:50: " + getCheckMessage(MSG_KEY, "&&", 69, 35), + "72:34: " + getCheckMessage(MSG_KEY, "&&", 72, 19), + "93:34: " + getCheckMessage(MSG_KEY, "||", 93, 33), }; verify(checkConfig, getPath("InputLogicConditionNeedOptimizationCheck.java"), expected); } 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 60146813a7..de88008c57 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 @@ -40,10 +40,10 @@ public void testArraysNotDeep() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(NoNullForCollectionReturnCheck.class); final String[] expected = { - "11: " + warningMessage, - "46: " + warningMessage, - "54: " + warningMessage, - "59: " + warningMessage, + "11:9: " + warningMessage, + "46:13: " + warningMessage, + "54:13: " + warningMessage, + "59:17: " + warningMessage, }; verify(checkConfig, getPath("InputNoNullForCollectionReturnCheck1.java"), expected); @@ -55,11 +55,11 @@ public void testArraysDeep() throws Exception { createModuleConfig(NoNullForCollectionReturnCheck.class); checkConfig.addAttribute("searchThroughMethodBody", "true"); final String[] expected = { - "11: " + warningMessage, - "18: " + warningMessage, - "46: " + warningMessage, - "54: " + warningMessage, - "59: " + warningMessage, + "11:9: " + warningMessage, + "18:9: " + warningMessage, + "46:13: " + warningMessage, + "54:13: " + warningMessage, + "59:17: " + warningMessage, }; verify(checkConfig, getPath("InputNoNullForCollectionReturnCheck1.java"), expected); @@ -72,13 +72,13 @@ public void testCollections() throws Exception { checkConfig.addAttribute("collectionList", "Collection ArrayList LinkedList Stack Vector HashSet TreeSet"); final String[] expected = { - "7: " + warningMessage, - "17: " + warningMessage, - "27: " + warningMessage, - "37: " + warningMessage, - "47: " + warningMessage, - "57: " + warningMessage, - "67: " + warningMessage, + "7:9: " + warningMessage, + "17:9: " + warningMessage, + "27:9: " + warningMessage, + "37:9: " + warningMessage, + "47:9: " + warningMessage, + "57:9: " + warningMessage, + "67:9: " + warningMessage, }; verify(checkConfig, getPath("InputNoNullForCollectionReturnCheck2.java"), expected); @@ -89,8 +89,8 @@ public void testRevereCode() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(NoNullForCollectionReturnCheck.class); final String[] expected = { - "13: " + warningMessage, - "16: " + warningMessage, + "13:25: " + warningMessage, + "16:25: " + warningMessage, }; verify(checkConfig, getPath("InputNoNullForCollectionReturnCheck3.java"), expected); @@ -102,8 +102,8 @@ public void testRevereCodeDeep() throws Exception { createModuleConfig(NoNullForCollectionReturnCheck.class); checkConfig.addAttribute("searchThroughMethodBody", "true"); final String[] expected = { - "13: " + warningMessage, - "16: " + warningMessage, + "13:25: " + warningMessage, + "16:25: " + warningMessage, }; verify(checkConfig, getPath("InputNoNullForCollectionReturnCheck3.java"), expected); @@ -124,10 +124,10 @@ public void testInnerClasses() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(NoNullForCollectionReturnCheck.class); final String[] expected = { - "17: " + warningMessage, - "25: " + warningMessage, - "27: " + warningMessage, - "39: " + warningMessage, + "17:17: " + warningMessage, + "25:13: " + warningMessage, + "27:9: " + warningMessage, + "39:13: " + warningMessage, }; verify(checkConfig, getPath("InputNoNullForCollectionReturnCheck5.java"), expected); @@ -150,7 +150,7 @@ public void testIss148() final DefaultConfiguration checkConfig = createModuleConfig(NoNullForCollectionReturnCheck.class); final String[] expected = { - "8: " + warningMessage, + "8:9: " + warningMessage, }; verify(checkConfig, getPath("InputNoNullForCollectionReturnCheck7.java"), expected); @@ -163,7 +163,7 @@ public void testIss148Deep() createModuleConfig(NoNullForCollectionReturnCheck.class); checkConfig.addAttribute("searchThroughMethodBody", "true"); final String[] expected = { - "8: " + warningMessage, + "8:9: " + warningMessage, }; verify(checkConfig, getPath("InputNoNullForCollectionReturnCheck7.java"), expected); @@ -175,7 +175,7 @@ public void testConstructor() final DefaultConfiguration checkConfig = createModuleConfig(NoNullForCollectionReturnCheck.class); final String[] expected = { - "5: " + warningMessage, + "5:9: " + warningMessage, }; verify(checkConfig, getPath("InputNoNullForCollectionReturnCheckConstructor.java"), 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 1d9353dcff..0cfff8677e 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 @@ -54,38 +54,38 @@ public void test() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(NumericLiteralNeedsUnderscoreCheck.class); final String[] expected = { - "27: " + warningMessage, - "28: " + warningMessage, - "29: " + warningMessage, - "30: " + warningMessage, - "31: " + warningMessage, - "32: " + warningMessage, - "33: " + warningMessage, - "50: " + warningMessage, - "51: " + warningMessage, - "52: " + warningMessage, - "53: " + warningMessage, - "54: " + warningMessage, - "55: " + warningMessage, - "56: " + warningMessage, - "57: " + warningMessage, - "75: " + warningMessage, - "76: " + warningMessage, - "77: " + warningMessage, - "78: " + warningMessage, - "79: " + warningMessage, - "80: " + warningMessage, - "81: " + warningMessage, - "82: " + warningMessage, - "83: " + warningMessage, - "84: " + warningMessage, - "85: " + warningMessage, - "99: " + warningMessage, - "100: " + warningMessage, - "101: " + warningMessage, - "102: " + warningMessage, - "103: " + warningMessage, - "104: " + warningMessage, + "27:22: " + warningMessage, + "28:25: " + warningMessage, + "29:25: " + warningMessage, + "30:26: " + warningMessage, + "31:28: " + warningMessage, + "32:22: " + warningMessage, + "33:25: " + warningMessage, + "50:23: " + warningMessage, + "51:23: " + warningMessage, + "52:23: " + warningMessage, + "53:24: " + warningMessage, + "54:24: " + warningMessage, + "55:24: " + warningMessage, + "56:24: " + warningMessage, + "57:24: " + warningMessage, + "75:23: " + warningMessage, + "76:23: " + warningMessage, + "77:23: " + warningMessage, + "78:23: " + warningMessage, + "79:23: " + warningMessage, + "80:25: " + warningMessage, + "81:25: " + warningMessage, + "82:27: " + warningMessage, + "83:27: " + warningMessage, + "84:29: " + warningMessage, + "85:29: " + warningMessage, + "99:23: " + warningMessage, + "100:23: " + warningMessage, + "101:25: " + warningMessage, + "102:25: " + warningMessage, + "103:25: " + warningMessage, + "104:25: " + warningMessage, }; verify(checkConfig, getPath("InputNumericLiteralNeedsUnderscoreCheck.java"), expected); @@ -102,31 +102,31 @@ public void testWithConfig() throws Exception { checkConfig.addAttribute("minBinarySymbolLength", "1"); checkConfig.addAttribute("maxBinarySymbolsUntilUnderscore", "4"); final String[] expected = { - "23: " + warningMessage, - "24: " + warningMessage, - "25: " + warningMessage, - "26: " + warningMessage, - "27: " + warningMessage, - "28: " + warningMessage, - "44: " + warningMessage, - "45: " + warningMessage, - "46: " + warningMessage, - "47: " + warningMessage, - "48: " + warningMessage, - "49: " + warningMessage, - "50: " + warningMessage, - "67: " + warningMessage, - "68: " + warningMessage, - "69: " + warningMessage, - "70: " + warningMessage, - "71: " + warningMessage, - "72: " + warningMessage, - "73: " + warningMessage, - "74: " + warningMessage, - "86: " + warningMessage, - "87: " + warningMessage, - "88: " + warningMessage, - "89: " + warningMessage, + "23:22: " + warningMessage, + "24:24: " + warningMessage, + "25:26: " + warningMessage, + "26:28: " + warningMessage, + "27:22: " + warningMessage, + "28:25: " + warningMessage, + "44:23: " + warningMessage, + "45:23: " + warningMessage, + "46:23: " + warningMessage, + "47:24: " + warningMessage, + "48:24: " + warningMessage, + "49:24: " + warningMessage, + "50:24: " + warningMessage, + "67:23: " + warningMessage, + "68:23: " + warningMessage, + "69:23: " + warningMessage, + "70:25: " + warningMessage, + "71:27: " + warningMessage, + "72:27: " + warningMessage, + "73:29: " + warningMessage, + "74:29: " + warningMessage, + "86:23: " + warningMessage, + "87:23: " + warningMessage, + "88:25: " + warningMessage, + "89:25: " + warningMessage, }; verify(checkConfig, getPath("InputNumericLiteralNeedsUnderscoreCheck2.java"), expected); @@ -137,19 +137,19 @@ public void testIgnore() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(NumericLiteralNeedsUnderscoreCheck.class); final String[] expected = { - "7: " + warningMessage, - "8: " + warningMessage, - "10: " + warningMessage, - "15: " + warningMessage, - "16: " + warningMessage, - "17: " + warningMessage, - "22: " + warningMessage, - "24: " + warningMessage, - "30: " + warningMessage, - "31: " + warningMessage, - "32: " + warningMessage, - "33: " + warningMessage, - "40: " + warningMessage, + "7:36: " + warningMessage, + "8:37: " + warningMessage, + "10:30: " + warningMessage, + "15:44: " + warningMessage, + "16:44: " + warningMessage, + "17:39: " + warningMessage, + "22:28: " + warningMessage, + "24:24: " + warningMessage, + "30:19: " + warningMessage, + "31:19: " + warningMessage, + "32:19: " + warningMessage, + "33:19: " + warningMessage, + "40:32: " + warningMessage, }; verify(checkConfig, new File("src/test/resources-noncompilable/com/github/sevntu/" @@ -164,19 +164,19 @@ public void testConfiguredIgnore() throws Exception { checkConfig.addAttribute("ignoreFieldNamePattern", "RED"); checkConfig.addAttribute("minDecimalSymbolLength", "1"); final String[] expected = { - "7: " + warningMessage, - "8: " + warningMessage, - "10: " + warningMessage, - "14: " + warningMessage, - "15: " + warningMessage, - "17: " + warningMessage, - "22: " + warningMessage, - "24: " + warningMessage, - "30: " + warningMessage, - "31: " + warningMessage, - "32: " + warningMessage, - "33: " + warningMessage, - "38: " + warningMessage, + "7:36: " + warningMessage, + "8:37: " + warningMessage, + "10:30: " + warningMessage, + "14:59: " + warningMessage, + "15:44: " + warningMessage, + "17:39: " + warningMessage, + "22:28: " + warningMessage, + "24:24: " + warningMessage, + "30:19: " + warningMessage, + "31:19: " + warningMessage, + "32:19: " + warningMessage, + "33:19: " + warningMessage, + "38:55: " + warningMessage, }; verify(checkConfig, new File("src/test/resources-noncompilable/com/github/sevntu/" 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 1e61a54a25..f05ffc1c9d 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 @@ -45,22 +45,22 @@ public void testInputWithIgnoreEmptyConstructorsTrue() "false"); final String[] expected = { - "10: " + getCheckMessage(MSG_KEY), - "17: " + getCheckMessage(MSG_KEY), - "22: " + getCheckMessage(MSG_KEY), - "32: " + getCheckMessage(MSG_KEY), - "39: " + getCheckMessage(MSG_KEY), - "52: " + getCheckMessage(MSG_KEY), - "56: " + getCheckMessage(MSG_KEY), - "60: " + getCheckMessage(MSG_KEY), - "87: " + getCheckMessage(MSG_KEY), - "100: " + getCheckMessage(MSG_KEY), - "104: " + getCheckMessage(MSG_KEY), - "117: " + getCheckMessage(MSG_KEY), - "128: " + getCheckMessage(MSG_KEY), - "140: " + getCheckMessage(MSG_KEY), - "151: " + getCheckMessage(MSG_KEY), - "181: " + getCheckMessage(MSG_KEY), + "10:17: " + getCheckMessage(MSG_KEY), + "17:17: " + getCheckMessage(MSG_KEY), + "22:17: " + getCheckMessage(MSG_KEY), + "32:33: " + getCheckMessage(MSG_KEY), + "39:17: " + getCheckMessage(MSG_KEY), + "52:25: " + getCheckMessage(MSG_KEY), + "56:25: " + getCheckMessage(MSG_KEY), + "60:25: " + getCheckMessage(MSG_KEY), + "87:25: " + getCheckMessage(MSG_KEY), + "100:25: " + getCheckMessage(MSG_KEY), + "104:25: " + getCheckMessage(MSG_KEY), + "117:13: " + getCheckMessage(MSG_KEY), + "128:33: " + getCheckMessage(MSG_KEY), + "140:33: " + getCheckMessage(MSG_KEY), + "151:33: " + getCheckMessage(MSG_KEY), + "181:49: " + getCheckMessage(MSG_KEY), }; verify(checkConfig, getPath("InputRedundantReturnCheck.java"), expected); @@ -74,19 +74,19 @@ public void testInputWithIgnoreEmptyConstructorsFalse() "true"); final String[] expected = { - "17: " + getCheckMessage(MSG_KEY), - "32: " + getCheckMessage(MSG_KEY), - "39: " + getCheckMessage(MSG_KEY), - "52: " + getCheckMessage(MSG_KEY), - "56: " + getCheckMessage(MSG_KEY), - "60: " + getCheckMessage(MSG_KEY), - "100: " + getCheckMessage(MSG_KEY), - "104: " + getCheckMessage(MSG_KEY), - "117: " + getCheckMessage(MSG_KEY), - "128: " + getCheckMessage(MSG_KEY), - "140: " + getCheckMessage(MSG_KEY), - "151: " + getCheckMessage(MSG_KEY), - "181: " + getCheckMessage(MSG_KEY), + "17:17: " + getCheckMessage(MSG_KEY), + "32:33: " + getCheckMessage(MSG_KEY), + "39:17: " + getCheckMessage(MSG_KEY), + "52:25: " + getCheckMessage(MSG_KEY), + "56:25: " + getCheckMessage(MSG_KEY), + "60:25: " + getCheckMessage(MSG_KEY), + "100:25: " + getCheckMessage(MSG_KEY), + "104:25: " + getCheckMessage(MSG_KEY), + "117:13: " + getCheckMessage(MSG_KEY), + "128:33: " + getCheckMessage(MSG_KEY), + "140:33: " + getCheckMessage(MSG_KEY), + "151:33: " + getCheckMessage(MSG_KEY), + "181:49: " + getCheckMessage(MSG_KEY), }; verify(checkConfig, getPath("InputRedundantReturnCheck.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 9078463148..0d16084bb5 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 @@ -47,18 +47,18 @@ public void testDefault() final DefaultConfiguration checkConfig = createModuleConfig(SingleBreakOrContinueCheck.class); final String[] expected = { - "8: " + warningMessage, - "26: " + warningMessage, - "44: " + warningMessage, - "88: " + warningMessage, - "106: " + warningMessage, - "124: " + warningMessage, - "168: " + warningMessage, - "187: " + warningMessage, - "206: " + warningMessage, - "346: " + warningMessage, - "367: " + warningMessage, - "389: " + warningMessage, + "8:9: " + warningMessage, + "26:9: " + warningMessage, + "44:9: " + warningMessage, + "88:9: " + warningMessage, + "106:9: " + warningMessage, + "124:9: " + warningMessage, + "168:9: " + warningMessage, + "187:9: " + warningMessage, + "206:9: " + warningMessage, + "346:13: " + warningMessage, + "367:13: " + warningMessage, + "389:13: " + warningMessage, }; verify(checkConfig, getPath("InputSingleBreakOrContinueCheck.java"), 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 3d35e704e7..ad57f628bd 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 @@ -47,16 +47,16 @@ public void defaultTest() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(AvoidConditionInversionCheck.class); final String[] expected = { - "7: " + getCheckMessage(MSG_KEY), - "11: " + getCheckMessage(MSG_KEY), - "15: " + getCheckMessage(MSG_KEY), - "19: " + getCheckMessage(MSG_KEY), - "23: " + getCheckMessage(MSG_KEY), - "29: " + getCheckMessage(MSG_KEY), - "31: " + getCheckMessage(MSG_KEY), - "39: " + getCheckMessage(MSG_KEY), - "102: " + getCheckMessage(MSG_KEY), - "107: " + getCheckMessage(MSG_KEY), + "7:24: " + getCheckMessage(MSG_KEY), + "11:24: " + getCheckMessage(MSG_KEY), + "15:24: " + getCheckMessage(MSG_KEY), + "19:21: " + getCheckMessage(MSG_KEY), + "23:24: " + getCheckMessage(MSG_KEY), + "29:27: " + getCheckMessage(MSG_KEY), + "31:34: " + getCheckMessage(MSG_KEY), + "39:24: " + getCheckMessage(MSG_KEY), + "102:21: " + getCheckMessage(MSG_KEY), + "107:21: " + getCheckMessage(MSG_KEY), }; verify(checkConfig, getPath("InputAvoidConditionInversionCheck.java"), @@ -71,13 +71,13 @@ public void avoidOnlyRelationalOperandsInCondition() throws Exception { "true"); final String[] expected = { - "7: " + getCheckMessage(MSG_KEY), - "11: " + getCheckMessage(MSG_KEY), - "15: " + getCheckMessage(MSG_KEY), - "19: " + getCheckMessage(MSG_KEY), - "23: " + getCheckMessage(MSG_KEY), - "29: " + getCheckMessage(MSG_KEY), - "31: " + getCheckMessage(MSG_KEY), + "7:24: " + getCheckMessage(MSG_KEY), + "11:24: " + getCheckMessage(MSG_KEY), + "15:24: " + getCheckMessage(MSG_KEY), + "19:21: " + getCheckMessage(MSG_KEY), + "23:24: " + getCheckMessage(MSG_KEY), + "29:27: " + getCheckMessage(MSG_KEY), + "31:34: " + getCheckMessage(MSG_KEY), }; verify(checkConfig, getPath("InputAvoidConditionInversionCheck.java"), 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 f5df777eca..bd972d15fd 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 @@ -57,29 +57,29 @@ public final void testDefault() final DefaultConfiguration checkConfig = createModuleConfig(NoMainMethodInAbstractClassCheck.class); final String[] expected = { - "23: " + warningMessage, - "26: " + warningMessage, - "34: " + warningMessage, - "37: " + warningMessage, - "51: " + warningMessage, - "53: " + warningMessage, - "57: " + warningMessage, - "59: " + warningMessage, - "100: " + warningMessage, - "103: " + warningMessage, - "106: " + warningMessage, - "109: " + warningMessage, - "116: " + warningMessage, - "119: " + warningMessage, - "122: " + warningMessage, - "125: " + warningMessage, - "130: " + warningMessage, - "136: " + warningMessage, - "151: " + warningMessage, - "155: " + warningMessage, - "166: " + warningMessage, - "175: " + warningMessage, - "185: " + warningMessage, + "23:5: " + warningMessage, + "26:5: " + warningMessage, + "34:9: " + warningMessage, + "37:9: " + warningMessage, + "51:5: " + warningMessage, + "53:9: " + warningMessage, + "57:5: " + warningMessage, + "59:9: " + warningMessage, + "100:5: " + warningMessage, + "103:5: " + warningMessage, + "106:5: " + warningMessage, + "109:5: " + warningMessage, + "116:5: " + warningMessage, + "119:5: " + warningMessage, + "122:5: " + warningMessage, + "125:5: " + warningMessage, + "130:5: " + warningMessage, + "136:5: " + warningMessage, + "151:8: " + warningMessage, + "155:4: " + warningMessage, + "166:9: " + warningMessage, + "175:9: " + warningMessage, + "185:9: " + warningMessage, }; verify(checkConfig, From 2733c8d56eff50398fa8b0ab95f79c3394fe2596 Mon Sep 17 00:00:00 2001 From: Roman Ivanov Date: Sun, 27 May 2018 15:57:16 -0700 Subject: [PATCH 180/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 9dd029ed0d..5a871926d4 100644 --- a/sevntu-checks/pom.xml +++ b/sevntu-checks/pom.xml @@ -16,7 +16,7 @@ iso-8859-1 - 8.10 + 8.10.1 https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.eclipse-cs.version}/config/checkstyle_checks.xml 2.17 RELEASE From 24991c98a14e2dd446bcaf4c0830facc50dce89d Mon Sep 17 00:00:00 2001 From: Roman Ivanov Date: Sun, 27 May 2018 16:16:11 -0700 Subject: [PATCH 181/208] minor: wrap long line in travis.sh --- .ci/travis.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.ci/travis.sh b/.ci/travis.sh index 3e4e6d4ce0..7637142550 100755 --- a/.ci/travis.sh +++ b/.ci/travis.sh @@ -66,7 +66,9 @@ 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 -Dmaven.sevntu-checkstyle-check.checkstyle.version=8.7 + 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) From ddb7bc5b34e194a4f890774809c766bfa79fc5e9 Mon Sep 17 00:00:00 2001 From: rnveach Date: Sun, 27 May 2018 00:22:46 -0400 Subject: [PATCH 182/208] Issue #669: removed branchContains for complicated cases (part 1) --- ...idConstantAsFirstOperandInConditionCheck.java | 2 +- .../coding/CustomDeclarationOrderCheck.java | 2 +- .../coding/NoNullForCollectionReturnCheck.java | 2 +- .../coding/SimpleAccessorNameNotationCheck.java | 2 +- .../design/ConstructorWithoutParamsCheck.java | 2 +- .../PublicReferenceToPrivateTypeCheck.java | 4 ++-- .../design/StaticMethodCandidateCheck.java | 2 +- ...nstantAsFirstOperandInConditionCheckTest.java | 11 +++++++++++ .../PublicReferenceToPrivateTypeCheckTest.java | 13 +++++++++++++ ...idConstantAsFirstOperandInConditionCheck.java | 10 ++++++++++ ...InputPublicReferenceToPrivateTypeCheck20.java | 16 ++++++++++++++++ 11 files changed, 58 insertions(+), 8 deletions(-) create mode 100644 sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputPublicReferenceToPrivateTypeCheck20.java 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 6df86449ff..62e0d98dee 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 @@ -128,7 +128,7 @@ private boolean isRefactoringRequired(DetailAST logicNode) { final int constantType = firstOperand.getType(); return isTargetConstantType(constantType) - && !secondOperand.branchContains(constantType); + && secondOperand.getType() != firstOperand.getType(); } /** 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 a14cc0eb4d..605ad50745 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 @@ -755,7 +755,7 @@ private boolean isSetterCorrect(DetailAST methodDefAst, String methodPrefix) { final DetailAST methodTypeAst = methodDefAst.findFirstToken(TokenTypes.TYPE); - if (methodTypeAst.branchContains(TokenTypes.LITERAL_VOID)) { + if (methodTypeAst.findFirstToken(TokenTypes.LITERAL_VOID) != null) { final DetailAST statementsAst = methodDefAst.findFirstToken(TokenTypes.SLIST); final String methodName = getIdentifier(methodDefAst); final String setterFieldName = fieldPrefix 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 472c65a6de..3c118ee7f3 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 @@ -280,7 +280,7 @@ private static LinkedList getAllSubblocks(DetailAST blockDef) { subblocks.addAll(getChildren(blockBody, TokenTypes.LITERAL_TRY)); final List nestedSubblocks = new LinkedList<>(); for (DetailAST currentSubblock : subblocks) { - if (currentSubblock.branchContains(TokenTypes.SLIST)) { + if (currentSubblock.findFirstToken(TokenTypes.SLIST) != null) { nestedSubblocks.addAll(getAllSubblocks(currentSubblock)); } } 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 1f2b868068..d0837a39ee 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 @@ -138,7 +138,7 @@ else if (methodName.startsWith(GETTER_PREFIX)) { private boolean isSetterCorrect(DetailAST methodDef, String methodName) { final DetailAST methodType = methodDef.findFirstToken(TokenTypes.TYPE); boolean result = true; - if (methodType.branchContains(TokenTypes.LITERAL_VOID)) { + if (methodType.findFirstToken(TokenTypes.LITERAL_VOID) != null) { DetailAST currentVerifiedTop = methodDef.findFirstToken(TokenTypes.SLIST); if (containsOnlyExpression(currentVerifiedTop)) { 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 63d78d7f37..ba98962729 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 @@ -158,7 +158,7 @@ public void visitToken(DetailAST ast) { // and this check does not apply. if (regexp.matcher(className).find() && !ignoredRegexp.matcher(className).find() - && !ast.branchContains(TokenTypes.ARRAY_DECLARATOR)) { + && ast.findFirstToken(TokenTypes.ARRAY_DECLARATOR) == null) { final DetailAST parameterListAST = ast.findFirstToken(TokenTypes.ELIST); final int numberOfParameters = parameterListAST.getChildCount(); 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 4ff4bbb20f..7e29e6323b 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 @@ -258,9 +258,9 @@ private void addExternallyAccessibleFieldTypes(DetailAST fieldDefAst) { */ private boolean isExtendsOrImplementsSmth(DetailAST classOrInterfaceDefAst) { return (classOrInterfaceDefAst - .branchContains(TokenTypes.EXTENDS_CLAUSE) + .findFirstToken(TokenTypes.EXTENDS_CLAUSE) != null || classOrInterfaceDefAst - .branchContains(TokenTypes.IMPLEMENTS_CLAUSE)) + .findFirstToken(TokenTypes.IMPLEMENTS_CLAUSE) != null) && !isExtendsOrImplementsPrivate(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 14a335cc64..cfbcac2dc2 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 @@ -270,7 +270,7 @@ private Frame createMethodFrame(Frame parentFrame, DetailAST ast) { private static boolean isAnonymousClass(DetailAST ast) { final int astType = ast.getType(); return astType == TokenTypes.LITERAL_NEW - && ast.branchContains(TokenTypes.LCURLY); + && ast.findFirstToken(TokenTypes.OBJBLOCK) != null; } /** 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 17805277e1..30f7f89476 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 @@ -67,6 +67,10 @@ public void testAll() throws Exception { "101:23: " + getCheckMessage(MSG_KEY, "=="), "111:19: " + getCheckMessage(MSG_KEY, "=="), "112:40: " + getCheckMessage(MSG_KEY, "=="), + "118:15: " + getCheckMessage(MSG_KEY, "=="), + "119:15: " + getCheckMessage(MSG_KEY, "!="), + "120:15: " + getCheckMessage(MSG_KEY, "!="), + "121:18: " + getCheckMessage(MSG_KEY, "!="), }; verify(checkConfig, getPath("InputAvoidConstantAsFirstOperandInConditionCheck.java"), expected); @@ -81,6 +85,9 @@ public void testAttributes() throws Exception { "25:15: " + getCheckMessage(MSG_KEY, "=="), "28:18: " + getCheckMessage(MSG_KEY, "=="), "31:19: " + getCheckMessage(MSG_KEY, "=="), + "118:15: " + getCheckMessage(MSG_KEY, "=="), + "119:15: " + getCheckMessage(MSG_KEY, "!="), + "120:15: " + getCheckMessage(MSG_KEY, "!="), }; verify(checkConfig, getPath("InputAvoidConstantAsFirstOperandInConditionCheck.java"), expected); @@ -123,6 +130,10 @@ public void testNullProperties() throws Exception { "101:23: " + getCheckMessage(MSG_KEY, "=="), "111:19: " + getCheckMessage(MSG_KEY, "=="), "112:40: " + getCheckMessage(MSG_KEY, "=="), + "118:15: " + getCheckMessage(MSG_KEY, "=="), + "119:15: " + getCheckMessage(MSG_KEY, "!="), + "120:15: " + getCheckMessage(MSG_KEY, "!="), + "121:18: " + getCheckMessage(MSG_KEY, "!="), }; verify(checkConfig, getPath("InputAvoidConstantAsFirstOperandInConditionCheck.java"), 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 4c9d7aa478..e864b57fc4 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 @@ -367,6 +367,19 @@ public void usingPrivateTypeAsMethodParameterTest() expected); } + @Test + public void testNestedInnerClass() + throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(PublicReferenceToPrivateTypeCheck.class); + final String[] expected = { + "7:18: " + getCheckMessage(MSG_KEY, "ConcurrentWeakInternSet"), + }; + verify(checkConfig, + getPath("InputPublicReferenceToPrivateTypeCheck20.java"), + expected); + } + @Test public void testUnsupportedNode() { final DetailAST sync = new DetailAST(); diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputAvoidConstantAsFirstOperandInConditionCheck.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputAvoidConstantAsFirstOperandInConditionCheck.java index 73356e1a1d..7fc6518812 100755 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputAvoidConstantAsFirstOperandInConditionCheck.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputAvoidConstantAsFirstOperandInConditionCheck.java @@ -112,4 +112,14 @@ public void forCyclesCheck() { for (someVariable = null; null == someVariable; someVariable = null) {} //!! } + public void expressionsWithInnerConstant() { + int a = 0, b = 0; + + if (1 == (1 & (a >> b))) {} + if (1 != someMethod(1)) {} + if (1 != a * 2) {} + if (null != System.getProperty("test.src", null)) {} + } + + public int someMethod(int i) { return i; } } diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputPublicReferenceToPrivateTypeCheck20.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputPublicReferenceToPrivateTypeCheck20.java new file mode 100644 index 0000000000..90e9da7208 --- /dev/null +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/design/InputPublicReferenceToPrivateTypeCheck20.java @@ -0,0 +1,16 @@ +package com.github.sevntu.checkstyle.checks.design; + +import java.lang.invoke.MethodType; +import java.lang.ref.WeakReference; + +public class InputPublicReferenceToPrivateTypeCheck20 { + static final ConcurrentWeakInternSet internTable = new ConcurrentWeakInternSet<>(); + + private static class ConcurrentWeakInternSet { + private static class WeakEntry extends WeakReference { + public WeakEntry(T referent) { + super(referent); + } + } + } +} \ No newline at end of file From bfb47cb63a54f9e39332bd1f56969fa5c655148a Mon Sep 17 00:00:00 2001 From: rnveach Date: Wed, 6 Jun 2018 17:29:22 -0400 Subject: [PATCH 183/208] minor: removed and ignored eclipse files --- .gitignore | 4 ++- eclipsecs-sevntu-plugin/.classpath | 7 ---- eclipsecs-sevntu-plugin/.project | 34 ------------------ sevntu-checks/.classpath | 43 ----------------------- sevntu-checks/.project | 23 ------------ sevntu-checkstyle-sonar-plugin/.classpath | 25 ------------- sevntu-checkstyle-sonar-plugin/.project | 29 --------------- 7 files changed, 3 insertions(+), 162 deletions(-) delete mode 100644 eclipsecs-sevntu-plugin/.classpath delete mode 100644 eclipsecs-sevntu-plugin/.project delete mode 100644 sevntu-checks/.classpath delete mode 100644 sevntu-checks/.project delete mode 100644 sevntu-checkstyle-sonar-plugin/.classpath delete mode 100644 sevntu-checkstyle-sonar-plugin/.project diff --git a/.gitignore b/.gitignore index f9ce6766f6..1c9d6f1567 100644 --- a/.gitignore +++ b/.gitignore @@ -5,9 +5,11 @@ bin/ # No Github Pages gh-pages/ -# No Eclipse settings +# No Eclipse files .settings/ .checkstyle +.classpath +.project # No IntelliJ Idea project files .idea/ diff --git a/eclipsecs-sevntu-plugin/.classpath b/eclipsecs-sevntu-plugin/.classpath deleted file mode 100644 index 793d12c5d0..0000000000 --- a/eclipsecs-sevntu-plugin/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/eclipsecs-sevntu-plugin/.project b/eclipsecs-sevntu-plugin/.project deleted file mode 100644 index 3f16447c1c..0000000000 --- a/eclipsecs-sevntu-plugin/.project +++ /dev/null @@ -1,34 +0,0 @@ - - - eclipsecs-sevntu-plugin - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/sevntu-checks/.classpath b/sevntu-checks/.classpath deleted file mode 100644 index 4f3ccaa157..0000000000 --- a/sevntu-checks/.classpath +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sevntu-checks/.project b/sevntu-checks/.project deleted file mode 100644 index 865b916f72..0000000000 --- a/sevntu-checks/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - sevntu-checks - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/sevntu-checkstyle-sonar-plugin/.classpath b/sevntu-checkstyle-sonar-plugin/.classpath deleted file mode 100644 index e3119bfce1..0000000000 --- a/sevntu-checkstyle-sonar-plugin/.classpath +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sevntu-checkstyle-sonar-plugin/.project b/sevntu-checkstyle-sonar-plugin/.project deleted file mode 100644 index 049073edc3..0000000000 --- a/sevntu-checkstyle-sonar-plugin/.project +++ /dev/null @@ -1,29 +0,0 @@ - - - sevntu-checkstyle-sonar-plugin - - - - - - org.eclipse.jdt.core.javabuilder - - - - - net.sf.eclipsecs.core.CheckstyleBuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - net.sf.eclipsecs.core.CheckstyleNature - - From b20c09636e2b75a7269145a23d417ea865ff8f54 Mon Sep 17 00:00:00 2001 From: rnveach Date: Thu, 7 Jun 2018 14:50:02 -0400 Subject: [PATCH 184/208] Issue #662: moved MultipleStringLiteralsExtendedCheck to log AST --- .../MultipleStringLiteralsExtendedCheck.java | 63 ++----------------- 1 file changed, 6 insertions(+), 57 deletions(-) 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 cb3583f799..4b801678b9 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 @@ -49,7 +49,7 @@ public class MultipleStringLiteralsExtendedCheck extends AbstractCheck { * The found strings and their positions. <String, ArrayList>, with * the ArrayList containing StringInfo objects. */ - private final Map> stringMap = Maps.newHashMap(); + private final Map> stringMap = Maps.newHashMap(); /** * Marks the TokenTypes where duplicate strings should be ignored. @@ -152,14 +152,12 @@ public void visitToken(DetailAST ast) { if (!isInIgnoreOccurrenceContext(ast)) { final String currentString = ast.getText(); if ((pattern == null) || !pattern.matcher(currentString).find()) { - List hitList = stringMap.get(currentString); + List hitList = stringMap.get(currentString); if (hitList == null) { hitList = Lists.newArrayList(); stringMap.put(currentString, hitList); } - final int line = ast.getLineNo(); - final int col = ast.getColumnNo(); - hitList.add(new StringInfo(line, col)); + hitList.add(ast); } } } @@ -197,68 +195,19 @@ public void beginTree(DetailAST rootAST) { public void finishTree(DetailAST rootAST) { final Set keys = stringMap.keySet(); for (String key : keys) { - final List hits = stringMap.get(key); + final List hits = stringMap.get(key); if (hits.size() > allowedDuplicates) { int hitsSize = 1; if (highlightAllDuplicates) { hitsSize = hits.size(); } for (int index = 0; index < hitsSize; index++) { - final StringInfo firstFinding = hits.get(index); - final int line = firstFinding.getLine(); - final int col = firstFinding.getCol(); - log(line, col, + final DetailAST firstFinding = hits.get(index); + log(firstFinding, MSG_KEY, key, hits.size()); } } } } - /** - * This class contains information about where a string was found. - */ - private static final class StringInfo { - - /** - * Line of finding. - */ - private final int line; - /** - * Column of finding. - */ - private final int col; - - /** - * Creates information about a string position. - * - * @param line - * int - * @param col - * int - */ - private StringInfo(int line, int col) { - this.line = line; - this.col = col; - } - - /** - * The line where a string was found. - * - * @return int Line of the string. - */ - private int getLine() { - return line; - } - - /** - * The column where a string was found. - * - * @return int Column of the string. - */ - private int getCol() { - return col; - } - - } - } From a3fc2fa32df73a4819237aed800e223dfbc88b71 Mon Sep 17 00:00:00 2001 From: rnveach Date: Wed, 6 Jun 2018 17:20:14 -0400 Subject: [PATCH 185/208] Issue #672: added all condition operands to AvoidConstantAsFirst --- ...onstantAsFirstOperandInConditionCheck.java | 19 +++++++++++++------ ...antAsFirstOperandInConditionCheckTest.java | 12 ++++++++++++ ...onstantAsFirstOperandInConditionCheck.java | 9 +++++++++ 3 files changed, 34 insertions(+), 6 deletions(-) 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 62e0d98dee..0539ef8ba7 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 @@ -27,17 +27,20 @@ import com.puppycrawl.tools.checkstyle.utils.TokenUtils; /** - * 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. + * Checks that constants do not appear in the first operand of any condition. * *

          - * 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. *

          * *

          @@ -93,6 +96,10 @@ public int[] getDefaultTokens() { return new int[] { TokenTypes.EQUAL, TokenTypes.NOT_EQUAL, + TokenTypes.LT, + TokenTypes.LE, + TokenTypes.GT, + TokenTypes.GE, }; } 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 30f7f89476..fc24702e5b 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 @@ -71,6 +71,10 @@ public void testAll() throws Exception { "119:15: " + getCheckMessage(MSG_KEY, "!="), "120:15: " + getCheckMessage(MSG_KEY, "!="), "121:18: " + getCheckMessage(MSG_KEY, "!="), + "129:15: " + getCheckMessage(MSG_KEY, "<"), + "130:15: " + getCheckMessage(MSG_KEY, "<="), + "131:15: " + getCheckMessage(MSG_KEY, ">"), + "132:15: " + getCheckMessage(MSG_KEY, ">="), }; verify(checkConfig, getPath("InputAvoidConstantAsFirstOperandInConditionCheck.java"), expected); @@ -88,6 +92,10 @@ public void testAttributes() throws Exception { "118:15: " + getCheckMessage(MSG_KEY, "=="), "119:15: " + getCheckMessage(MSG_KEY, "!="), "120:15: " + getCheckMessage(MSG_KEY, "!="), + "129:15: " + getCheckMessage(MSG_KEY, "<"), + "130:15: " + getCheckMessage(MSG_KEY, "<="), + "131:15: " + getCheckMessage(MSG_KEY, ">"), + "132:15: " + getCheckMessage(MSG_KEY, ">="), }; verify(checkConfig, getPath("InputAvoidConstantAsFirstOperandInConditionCheck.java"), expected); @@ -134,6 +142,10 @@ public void testNullProperties() throws Exception { "119:15: " + getCheckMessage(MSG_KEY, "!="), "120:15: " + getCheckMessage(MSG_KEY, "!="), "121:18: " + getCheckMessage(MSG_KEY, "!="), + "129:15: " + getCheckMessage(MSG_KEY, "<"), + "130:15: " + getCheckMessage(MSG_KEY, "<="), + "131:15: " + getCheckMessage(MSG_KEY, ">"), + "132:15: " + getCheckMessage(MSG_KEY, ">="), }; verify(checkConfig, getPath("InputAvoidConstantAsFirstOperandInConditionCheck.java"), diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputAvoidConstantAsFirstOperandInConditionCheck.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputAvoidConstantAsFirstOperandInConditionCheck.java index 7fc6518812..5b251f9491 100755 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputAvoidConstantAsFirstOperandInConditionCheck.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputAvoidConstantAsFirstOperandInConditionCheck.java @@ -122,4 +122,13 @@ public void expressionsWithInnerConstant() { } public int someMethod(int i) { return i; } + + public void otherConditions() { + int a = 0; + + if (1 < a) {} + if (1 <= a) {} + if (1 > a) {} + if (1 >= a) {} + } } From 3d89e7638051ce366616691064d05af4fb8f3ab0 Mon Sep 17 00:00:00 2001 From: rnveach Date: Thu, 7 Jun 2018 18:55:24 -0400 Subject: [PATCH 186/208] minor: removed excess suppressions --- sevntu-checks/suppressions.xml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/sevntu-checks/suppressions.xml b/sevntu-checks/suppressions.xml index cf329b31b1..ac0070eeba 100644 --- a/sevntu-checks/suppressions.xml +++ b/sevntu-checks/suppressions.xml @@ -7,8 +7,8 @@ - - + + @@ -25,9 +25,6 @@ - - - @@ -35,8 +32,4 @@ - - - From 8fc1705cd8b4015fdf066c45e5c2805f542da7af Mon Sep 17 00:00:00 2001 From: rnveach Date: Thu, 7 Jun 2018 15:38:18 -0400 Subject: [PATCH 187/208] Issue #662: moved ForbidCCommentsInMethodsCheck to log AST --- .../coding/ForbidCCommentsInMethodsCheck.java | 62 +++++++++++++------ .../ForbidCCommentsInMethodsCheckTest.java | 17 ++--- .../InputForbidCCommentsInMethodsCheck.java | 23 +++++++ 3 files changed, 74 insertions(+), 28 deletions(-) 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 5acabd16b5..1a99251dbb 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 @@ -19,7 +19,8 @@ package com.github.sevntu.checkstyle.checks.coding; -import java.util.Set; +import java.util.ArrayDeque; +import java.util.Deque; import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; @@ -39,15 +40,21 @@ public class ForbidCCommentsInMethodsCheck extends AbstractCheck { */ public static final String MSG_KEY = "forbid.c.comments.in.the.method.body"; - /** - * Set contains C style comments from current file. - */ - private Set clangComments; + /** AST to use for null checks because {@link Deque} doesn't allow null elements. */ + private static final DetailAST NULL_AST = new DetailAST(); + + /** Method stack. */ + private final Deque scopeStack = new ArrayDeque<>(); + + /** Reference to current method. */ + private DetailAST methodAst; @Override public int[] getDefaultTokens() { return new int[] { TokenTypes.METHOD_DEF, + TokenTypes.OBJBLOCK, + TokenTypes.BLOCK_COMMENT_BEGIN, }; } @@ -61,29 +68,44 @@ public int[] getRequiredTokens() { return getDefaultTokens(); } + @Override + public boolean isCommentNodesRequired() { + return true; + } + @Override public void beginTree(DetailAST rootAST) { - clangComments = getFileContents().getBlockComments().keySet(); + methodAst = NULL_AST; } @Override - public void visitToken(DetailAST methodNode) { - if (!clangComments.isEmpty()) { - final DetailAST borders = - methodNode.findFirstToken(TokenTypes.SLIST); - //Could be null when aMethodNode doesn't have body - //(into interface for example) - if (borders != null) { - final int methodBodyBegin = borders.getLineNo(); - final int methodBodyEnd = borders.getLastChild().getLineNo(); - for (final int commentLineNo : clangComments) { - if (commentLineNo > methodBodyBegin - && commentLineNo < methodBodyEnd) { - log(commentLineNo, MSG_KEY); + public void visitToken(DetailAST ast) { + scopeStack.push(methodAst); + + switch (ast.getType()) { + case TokenTypes.METHOD_DEF: + methodAst = ast; + break; + case TokenTypes.OBJBLOCK: + methodAst = NULL_AST; + break; + default: + if (methodAst != NULL_AST) { + final DetailAST lcurly = methodAst.findFirstToken(TokenTypes.SLIST); + if (lcurly != null + && (ast.getLineNo() > lcurly.getLineNo() + || ast.getLineNo() == lcurly.getLineNo() + && ast.getColumnNo() > lcurly.getColumnNo())) { + log(ast, MSG_KEY); } } - } + break; } } + @Override + public void leaveToken(DetailAST ast) { + methodAst = scopeStack.pop(); + } + } 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 ee6e7d5a47..174b60a09c 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 @@ -41,14 +41,15 @@ public void defaultTest() final DefaultConfiguration checkConfig = createModuleConfig(ForbidCCommentsInMethodsCheck.class); final String[] expected = { - "10: " + warningMessage, - "17: " + warningMessage, - "26: " + warningMessage, - "33: " + warningMessage, - "45: " + warningMessage, - "52: " + warningMessage, - "61: " + warningMessage, - "68: " + warningMessage, + "10:9: " + warningMessage, + "17:9: " + warningMessage, + "26:13: " + warningMessage, + "33:13: " + warningMessage, + "45:9: " + warningMessage, + "52:9: " + warningMessage, + "61:13: " + warningMessage, + "68:13: " + warningMessage, + "78:22: " + warningMessage, }; verify(checkConfig, getPath("InputForbidCCommentsInMethodsCheck.java"), expected); } diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputForbidCCommentsInMethodsCheck.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputForbidCCommentsInMethodsCheck.java index e20977ff7a..5fa5b65b69 100644 --- a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputForbidCCommentsInMethodsCheck.java +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputForbidCCommentsInMethodsCheck.java @@ -69,3 +69,26 @@ private void anyMethod() } } } +class InnerInputForbidCCommentsInMethods3 { + /* Comment before field. */ + private int field; + + /* Comment on same line as method. */ void method1() {} + void method2() {} /* Comment on same line as method. */ + void method3() { /* Comment on same line as method but inside. */ } + + void method4() { + new innerClass() { + /* Comment inside anonymous class. */ + public void innerMethod() {} + }; + } + + private static void /* Comment insside definition. */ method5() {} + /* Comment before native method. */ + public native void method6(); + + private abstract class innerClass { + public abstract void innerMethod(); + } +} From 8da62a6739d44e7090a5c4d5d5b7aa8cd01a270e Mon Sep 17 00:00:00 2001 From: rnveach Date: Wed, 6 Jun 2018 18:08:36 -0400 Subject: [PATCH 188/208] Issue #659: fixed AvoidNotShortCircuitOperatorsForBoolean multi-catch --- ...dNotShortCircuitOperatorsForBooleanCheck.java | 2 +- ...ShortCircuitOperatorsForBooleanCheckTest.java | 9 +++++++++ ...atorsForBooleanCheckLambdaWithMultiCatch.java | 16 ++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputAvoidNotShortCircuitOperatorsForBooleanCheckLambdaWithMultiCatch.java 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 c37286699b..ef0ec082ea 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 @@ -117,7 +117,7 @@ public final void visitToken(final DetailAST detailAST) { while (currentNode != null && currentNode.getType() != TokenTypes.EXPR) { currentNode = currentNode.getParent(); - if (currentNode.getType() == TokenTypes.OBJBLOCK) { + if (currentNode.getType() == TokenTypes.PARAMETER_DEF) { currentNode = null; } } 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 ccfa4464ac..23612c23b5 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 @@ -69,4 +69,13 @@ public final void testNonClasses() throws Exception { CommonUtils.EMPTY_STRING_ARRAY); } + @Test + public final void testExpressionBeforeTry() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(AvoidNotShortCircuitOperatorsForBooleanCheck.class); + verify(checkConfig, + getPath("InputAvoidNotShortCircuitOperatorsForBooleanCheckLambdaWithMultiCatch.java"), + CommonUtils.EMPTY_STRING_ARRAY); + } + } diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputAvoidNotShortCircuitOperatorsForBooleanCheckLambdaWithMultiCatch.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputAvoidNotShortCircuitOperatorsForBooleanCheckLambdaWithMultiCatch.java new file mode 100644 index 0000000000..56fd64e447 --- /dev/null +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputAvoidNotShortCircuitOperatorsForBooleanCheckLambdaWithMultiCatch.java @@ -0,0 +1,16 @@ +package com.github.sevntu.checkstyle.checks.coding; + +import java.awt.EventQueue; + +public class InputAvoidNotShortCircuitOperatorsForBooleanCheckLambdaWithMultiCatch { + public void method() { + EventQueue.invokeLater(() -> { + if (true) { + try { + } + catch (NullPointerException | IndexOutOfBoundsException ex) { + } + } + }); + } +} From 885a0c37f8c9c93b7c4af1e9e69884b693835a3c Mon Sep 17 00:00:00 2001 From: rnveach Date: Fri, 8 Jun 2018 09:26:47 -0400 Subject: [PATCH 189/208] Issue #572: fixed infinite loop in OverridableMethodInConstructorCheck --- sevntu-checks/pom.xml | 2 +- .../OverridableMethodInConstructorCheck.java | 10 +++++++++- ...erridableMethodInConstructorCheckTest.java | 13 +++++++++++++ ...OverridableMethodInConstructorCheck28.java | 19 +++++++++++++++++++ 4 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck28.java diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml index 5a871926d4..422b89c160 100644 --- a/sevntu-checks/pom.xml +++ b/sevntu-checks/pom.xml @@ -212,7 +212,7 @@ .*.checks.coding.ForbidThrowAnonymousExceptionsCheck8197 .*.checks.coding.MapIterationInForEachLoopCheck9098 .*.checks.coding.NoNullForCollectionReturnCheck8596 - .*.checks.coding.OverridableMethodInConstructorCheck8899 + .*.checks.coding.OverridableMethodInConstructorCheck9499 .*.checks.design.HideUtilityClassConstructorCheck94100 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 77f99607aa..89d6b74fb8 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 @@ -837,7 +837,15 @@ private List getBaseClasses(final DetailAST classDefNode) { result.add(curClass); baseClassName = getBaseClassName(curClass); if (baseClassName != null) { - curClass = getClassDef(treeRootAST, baseClassName); + final DetailAST nextClass = getClassDef(treeRootAST, baseClassName); + + // prevent infinite loop with similar named classes + if (nextClass == curClass) { + curClass = null; + } + else { + curClass = nextClass; + } } else { break; 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 98f97c6422..aa8e982c9c 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 @@ -453,4 +453,17 @@ public final void testFinalClass() throws Exception { verify(checkConfig, getPath("InputOverridableMethodInConstructorCheck25.java"), expected); } + @Test + public final void testExtendsSimilarNamedClass() throws Exception { + final DefaultConfiguration checkConfig = + createModuleConfig(OverridableMethodInConstructorCheck.class); + checkConfig.addAttribute("checkCloneMethod", "true"); + checkConfig.addAttribute("checkReadObjectMethod", "true"); + checkConfig.addAttribute("matchMethodsByArgCount", "true"); + + final String[] expected = {}; + + verify(checkConfig, getPath("InputOverridableMethodInConstructorCheck28.java"), expected); + } + } diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck28.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck28.java new file mode 100644 index 0000000000..2ff8af232c --- /dev/null +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputOverridableMethodInConstructorCheck28.java @@ -0,0 +1,19 @@ +package com.github.sevntu.checkstyle.checks.coding; + +import java.io.IOException; + +public class InputOverridableMethodInConstructorCheck28 { + class InputStream extends java.io.InputStream { + InputStream() { + method(); + } + + @Override + public int read() throws IOException { + return 0; + } + } + + public void method() { + }; +} From d95ea8899ff4f4710fd19f146873bf61e62aa75f Mon Sep 17 00:00:00 2001 From: rnveach Date: Thu, 7 Jun 2018 20:34:53 -0400 Subject: [PATCH 190/208] Issue #661: ignore instanceof in LogicConditionNeedOptimizationCheck --- .../LogicConditionNeedOptimizationCheck.java | 19 ++++++++++++++++--- ...gicConditionNeedOptimizationCheckTest.java | 5 +++++ ...utLogicConditionNeedOptimizationCheck.java | 17 +++++++++++++++++ 3 files changed, 38 insertions(+), 3 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 8864fb7949..c0709599f9 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 @@ -26,7 +26,7 @@ /** *

          * 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 5fd85db4c248b6c06a8148964b7792daf1330cde 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 dcd5c8ab64e78721b4513fa3108a14b73cdbe507 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 8aa7b0e06b5bb84acdf1e6e3f573e250bd450720 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 29b793f716115f7b3d18fde901ced61aeff02452 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 d98ec496f017efbbd3e233a3cc281aae590619f6 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 b25e370d5162471957b04aa0462c6e16a1efa3a0 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 87fc4c3ca0c3f1cdd0c5192537c58d88d675f31e 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 f583a8a4083d627128ffdb0f3b012b0e364d5adf 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. + *

            * *

            * Configuration: + *

            *
              * <module name="TreeWalker">
              *      <module name="AvoidModifiersForTypesCheck">
            @@ -132,7 +143,7 @@
              *
              * }
              * 
            - *

            + * * @author Daniil Yaroslavtsev * @author Yasser Aziza */ 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 badb7bc553..1fb2c91e72 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 @@ -40,6 +40,7 @@ *

            * 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 @@
              * 

            *

            * Examples: + *

            * *
              * catch (NoSuchMethodException e) {
            @@ -70,6 +71,7 @@
              * 

            * What check can detect:
            * Loggers + *

            *
              *
            • logger is declared as class field
            • *
            • logger is declared as method's local variable
            • @@ -86,6 +88,7 @@ *
            *

            * What check can not detect:
            + *

            *
              *
            • loggers that is used like method's return value. Example: * @@ -103,6 +106,7 @@ *
            *

            * Default parameters are: + *

            *
              *
            • loggerFullyQualifiedClassName - fully qualified class name of * logger type. Default value is "org.slf4j.Logger".
            • 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 44b4541128..19086c4d41 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 @@ -37,6 +37,7 @@ *

              *

              * Example 1. Check will generate violation for this code: + *

              * *
                * class Dummy {
              @@ -47,6 +48,7 @@
                *
                * 

              * Example 2. Check will not generate violation for this code: + *

              * *
                * class Dummy {
              @@ -55,9 +57,12 @@
                * }
                * 
              * + *

              * class Dummy has only one ctor, which is not public. + *

              *

              * Example 3. Check will not generate violation for this code: + *

              * *
                * class Dummy {
              @@ -68,7 +73,9 @@
                * }
                * 
              * + *

              * class Dummy has multiple ctors. + *

              *

              * Check has two properties: *

              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 320031a827..db2ab9a941 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 @@ -30,7 +30,8 @@ /** *

              - * This Check warns on throwing anonymous exception.
              + * This Check warns on throwing anonymous exception. + *

              * Examples: *
                * catch (Exception e) {
              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 e623ffd84d..16323a5ffe 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
              @@ -36,13 +36,14 @@
               /**
                * 

              * 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 static final String DEFAULT_COLLECTIONS = "AbstractCollection AbstractList " + "AbstractQueue AbstractSequentialList AbstractSet ArrayBlockingQueue ArrayDeque " @@ -71,9 +69,7 @@ public class NoNullForCollectionReturnCheck extends AbstractCheck { + "LinkedList LinkedTransferQueue PriorityBlockingQueue PriorityQueue RoleList " + "RoleUnresolvedList Stack SynchronousQueue TreeSet Vector Collection List Map Set"; /** - *

            * List of collection, that will be check. - *

            */ 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: + *

            *
            1. * 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. + *

            *
              *   <module name="UselessSuperCtorCallCheck">
              *     <property name="allowCallToNoArgsSuperCtor" value="true"/>
            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 0901a66228..9aefa53247 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
            @@ -36,14 +36,18 @@
              * };
              * 
            * + *

            * This example is valid too: + *

            * *
              * int[] tab = new int[]
              *                 {0, 1, 2, 3}
              * 
            * + *

            * But this violates check: + *

            * *
              * int[] ints = new int[]{0, 1, 2, 3};
            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 ae79ff00d2..4a691f4c6f 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
            @@ -40,12 +40,15 @@
              *      }
              * 
            * + *

            * 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: + *

            + * + *
            + * <module name="NestedSwitchCheck"/>
            + * 
            * @author Damian Szczepanik (damianszczepanik@github) */ public class NestedSwitchCheck extends AbstractCheck { 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 7e29e6323b..180433cad5 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 @@ -30,7 +30,6 @@ import com.puppycrawl.tools.checkstyle.api.TokenTypes; /** - *

            * 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.
            diff --git a/sevntu-checks/suppressions.xml b/sevntu-checks/suppressions.xml index 658d3cb89d..2fe13b6d35 100644 --- a/sevntu-checks/suppressions.xml +++ b/sevntu-checks/suppressions.xml @@ -7,7 +7,6 @@ - From 8d130b8b8a5db1b419cc4be3b70f836cc0fa1808 Mon Sep 17 00:00:00 2001 From: rnveach Date: Fri, 8 Jun 2018 21:21:20 -0400 Subject: [PATCH 199/208] Issue #658: upgrade to eclipse-cs 8.10 --- .ci/travis.sh | 4 ++-- eclipsecs-sevntu-plugin/pom.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.ci/travis.sh b/.ci/travis.sh index fa5abbf353..7d18820998 100755 --- a/.ci/travis.sh +++ b/.ci/travis.sh @@ -14,7 +14,7 @@ eclipse-cs) cd .. git clone https://github.com/checkstyle/eclipse-cs.git cd eclipse-cs/ - git checkout 8.7.0 + git checkout 8.10.0 mvn -e install cd ../ cd eclipsecs-sevntu-plugin @@ -25,7 +25,7 @@ eclipse-cs) maven-plugin) cd sevntu-checks mvn -e clean install -Dmaven.test.skip=true -Dcheckstyle.skip=true -Dcobertura.skip=true - cd .. + cd .. cd sevntu-checkstyle-maven-plugin mvn -e verify mvn -e javadoc:javadoc diff --git a/eclipsecs-sevntu-plugin/pom.xml b/eclipsecs-sevntu-plugin/pom.xml index dd3f92bd69..0859175af7 100644 --- a/eclipsecs-sevntu-plugin/pom.xml +++ b/eclipsecs-sevntu-plugin/pom.xml @@ -26,7 +26,7 @@ - 8.7.0-SNAPSHOT + 8.10.0-SNAPSHOT From 215a869b6902a6b11427eb5abb2ae91fc9f039ea Mon Sep 17 00:00:00 2001 From: rnveach Date: Sat, 9 Jun 2018 21:04:22 -0400 Subject: [PATCH 200/208] Issue #525: removed npath complexity suppression and fixed violations --- .../MapIterationInForEachLoopCheck.java | 38 ++++++++++++------- sevntu-checks/suppressions.xml | 1 - 2 files changed, 25 insertions(+), 14 deletions(-) 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 16323a5ffe..b363679a1c 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 @@ -514,10 +514,33 @@ private String checkForWrongKeySetUsage(DetailAST forEachOpeningBraceNode, Strin } } + if (methodGetCallCount != 0 && keyIdentCount != 0) { + if (proposeValuesUsage && methodGetCallCount == keyIdentCount) { + result = MSG_KEY_VALUES; + } + else if (methodGetCallCount < keyIdentCount + && methodGetCallCount > 0 + && getMethodGetCallInsideIfCount(identAndLiteralIfNodesList, mapName, + isMapClassField) != methodGetCallCount) { + result = MSG_KEY_ENTRYSET; + } + } + return result; + } + + /** + * Counts the getter methods called inside the if statement. + * @param identAndLiteralIfNodesList the nodes to examine. + * @param mapName Current map name. + * @param isMapClassField if the map is a class field. + * @return The number of methods. + */ + private static int getMethodGetCallInsideIfCount(List identAndLiteralIfNodesList, + String mapName, boolean isMapClassField) { final DetailAST literalIfNode = getFirstNodeOfType(identAndLiteralIfNodesList, TokenTypes.LITERAL_IF); - int methodGetCallInsideIfCount = 0; + int result = 0; if (literalIfNode != null) { for (DetailAST node : getSubTreeNodesOfType(literalIfNode, TokenTypes.IDENT)) { DetailAST mapIdentNode = node.getPreviousSibling(); @@ -527,21 +550,10 @@ private String checkForWrongKeySetUsage(DetailAST forEachOpeningBraceNode, Strin if (mapIdentNode != null && GET_NODE_NAME.equals(node.getText()) && mapName.equals(mapIdentNode.getText())) { - methodGetCallInsideIfCount++; + result++; } } } - - if (methodGetCallCount != 0 && keyIdentCount != 0) { - if (proposeValuesUsage && methodGetCallCount == keyIdentCount) { - result = MSG_KEY_VALUES; - } - - else if (methodGetCallCount < keyIdentCount && methodGetCallCount > 0 - && methodGetCallInsideIfCount != methodGetCallCount) { - result = MSG_KEY_ENTRYSET; - } - } return result; } diff --git a/sevntu-checks/suppressions.xml b/sevntu-checks/suppressions.xml index 2fe13b6d35..b81103f6a9 100644 --- a/sevntu-checks/suppressions.xml +++ b/sevntu-checks/suppressions.xml @@ -11,7 +11,6 @@ - From 9271c2372f7862d3af78f12da33be82467910ec5 Mon Sep 17 00:00:00 2001 From: rnveach Date: Sat, 9 Jun 2018 19:38:43 -0400 Subject: [PATCH 201/208] Issue #525: removed inner assignment suppression and fixed violations --- .../checks/coding/OverridableMethodInConstructorCheck.java | 6 +++--- sevntu-checks/suppressions.xml | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) 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 b0853a779b..e5ce65e2b2 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 @@ -491,10 +491,10 @@ private DetailAST getMethodDef(final DetailAST methodCallAST) { if (methodName != null) { final DetailAST curClassAST = getClassDef(methodCallAST); final DetailAST callsChild = methodCallAST.getFirstChild(); - final String variableTypeName; + final String variableTypeName = getVariableType(methodCallAST); - if (callsChild.getType() != TokenTypes.DOT - || (variableTypeName = getVariableType(methodCallAST)) == null + if (variableTypeName == null + || callsChild.getType() != TokenTypes.DOT || isItTypeOfCurrentClass(variableTypeName, curClassAST) || isItCallMethodViaKeywordThis(variableTypeName, curClassAST)) { getMethodDef(curClassAST, methodName); diff --git a/sevntu-checks/suppressions.xml b/sevntu-checks/suppressions.xml index b81103f6a9..0a5ab5fe3e 100644 --- a/sevntu-checks/suppressions.xml +++ b/sevntu-checks/suppressions.xml @@ -12,7 +12,6 @@ - From 33e3439b2e7ca996664c51fcfb933fbb35e66226 Mon Sep 17 00:00:00 2001 From: rnveach Date: Sat, 9 Jun 2018 22:01:02 -0400 Subject: [PATCH 202/208] Issue #525: removed some UnnecessaryParenthesesExtendedCheck violations --- .../UnnecessaryParenthesesExtendedCheck.java | 137 +++++++++--------- sevntu-checks/suppressions.xml | 1 - 2 files changed, 70 insertions(+), 68 deletions(-) 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 4598c02e59..fa1c91c252 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 @@ -166,46 +166,41 @@ public int[] getRequiredTokens() { @Override public void visitToken(DetailAST ast) { final int type = ast.getType(); - final boolean surrounded = isSurrounded(ast); final DetailAST parent = ast.getParent(); - if ((type == TokenTypes.ASSIGN) - && (parent.getType() == TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR)) { - // shouldn't process assign in annotation pairs - return; - } - - // An identifier surrounded by parentheses. - if (surrounded && (type == TokenTypes.IDENT)) { - parentToSkip = ast.getParent(); - log(ast, MSG_KEY_IDENT, ast.getText()); - return; - } + // shouldn't process assign in annotation pairs + if ((type != TokenTypes.ASSIGN) + || (parent.getType() != TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR)) { + final boolean surrounded = isSurrounded(ast); - // A literal (numeric or string) surrounded by parentheses. - if (surrounded && inTokenList(type, LITERALS)) { - parentToSkip = ast.getParent(); - if (type == TokenTypes.STRING_LITERAL) { - log(ast, MSG_KEY_STRING, - chopString(ast.getText())); + // An identifier surrounded by parentheses. + if (surrounded && (type == TokenTypes.IDENT)) { + parentToSkip = ast.getParent(); + log(ast, MSG_KEY_IDENT, ast.getText()); } - else { - log(ast, MSG_KEY_LITERAL, ast.getText()); + // A literal (numeric or string) surrounded by parentheses. + else if (surrounded && inTokenList(type, LITERALS)) { + parentToSkip = ast.getParent(); + if (type == TokenTypes.STRING_LITERAL) { + log(ast, MSG_KEY_STRING, + chopString(ast.getText())); + } + else { + log(ast, MSG_KEY_LITERAL, ast.getText()); + } } - return; - } - - // The rhs of an assignment surrounded by parentheses. - if (inTokenList(type, ASSIGNMENTS)) { - assignDepth++; - final DetailAST last = ast.getLastChild(); - if (last.getType() == TokenTypes.RPAREN) { - final DetailAST subtree = ast.getFirstChild().getNextSibling() - .getNextSibling(); - final int subtreeType = subtree.getType(); - if (!ignoreCalculationOfBooleanVariables || !inTokenList( - subtreeType, EQUALS)) { - log(ast, MSG_KEY_ASSIGN); + // The rhs of an assignment surrounded by parentheses. + else if (inTokenList(type, ASSIGNMENTS)) { + assignDepth++; + final DetailAST last = ast.getLastChild(); + if (last.getType() == TokenTypes.RPAREN) { + final DetailAST subtree = ast.getFirstChild().getNextSibling() + .getNextSibling(); + final int subtreeType = subtree.getType(); + if (!ignoreCalculationOfBooleanVariables || !inTokenList( + subtreeType, EQUALS)) { + log(ast, MSG_KEY_ASSIGN); + } } } } @@ -221,38 +216,7 @@ 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. - - if ((parentToSkip != ast) && exprSurrounded(ast)) { - if (assignDepth >= 1) { - if (!ignoreCalculationOfBooleanVariables || !inTokenList( - subtreeType(ast), EQUALS)) { - log(ast, MSG_KEY_ASSIGN); - } - } - else if (ast.getParent().getType() - == TokenTypes.LITERAL_RETURN) { - if (!ignoreCalculationOfBooleanVariablesWithReturn - || !inTokenList(subtreeType(ast), EQUALS)) { - log(ast, MSG_KEY_RETURN); - } - } - else if (ast.getParent().getType() - == TokenTypes.LITERAL_ASSERT) { - if (!ignoreCalculationOfBooleanVariablesWithAssert - || !inTokenList(subtreeType(ast), EQUALS)) { - log(ast, MSG_KEY_EXPR); - } - } - else { - if (!ignoreCalculationOfBooleanVariables || !inTokenList( - subtreeType(ast), EQUALS)) { - log(ast, MSG_KEY_EXPR); - } - } - } + leaveTokenExpression(ast); parentToSkip = null; } @@ -264,6 +228,45 @@ else if (inTokenList(type, ASSIGNMENTS)) { } } + /** + * Examines the expression AST for violations. + * @param ast The AST to examine. + */ + private void leaveTokenExpression(DetailAST ast) { + // 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. + + if ((parentToSkip != ast) && exprSurrounded(ast)) { + if (assignDepth >= 1) { + if (!ignoreCalculationOfBooleanVariables || !inTokenList( + subtreeType(ast), EQUALS)) { + log(ast, MSG_KEY_ASSIGN); + } + } + else if (ast.getParent().getType() + == TokenTypes.LITERAL_RETURN) { + if (!ignoreCalculationOfBooleanVariablesWithReturn + || !inTokenList(subtreeType(ast), EQUALS)) { + log(ast, MSG_KEY_RETURN); + } + } + else if (ast.getParent().getType() + == TokenTypes.LITERAL_ASSERT) { + if (!ignoreCalculationOfBooleanVariablesWithAssert + || !inTokenList(subtreeType(ast), EQUALS)) { + log(ast, MSG_KEY_EXPR); + } + } + else { + if (!ignoreCalculationOfBooleanVariables || !inTokenList( + subtreeType(ast), EQUALS)) { + log(ast, MSG_KEY_EXPR); + } + } + } + } + /** * Tests if the given DetailAST is surrounded by parentheses. * In short, does aAST have a previous sibling whose type is diff --git a/sevntu-checks/suppressions.xml b/sevntu-checks/suppressions.xml index 0a5ab5fe3e..e0d38689c5 100644 --- a/sevntu-checks/suppressions.xml +++ b/sevntu-checks/suppressions.xml @@ -11,7 +11,6 @@ - From 0f48c4bd93d8423112b761493440b74a67229db0 Mon Sep 17 00:00:00 2001 From: rnveach Date: Wed, 6 Jun 2018 18:27:01 -0400 Subject: [PATCH 203/208] Issue #650: skip over object blocks in RedundantReturnCheck --- .../checks/coding/RedundantReturnCheck.java | 33 +++++++++++---- .../coding/RedundantReturnCheckTest.java | 12 ++++++ ...nputRedundantReturnCheckNestedMethods.java | 41 +++++++++++++++++++ 3 files changed, 77 insertions(+), 9 deletions(-) create mode 100644 sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRedundantReturnCheckNestedMethods.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 43aeddbabf..50a3dacb9a 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 @@ -327,17 +327,17 @@ private static DetailAST getRedundantReturnInBlock(DetailAST statementAst) { private static DetailAST findRedundantReturnInCatch(DetailAST lastStatementInCatchBlockAst) { DetailAST redundantReturnAst = null; DetailAST currentNodeAst = lastStatementInCatchBlockAst; - DetailAST toVisitAst = currentNodeAst; DetailAST returnAst = null; - while (toVisitAst != null) { - toVisitAst = Utils.getNextSubTreeNode(toVisitAst, currentNodeAst); + DetailAST toVisitAst = Utils.getNextSubTreeNode(currentNodeAst, currentNodeAst); - if (toVisitAst != null - && (toVisitAst.getParent().getParent().getNextSibling() == null - || toVisitAst.getParent().getParent().getNextSibling().getType() - == TokenTypes.RCURLY) - && toVisitAst.getType() == TokenTypes.LITERAL_RETURN - && toVisitAst.getParent().getNextSibling() == null) { + while (toVisitAst != null) { + if (toVisitAst.getType() == TokenTypes.OBJBLOCK) { + while (toVisitAst.getNextSibling() == null) { + toVisitAst = toVisitAst.getParent(); + } + toVisitAst = toVisitAst.getNextSibling(); + } + else if (isFinalReturn(toVisitAst)) { returnAst = toVisitAst; while (toVisitAst != null @@ -351,10 +351,25 @@ private static DetailAST findRedundantReturnInCatch(DetailAST lastStatementInCat toVisitAst = returnAst; } + + toVisitAst = Utils.getNextSubTreeNode(toVisitAst, currentNodeAst); } currentNodeAst = Utils.getNextSubTreeNode(currentNodeAst, lastStatementInCatchBlockAst); return redundantReturnAst; } + /** + * Checks if the {@code ast} is the final return statement. + * @param ast the AST to examine. + * @return {@code true} if the {@code ast} is the final return statement. + */ + private static boolean isFinalReturn(DetailAST ast) { + return (ast.getParent().getParent().getNextSibling() == null + || ast.getParent().getParent().getNextSibling().getType() + == TokenTypes.RCURLY) + && ast.getType() == TokenTypes.LITERAL_RETURN + && ast.getParent().getNextSibling() == null; + } + } 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 012a8549a7..ff95a8aa76 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 @@ -92,6 +92,18 @@ public void testInputWithIgnoreEmptyConstructorsFalse() verify(checkConfig, getPath("InputRedundantReturnCheck.java"), expected); } + @Test + public void testInputNestedMethods() + throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(RedundantReturnCheck.class); + + final String[] expected = { + "29:17: " + getCheckMessage(MSG_KEY), + }; + + verify(checkConfig, getPath("InputRedundantReturnCheckNestedMethods.java"), expected); + } + @Test public void testForNullPointerExceptionsPresence() throws Exception { diff --git a/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRedundantReturnCheckNestedMethods.java b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRedundantReturnCheckNestedMethods.java new file mode 100644 index 0000000000..1913d61281 --- /dev/null +++ b/sevntu-checks/src/test/resources/com/github/sevntu/checkstyle/checks/coding/InputRedundantReturnCheckNestedMethods.java @@ -0,0 +1,41 @@ +package com.github.sevntu.checkstyle.checks.coding; + +public class InputRedundantReturnCheckNestedMethods { + public void method() { + try { + if (true) { + new Nested() { + @Override + public boolean accept(String s) { + return true; + } + }; + } + } + catch (Exception ex) { + } + finally { + } + } + + public void method2() { + try { + if (new Nested() { + @Override + public boolean accept(String s) { + return true; + } + }.accept(null)) { + return; // violation + } + } + catch (Exception ex) { + } + finally { + } + } + + public abstract class Nested { + public abstract boolean accept(String s); + } +} From e9ed1c858833d47165ddc45edb18e09331c743ed Mon Sep 17 00:00:00 2001 From: rnveach Date: Sun, 24 Jun 2018 21:32:12 -0400 Subject: [PATCH 204/208] Issue #701: add since tag to all module javadocs --- .../checkstyle/checks/annotation/ForbidAnnotationCheck.java | 1 + .../checks/annotation/ForbidAnnotationElementValueCheck.java | 1 + .../checks/annotation/RequiredParameterForAnnotationCheck.java | 1 + .../coding/AvoidConstantAsFirstOperandInConditionCheck.java | 1 + .../coding/AvoidDefaultSerializableInInnerClassesCheck.java | 1 + .../checks/coding/AvoidHidingCauseExceptionCheck.java | 1 + .../checkstyle/checks/coding/AvoidModifiersForTypesCheck.java | 1 + .../coding/AvoidNotShortCircuitOperatorsForBooleanCheck.java | 1 + .../checkstyle/checks/coding/ConfusingConditionCheck.java | 1 + .../checkstyle/checks/coding/CustomDeclarationOrderCheck.java | 1 + .../coding/DiamondOperatorForVariableDefinitionCheck.java | 1 + .../sevntu/checkstyle/checks/coding/EitherLogOrThrowCheck.java | 1 + .../checkstyle/checks/coding/EmptyPublicCtorInClassCheck.java | 1 + .../checkstyle/checks/coding/FinalizeImplementationCheck.java | 2 +- .../checkstyle/checks/coding/ForbidCCommentsInMethodsCheck.java | 1 + .../checkstyle/checks/coding/ForbidCertainImportsCheck.java | 1 + .../checkstyle/checks/coding/ForbidCertainMethodCheck.java | 1 + .../checkstyle/checks/coding/ForbidInstantiationCheck.java | 1 + .../checks/coding/ForbidReturnInFinallyBlockCheck.java | 1 + .../checks/coding/ForbidThrowAnonymousExceptionsCheck.java | 1 + .../checkstyle/checks/coding/IllegalCatchExtendedCheck.java | 1 + .../checks/coding/LogicConditionNeedOptimizationCheck.java | 1 + .../checks/coding/MapIterationInForEachLoopCheck.java | 1 + .../checkstyle/checks/coding/MoveVariableInsideIfCheck.java | 1 + .../checks/coding/MultipleStringLiteralsExtendedCheck.java | 1 + .../coding/MultipleVariableDeclarationsExtendedCheck.java | 1 + .../checks/coding/NameConventionForJunit4TestClassesCheck.java | 1 + .../checks/coding/NoNullForCollectionReturnCheck.java | 1 + .../checks/coding/NumericLiteralNeedsUnderscoreCheck.java | 1 + .../checks/coding/OverridableMethodInConstructorCheck.java | 1 + .../sevntu/checkstyle/checks/coding/RedundantReturnCheck.java | 1 + .../checks/coding/RequireFailForTryCatchInJunitCheck.java | 1 + .../checkstyle/checks/coding/ReturnBooleanFromTernaryCheck.java | 1 + .../checkstyle/checks/coding/ReturnCountExtendedCheck.java | 1 + .../checks/coding/ReturnNullInsteadOfBooleanCheck.java | 1 + .../checks/coding/SimpleAccessorNameNotationCheck.java | 1 + .../checkstyle/checks/coding/SingleBreakOrContinueCheck.java | 1 + .../checks/coding/TernaryPerExpressionCountCheck.java | 1 + .../checks/coding/UnnecessaryParenthesesExtendedCheck.java | 1 + .../checkstyle/checks/coding/UselessSingleCatchCheck.java | 1 + .../checkstyle/checks/coding/UselessSuperCtorCallCheck.java | 1 + .../checks/coding/WhitespaceBeforeArrayInitializerCheck.java | 1 + .../checkstyle/checks/design/AvoidConditionInversionCheck.java | 1 + .../checks/design/CauseParameterInExceptionCheck.java | 1 + .../checkstyle/checks/design/CheckstyleTestMakeupCheck.java | 1 + .../sevntu/checkstyle/checks/design/ChildBlockLengthCheck.java | 1 + .../checkstyle/checks/design/ConstructorWithoutParamsCheck.java | 1 + .../checks/design/ForbidWildcardAsReturnTypeCheck.java | 1 + .../checks/design/HideUtilityClassConstructorCheck.java | 1 + .../github/sevntu/checkstyle/checks/design/InnerClassCheck.java | 1 + .../sevntu/checkstyle/checks/design/NestedSwitchCheck.java | 1 + .../checks/design/NoMainMethodInAbstractClassCheck.java | 1 + .../checks/design/PublicReferenceToPrivateTypeCheck.java | 1 + .../checkstyle/checks/design/StaticMethodCandidateCheck.java | 1 + .../sevntu/checkstyle/checks/naming/EnumValueNameCheck.java | 1 + .../checks/naming/InterfaceTypeParameterNameCheck.java | 1 + .../checkstyle/checks/naming/UniformEnumConstantNameCheck.java | 1 + .../sevntu/checkstyle/checks/sizes/LineLengthExtendedCheck.java | 1 + 58 files changed, 58 insertions(+), 1 deletion(-) 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 d8db5db57b..e98d0bc71a 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 @@ -38,6 +38,7 @@ * value="METHOD_DEF,CLASS_DEF"/> </module> *

            * @author Hidoyatov Victor + * @since 1.12.0 */ public class ForbidAnnotationCheck extends AbstractCheck { 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 c9fb3b8609..09112c5c4a 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 @@ -110,6 +110,7 @@ * * @author Sergey Drozd * @author Richard Veach + * @since 1.22.0 */ public class ForbidAnnotationElementValueCheck extends AbstractCheck { 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 622038ff5f..219f9adfbc 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 @@ -95,6 +95,7 @@ *
            * * @author Andrew Uljanenko + * @since 1.13.0 */ public class RequiredParameterForAnnotationCheck extends AbstractCheck { 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 0539ef8ba7..b1fd0ac57d 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 @@ -54,6 +54,7 @@ *

            * * @author Sergey Burtsev + * @since 1.9.0 */ public class AvoidConstantAsFirstOperandInConditionCheck extends AbstractCheck { 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 bd60b0075f..058572ffa2 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 @@ -33,6 +33,7 @@ * "Effective Java (2nd edition)" chapter 11, item 74, page 294. *

            * @author Ilia Dubinin + * @since 1.8.0 */ public class AvoidDefaultSerializableInInnerClassesCheck extends AbstractCheck { 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 5e7b526996..2b9d316891 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 @@ -63,6 +63,7 @@ * @author Daniil * Yaroslavtsev * @author Ilja Dubinin + * @since 1.8.0 */ public class AvoidHidingCauseExceptionCheck extends AbstractCheck { 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 867024edc0..9d19e18dd9 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 @@ -146,6 +146,7 @@ * * @author Daniil Yaroslavtsev * @author Yasser Aziza + * @since 1.8.0 */ public class AvoidModifiersForTypesCheck extends AbstractCheck { 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 ef0ec082ea..87df5a07e9 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 @@ -69,6 +69,7 @@ *
            * @author Daniil * Yaroslavtsev + * @since 1.8.0 */ public class AvoidNotShortCircuitOperatorsForBooleanCheck extends AbstractCheck { 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 808bbad9e6..c1dea6c8ba 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 @@ -59,6 +59,7 @@ *
            * * @author Vadim Panasiuk + * @since 1.9.0 */ public class ConfusingConditionCheck extends AbstractCheck { 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 1fb2c91e72..63ef20bd58 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 @@ -152,6 +152,7 @@ * * @author Danil Lopatin * @author Baratali Izmailov + * @since 1.8.0 */ public class CustomDeclarationOrderCheck extends AbstractCheck { 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 b9c2adfb84..c92a6906dc 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 @@ -41,6 +41,7 @@ * *

            * @author Aleksey Nesterenko + * @since 1.12.0 */ public class DiamondOperatorForVariableDefinitionCheck extends AbstractCheck { 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 7c6ac3c9a5..f44c4c50c9 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 @@ -118,6 +118,7 @@ * different loggers, then create another instance of this check. *

            * @author Baratali Izmailov + * @since 1.9.0 */ public class EitherLogOrThrowCheck extends AbstractCheck { 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 19086c4d41..4e7c0ce04c 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 @@ -101,6 +101,7 @@ *
            * * @author Zuy Alexey + * @since 1.13.0 */ public class EmptyPublicCtorInClassCheck extends AbstractCheck { 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 25e5f7f6a2..9b48a037a3 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 @@ -51,7 +51,7 @@ * }
            * * @author Max Vetrenko - * + * @since 1.11.0 */ public class FinalizeImplementationCheck extends AbstractCheck { 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 1a99251dbb..6a9b1b8c05 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 @@ -32,6 +32,7 @@ * class declaration into the method body you will get an error. *

            * @author Ilia Dubinin + * @since 1.6.0 */ public class ForbidCCommentsInMethodsCheck extends AbstractCheck { 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 22449a9d9f..97a64abb47 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 @@ -56,6 +56,7 @@ *

            * @author Daniil * Yaroslavtsev + * @since 1.8.0 */ public class ForbidCertainImportsCheck extends AbstractCheck { 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 e15ae5b2f5..b45e81586d 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 @@ -83,6 +83,7 @@ *

            * * @author Raghav Kumar Gautam + * @since 1.28.0 */ public class ForbidCertainMethodCheck extends AbstractCheck { 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 e70bd6215d..82eb3766e6 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 @@ -42,6 +42,7 @@ *

            * @author Daniil * Yaroslavtsev + * @since 1.8.0 */ public class ForbidInstantiationCheck extends AbstractCheck { 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 36f891f082..3d3fcdfede 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 @@ -35,6 +35,7 @@ *

            * * @author Andrew Uljanenko + * @since 1.13.0 */ public class ForbidReturnInFinallyBlockCheck extends AbstractCheck { 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 db2ab9a941..fba33e11d0 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 @@ -58,6 +58,7 @@ *
            * @author Aleksey Nesterenko * @author Max Vetrenko + * @since 1.11.0 */ public class ForbidThrowAnonymousExceptionsCheck extends AbstractCheck { 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 0a66a1efa6..73642e3c4a 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 @@ -33,6 +33,7 @@ * Catching java.lang.Exception, java.lang.Error or java.lang.RuntimeException * is almost never acceptable. * @author Simon Harris + * @since 1.8.0 */ public final class IllegalCatchExtendedCheck extends AbstractCheck { 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 96839aae1e..d28acecdc3 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 @@ -33,6 +33,7 @@ * and similarly for any expression. *

            * @author Ilia Dubinin + * @since 1.8.0 */ public class LogicConditionNeedOptimizationCheck extends AbstractCheck { 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 b363679a1c..6540a6a48d 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 @@ -125,6 +125,7 @@ * } *
            * @author Max Vetrenko + * @since 1.11.0 */ public class MapIterationInForEachLoopCheck extends AbstractCheck { 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 11c07e1541..39672c8b1c 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 @@ -112,6 +112,7 @@ *
            * * @author Richard Veach + * @since 1.24.0 */ public class MoveVariableInsideIfCheck extends AbstractCheck { 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 4b801678b9..fee8a6cf3a 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 @@ -36,6 +36,7 @@ * Checks for multiple occurrences of the same string literal within a single file. * * @author Daniel Grenner + * @since 1.5.3 */ public class MultipleStringLiteralsExtendedCheck extends AbstractCheck { 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 b26f7f13ec..2c5b2edf55 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 @@ -41,6 +41,7 @@ *
            * * @author o_sukhodolsky + * @since 1.5.3 */ public class MultipleVariableDeclarationsExtendedCheck extends AbstractCheck { 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 c5c13ded1e..8a4e525935 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 @@ -108,6 +108,7 @@ *
            * * @author Zuy Alexey + * @since 1.13.0 */ public class NameConventionForJunit4TestClassesCheck extends AbstractCheck { 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 23d8842689..3c21887950 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 @@ -49,6 +49,7 @@ * TreeSet, Vector, Collection, List, Map, Set. *

            * @author Ilja Dubinin + * @since 1.9.0 */ public class NoNullForCollectionReturnCheck extends AbstractCheck { 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 355828b1d5..be23a6fdf3 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 @@ -138,6 +138,7 @@ * int passingBinary = 0b0000_1111; * * @author Cheng-Yu Pai + * @since 1.18.0 */ public class NumericLiteralNeedsUnderscoreCheck extends AbstractCheck { 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 e5ce65e2b2..426f3b1b52 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 @@ -127,6 +127,7 @@ * @author Daniil * Yaroslavtsev * @author Ilja Dubinin + * @since 1.8.0 */ public class OverridableMethodInConstructorCheck extends AbstractCheck { 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 50a3dacb9a..70ed96d9d4 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 @@ -76,6 +76,7 @@ * @author Troshin Sergey * @author Max Vetrenko * @author Alexey Nesterenko + * @since 1.8.0 */ public class RedundantReturnCheck extends AbstractCheck { 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 817330ae07..374fb60b9e 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 @@ -65,6 +65,7 @@ * } * * @author Richard Veach + * @since 1.25.0 */ public class RequireFailForTryCatchInJunitCheck extends AbstractCheck { 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 a6de1e86e0..cebaaf547d 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 @@ -30,6 +30,7 @@ *

            * * @author Ivan Sopov + * @since 1.8.0 */ public class ReturnBooleanFromTernaryCheck extends AbstractCheck { 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 f8ed75d1c3..6b9e0fc8b2 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 @@ -66,6 +66,7 @@ *
            * * @author Daniil Yaroslavtsev + * @since 1.8.0 */ public class ReturnCountExtendedCheck extends AbstractCheck { 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 0fc2707897..4da752a14d 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 @@ -34,6 +34,7 @@ *

            * * @author Ivan Sopov + * @since 1.8.0 */ public class ReturnNullInsteadOfBooleanCheck extends AbstractCheck { 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 d0837a39ee..8320124928 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 @@ -47,6 +47,7 @@ * * @author Hidoyatov Victor * @author Ilja Dubinin + * @since 1.9.0 */ public class SimpleAccessorNameNotationCheck extends AbstractCheck { 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 898d41640c..75946dffc9 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 @@ -109,6 +109,7 @@ * * * @author Yasser Aziza + * @since 1.18.0 */ public class SingleBreakOrContinueCheck extends AbstractCheck { 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 faafe7b6f4..be2484b771 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 @@ -88,6 +88,7 @@ * * * @author Aleksey Nesterenko + * @since 1.12.0 */ public class TernaryPerExpressionCountCheck extends AbstractCheck { 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 fa1c91c252..ac156c56df 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 @@ -50,6 +50,7 @@ * * @author Eric Roe * @author Antonenko Dmitriy + * @since 1.8.0 */ public class UnnecessaryParenthesesExtendedCheck extends AbstractCheck { 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 e09a472308..322f609a56 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 @@ -37,6 +37,7 @@ * * * @author Zuy Alexey + * @since 1.13.0 */ public class UselessSingleCatchCheck extends AbstractCheck { 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 4bb0e9f8ec..ba154c052a 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 @@ -141,6 +141,7 @@ * * * @author Zuy Alexey + * @since 1.13.0 */ public class UselessSuperCtorCallCheck extends AbstractCheck { 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 9aefa53247..91b7b2aa51 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 @@ -55,6 +55,7 @@ * * * @author liscju + * @since 1.14.0 */ public class WhitespaceBeforeArrayInitializerCheck extends AbstractCheck { 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 dcb141ab11..1b0c5c9a64 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 @@ -81,6 +81,7 @@ *

            * * @author Aleksey Nesterenko + * @since 1.13.0 */ public class AvoidConditionInversionCheck extends AbstractCheck { 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 6e22bd41c9..b69c38ed68 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 @@ -46,6 +46,7 @@ * ("allowedCauseTypes" option).

        * @author Daniil * Yaroslavtsev + * @since 1.8.0 */ public class CauseParameterInExceptionCheck extends AbstractCheck { 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 3226bfbdc5..f709be6159 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 @@ -67,6 +67,7 @@ * * * @author Richard Veach + * @since 1.25.0 */ public class CheckstyleTestMakeupCheck extends AbstractCheck { 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 87a115641a..847af1d6d6 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 @@ -45,6 +45,7 @@ *

        * @author Daniil * Yaroslavtsev + * @since 1.8.0 */ public class ChildBlockLengthCheck extends AbstractCheck { 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 ba98962729..92ccad3a0c 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 @@ -84,6 +84,7 @@ * issue 412

        . * * @author Sergey Dudoladov + * @since 1.20.0 */ public class ConstructorWithoutParamsCheck extends AbstractCheck { 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 649aa62873..a0e0409a99 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 @@ -65,6 +65,7 @@ * with option to ignore wildcard if used with another type (not alone). *

        * @author Baratali Izmailov + * @since 1.9.0 */ public class ForbidWildcardAsReturnTypeCheck extends AbstractCheck { 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 a060ce2aa5..82fe037cb3 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 @@ -33,6 +33,7 @@ * * @author lkuehne * @version $Revision: 1.12 $ + * @since 1.8.0 */ public class HideUtilityClassConstructorCheck extends AbstractCheck { 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 2c0f407450..05a46c8453 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 @@ -30,6 +30,7 @@ *

        * * @author Ruslan Dyachenko + * @since 1.8.0 */ public class InnerClassCheck extends AbstractCheck { 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 4a691f4c6f..0356a2515d 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 @@ -50,6 +50,7 @@ * <module name="NestedSwitchCheck"/> * * @author Damian Szczepanik (damianszczepanik@github) + * @since 1.13.0 */ public class NestedSwitchCheck extends AbstractCheck { 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 cfc52e238d..46294324ae 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 @@ -30,6 +30,7 @@ * Forbids main methods in abstract classes. Existence of 'main' method can * mislead a developer to consider this class as a ready-to-use implementation. * @author Baratali Izmailov email + * @since 1.9.0 */ public class NoMainMethodInAbstractClassCheck extends AbstractCheck { 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 180433cad5..0c07caf39d 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 @@ -70,6 +70,7 @@ * dead/useless code
        *
        * @author Aleksey Nesterenko + * @since 1.12.0 */ public class PublicReferenceToPrivateTypeCheck extends AbstractCheck { 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 cfbcac2dc2..0247af7ea9 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 @@ -62,6 +62,7 @@ * * * @author Vladislav Lisetskiy + * @since 1.17.0 */ public class StaticMethodCandidateCheck extends AbstractCheck { 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 5dc2dfea87..caaa672700 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 @@ -47,6 +47,7 @@ * * * @author Pavel Baranchikov + * @since 1.24.0 */ public class EnumValueNameCheck extends AbstractNameCheck { 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 d769331a58..97f522502f 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 @@ -48,6 +48,7 @@ * * @author Dmitry Gridyushko * @version 1.0 +* @since 1.8.0 */ public class InterfaceTypeParameterNameCheck extends AbstractNameCheck { 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 39b9f76e4d..5b751e70ea 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 @@ -74,6 +74,7 @@ * constant conform or there is no. * * @author Pavel Baranchikov + * @since 1.21.0 */ public class UniformEnumConstantNameCheck extends AbstractCheck { 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 affc08fad2..2560ed4596 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 @@ -86,6 +86,7 @@ * * @author Lars Kühne * @author Ruslan Dyachenko + * @since 1.5.1 */ public class LineLengthExtendedCheck extends AbstractCheck { From 68b1efed50dc371c95c0d880d57b81bfa1dbab38 Mon Sep 17 00:00:00 2001 From: Roman Ivanov Date: Thu, 28 Jun 2018 21:18:33 -0700 Subject: [PATCH 205/208] minor: put direct link to plain text maven repo --- README.textile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.textile b/README.textile index 83bdce4eb3..0582db5eb8 100644 --- a/README.textile +++ b/README.textile @@ -6,6 +6,8 @@ sevntu-checkstyle-maven-plugin:!https://maven-badges.herokuapp.com/maven-central 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 +All sevntu artifact on maven repo: https://repo1.maven.org/maven2/com/github/sevntu-checkstyle/ + Additional(non-standard) checks for Checkstyle that are compiled as: - extension to "maven-checkstyle-plugin":http://maven.apache.org/plugins/maven-checkstyle-plugin/ (how to use: "in general":http://maven.apache.org/plugins/maven-checkstyle-plugin/examples/custom-developed-checkstyle.html, "maven, ant, gradle example":https://github.com/sevntu-checkstyle/checkstyle-samples). From d117f94f68ca04e6cc2b7bafb5ee5f352b122290 Mon Sep 17 00:00:00 2001 From: rnveach Date: Sun, 1 Jul 2018 18:37:53 -0400 Subject: [PATCH 206/208] config: fixed incorrect eclipse-cs 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 422b89c160..6ce2c62a78 100644 --- a/sevntu-checks/pom.xml +++ b/sevntu-checks/pom.xml @@ -16,7 +16,7 @@ iso-8859-1 - 8.10.1 + 8.10 https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.eclipse-cs.version}/config/checkstyle_checks.xml 2.17 RELEASE From 243a9da1a1b0b9c826b09172db3a8b52799c2c16 Mon Sep 17 00:00:00 2001 From: rnveach Date: Sun, 1 Jul 2018 18:54:30 -0400 Subject: [PATCH 207/208] Issue #638: added release script --- .ci/travis.sh | 2 +- deploy-all.sh | 6 +- deploy.sh | 134 ++++++++++------- release.sh | 175 +++++++++++++++++++++++ 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 +- sevntu_xdoc_freemarker.template | 56 ++++++++ update-site/pom.xml | 2 +- 10 files changed, 326 insertions(+), 57 deletions(-) create mode 100755 release.sh create mode 100644 sevntu_xdoc_freemarker.template diff --git a/.ci/travis.sh b/.ci/travis.sh index 7d18820998..eda7a5040d 100755 --- a/.ci/travis.sh +++ b/.ci/travis.sh @@ -82,7 +82,7 @@ checkstyle-regression) cd checkstyle mvn -e clean verify -e -DskipTests -DskipITs -Dpmd.skip=true \ -Dfindbugs.skip=true -Dcobertura.skip=true \ - -Dmaven.sevntu-checkstyle-check.checkstyle.version=8.7 + -Dmaven.sevntu-checkstyle-check.checkstyle.version=8.10 ;; eclipse-analysis) diff --git a/deploy-all.sh b/deploy-all.sh index ae43129a1b..e43f538b1d 100755 --- a/deploy-all.sh +++ b/deploy-all.sh @@ -1,2 +1,4 @@ -#!/bin/sh -sh deploy.sh --all +#!/usr/bin/env bash + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +$CURRENT_DIR/deploy.sh --all diff --git a/deploy.sh b/deploy.sh index e7d401153e..f39722354e 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,7 +1,10 @@ -#!/bin/sh +#!/usr/bin/env bash -EXEC_DIR=`dirname $0` -REPO_HOME_DIR=`cd "$EXEC_DIR" ; pwd` +SEVNTU_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +GH_SEVNTU_DIR="/tmp/sevntu.checkstyle.gh" +PROJECT_NAME="sevntu.checkstyle" +GH_SEVNTU_HOMR_DIR="$GH_SEVNTU_DIR/$PROJECT_NAME" +GITHUB_PROJECT="sevntu-checkstyle/$PROJECT_NAME" usage="$(basename "$0") [--help --all --eclipse-cs --sonar --maven --idea] where: @@ -12,6 +15,8 @@ where: --sonar deploy only 'sevntu-checkstyle-sonar-plugin' project; --maven deploy only 'sevntu-checkstyle-maven-plugin' project; --idea deploy only 'sevntu-checkstyle-idea-extension' project; + --maven-central deploy to maven central; + --gh-pages deploy only gh-pages binaries with version argument; " @@ -23,41 +28,50 @@ For new version deploy please do: prepareForDeploy() { - #clean - rm -rf $REPO_HOME_DIR/gh-pages + echo "Preparing for Deployment" + if [ ! -d $GH_SEVNTU_DIR ]; then + mkdir $GH_SEVNTU_DIR + fi + + cd $GH_SEVNTU_DIR - #prepare folders for update-site and our release maven repository - mkdir $REPO_HOME_DIR/gh-pages - cd $REPO_HOME_DIR/gh-pages + if [ ! -d "$GH_SEVNTU_DIR/$PROJECT_NAME/.git" ]; then + git clone https://github.com/$GITHUB_PROJECT.git - git init - git remote add origin https://github.com/sevntu-checkstyle/sevntu.checkstyle.git - git fetch origin gh-pages:refs/remotes/origin/gh-pages - git checkout gh-pages + cd $GH_SEVNTU_HOMR_DIR + else + cd $GH_SEVNTU_HOMR_DIR - cd $REPO_HOME_DIR + git fetch origin + fi + + git reset --hard HEAD + git clean -f -d + git checkout origin/gh-pages return } deployIdea() { - cd $REPO_HOME_DIR/sevntu-checkstyle-idea-extension/ - mvn clean deploy -Plocal-deploy + echo "Deploying Idea" + cd $SEVNTU_DIR/sevntu-checkstyle-idea-extension/ + mvn clean deploy -Plocal-deploy -DdeployDir=$GH_SEVNTU_HOMR_DIR if [ "$?" != "0" ] then - echo "build for $REPO_HOME_DIR/sevntu-checkstyle-idea-extension/" + echo "build for $SEVNTU_DIR/sevntu-checkstyle-idea-extension/" exit 1 fi - cd $REPO_HOME_DIR/gh-pages + cd $GH_SEVNTU_HOMR_DIR echo "$manualDeploy" return } deployEclipse() { - cd $REPO_HOME_DIR + echo "Deploying Eclipse" + cd $SEVNTU_DIR #echo -n "Enter version number: " #read version #mvn org.eclipse.tycho:tycho-versions-plugin:set-version -DnewVersion=$version -f eclipse-pom.xml @@ -68,98 +82,110 @@ deployEclipse() exit 1 fi - cd $REPO_HOME_DIR/update-site - mvn wagon:upload - cd ../gh-pages + cd $SEVNTU_DIR/update-site + mvn wagon:upload -DdeployDir=$GH_SEVNTU_HOMR_DIR + cd $GH_SEVNTU_HOMR_DIR echo "$manualDeploy" return } deployMavenLibrary() { + echo "Deploying Sevntu Checks" # 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 - mvn clean javadoc:javadoc deploy -Plocal-deploy + cd $SEVNTU_DIR/sevntu-checks + mvn clean javadoc:javadoc deploy -Plocal-deploy -DdeployDir=$GH_SEVNTU_HOMR_DIR if [ "$?" != "0" ] then - echo "build for $REPO_HOME_DIR/sevntu-checks." + echo "build for $SEVNTU_DIR/sevntu-checks." exit 1 fi # deployment of Javadoc to static site - cp -rf target/site/apidocs ../gh-pages - - cd $REPO_HOME_DIR + cp -rf target/site/apidocs $GH_SEVNTU_HOMR_DIR # no need push to repository only library it should be done together with IDE plugins release - #cd ../gh-pages + #cd $GH_SEVNTU_HOMR_DIR #echo "$manualDeploy" return } deployToMavenCentral() { + echo "Deploying All to Maven Central" # 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 + cd $SEVNTU_DIR/sevntu-checks mvn clean deploy -DskipStaging=false -Pgpg if [ "$?" != "0" ] then - echo "build for $REPO_HOME_DIR/sevntu-checks." + echo "build for $SEVNTU_DIR/sevntu-checks." exit 1 fi - cd $REPO_HOME_DIR - cd $REPO_HOME_DIR/sevntu-checkstyle-maven-plugin/ + cd $SEVNTU_DIR/sevntu-checkstyle-maven-plugin/ mvn clean deploy -DskipStaging=false -Pgpg - cd $REPO_HOME_DIR - cd $REPO_HOME_DIR/sevntu-checkstyle-idea-extension/ + cd $SEVNTU_DIR/sevntu-checkstyle-idea-extension/ mvn clean deploy -DskipStaging=false -Pgpg - cd $REPO_HOME_DIR - cd $REPO_HOME_DIR/sevntu-checkstyle-sonar-plugin/ + cd $SEVNTU_DIR/sevntu-checkstyle-sonar-plugin/ mvn clean deploy -DskipStaging=false -Pgpg - cd $REPO_HOME_DIR return } deployMavenPlugin() { - cd $REPO_HOME_DIR/sevntu-checkstyle-maven-plugin/ - mvn clean deploy -Plocal-deploy + echo "Deploying Maven Plugin" + cd $SEVNTU_DIR/sevntu-checkstyle-maven-plugin/ + mvn clean deploy -Plocal-deploy -DdeployDir=$GH_SEVNTU_HOMR_DIR if [ "$?" != "0" ] then - echo "build for $REPO_HOME_DIR/sevntu-checkstyle-maven-plugin/." + echo "build for $SEVNTU_DIR/sevntu-checkstyle-maven-plugin/." exit 1 fi - cd $REPO_HOME_DIR/gh-pages + cd $GH_SEVNTU_HOMR_DIR echo "$manualDeploy" return } deploySonar() { - cd $REPO_HOME_DIR/sevntu-checkstyle-sonar-plugin/ - mvn clean install wagon:upload-single + echo "Deploying Sonar" + cd $SEVNTU_DIR/sevntu-checkstyle-sonar-plugin/ + mvn clean install wagon:upload-single -DdeployDir=$GH_SEVNTU_HOMR_DIR if [ "$?" != "0" ] then - echo "build for $REPO_HOME_DIR/sevntu-checkstyle-sonar-plugin/" + echo "build for $SEVNTU_DIR/sevntu-checkstyle-sonar-plugin/" exit 1 fi - cd $REPO_HOME_DIR/gh-pages + cd $GH_SEVNTU_HOMR_DIR echo "$manualDeploy" return } +deployToGhPages() + { + echo "Deploying GH Pages" + cd $GH_SEVNTU_HOMR_DIR + + sed -i "/

        New and noteworthy<\/h2>/ r $2" index.html + + git add . + git commit -m "binaries for $1 release" + CURRENT_COMMIT=$(git rev-parse HEAD) + git push origin $CURRENT_COMMIT:gh-pages + return + } + if [ $# -eq 0 ] then echo "$usage" @@ -200,16 +226,26 @@ do deployMavenPlugin shift 1 ;; - --maven-central) - deployToMavenCentral - shift 1 - ;; --idea) prepareForDeploy deployMavenLibrary deployIdea shift 1 ;; + --gh-pages) + if [ $# -eq 0 ] + then + echo "$usage" + shift 1 + else + deployToGhPages $2 $3 + shift 3 + fi + ;; + --maven-central) + deployToMavenCentral + shift 1 + ;; --) # End of all options shift diff --git a/release.sh b/release.sh new file mode 100755 index 0000000000..301c43f492 --- /dev/null +++ b/release.sh @@ -0,0 +1,175 @@ +#!/usr/bin/env bash +set -e + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Ex: 0.0.0 +OLD_VERSION=$1 +# Ex: 0.1.0 +NEW_VERSION=$2 +# Ex: 0.2.0 +NEXT_VERSION=$3 + +ECLIPSE_CS_DIR="/tmp/eclipse-cs" +CONTRIBUTION_DIR="/tmp/checkstyle.contribution" + +GITHUB_PROJECT="sevntu-checkstyle/sevntu.checkstyle" + +# https://github.com/settings/tokens +# SEVNTU_GITHUB_TOKEN="" + +if [[ -z "$OLD_VERSION" || -z "$NEW_VERSION" || -z "$NEXT_VERSION" ]] +then + echo "Old and New and Next version needs to be specified in the arguments" + exit 1 +fi +if [[ -z "$SEVNTU_GITHUB_TOKEN" ]] +then + echo "Github token needs to be specified in the script or as an environment variable 'SEVNTU_GITHUB_TOKEN'" + exit 1 +fi + +# require git, xmlstarlet (xml parsing) and jq (json parsing) +if ! [ -x "$(command -v git)" ]; then + echo "Error: git is not installed" + exit 1 +fi +if ! [ -x "$(command -v xmlstarlet)" ]; then + echo "Error: xmlstarlet is not installed" + exit 1 +fi +if ! [ -x "$(command -v jq)" ]; then + echo "Error: jq is not installed" + exit 1 +fi + +# fetch latest origin from server +echo "Resetting repository to origin" +git fetch origin +git reset --hard HEAD +git clean -f -d +git checkout origin/master + +cd sevntu-checks +ECLIPSE_CS_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) +cd .. + +# bring in and run release notes builder +echo "Cloning and installing ReleaseNotes builder" + +if [ ! -d $CONTRIBUTION_DIR ]; then + mkdir $CONTRIBUTION_DIR +fi + +cd $CONTRIBUTION_DIR + +if [ ! -d "$CONTRIBUTION_DIR/contribution/.git" ]; then + git clone https://github.com/checkstyle/contribution.git + + cd contribution +else + cd contribution + + git fetch origin +fi + +git reset --hard HEAD +git clean -f -d +git checkout origin/master + +cd releasenotes-builder +mvn package -DskipTests +cd target + +java -jar releasenotes-builder-1.0-all.jar -localRepoPath $CURRENT_DIR -remoteRepoPath $GITHUB_PROJECT -startRef $OLD_VERSION -releaseNumber $NEW_VERSION -githubAuthToken $SEVNTU_GITHUB_TOKEN -generateXdoc -xdocTemplate $CURRENT_DIR/sevntu_xdoc_freemarker.template + +# bring in eclipse-cs version in-use +echo "Cloning and installing Eclipse CS version $ECLIPSE_CS_VERSION" + +if [ ! -d $ECLIPSE_CS_DIR ]; then + mkdir $ECLIPSE_CS_DIR +fi + +cd $ECLIPSE_CS_DIR + +if [ ! -d "$ECLIPSE_CS_DIR/eclipse-cs/.git" ]; then + git clone https://github.com/checkstyle/eclipse-cs.git + + cd eclipse-cs +else + cd eclipse-cs + + git fetch origin +fi + +git reset --hard HEAD +git clean -f -d +git checkout tags/$ECLIPSE_CS_VERSION.0 + +mvn clean install + +# update versions in all files +echo "Bumping all versions from $OLD_VERSION to $NEW_VERSION" +cd $CURRENT_DIR +./pom-version-bump.sh $OLD_VERSION $NEW_VERSION + +# test and prepare for deployment +echo "Prepare for deployment" + +$CURRENT_DIR/deploy-all.sh +cd $CURRENT_DIR + +echo "" +read -p "Press enter to continue before committing" + +# commit version bump +echo "Committing version bump" +git add . +git commit -m "config: version bump to $NEW_VERSION" +CURRENT_COMMIT=$(git rev-parse HEAD) +git push origin $CURRENT_COMMIT:master + +# create new release tag +echo "Pushing new tag $NEW_VERSION" +git tag -a $NEW_VERSION -m "release $NEW_VERSION" +git push --tags + +# deploy gh-pages +echo "Updating gh-pages" + +$CURRENT_DIR/deploy.sh --gh-pages $NEW_VERSION $CONTRIBUTION_DIR/contribution/releasenotes-builder/target/xdoc.xml + +# deploy to maven central +echo "Deploying to maven central" +$CURRENT_DIR/deploy.sh --maven-central + +# dropped support for gh-pages/sevntu-checkstyle-default-configuration.xml + +# retrieve old milestone number +# https://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository +OLD_MILESTONE_NUMBER=$(curl --silent --show-error --fail \ + -H "Authorization: token $SEVNTU_GITHUB_TOKEN" \ + https://api.github.com/repos/$GITHUB_PROJECT/milestones?state=open \ + | jq '.[0].number') + +echo "" +read -p "Press enter to continue before closing and creating new milestone" + +# close old milestone +# https://developer.github.com/v3/issues/milestones/#update-a-milestone +echo "Closing old milestone $OLD_MILESTONE_NUMBER" +curl --silent --show-error --fail -H "Authorization: token $SEVNTU_GITHUB_TOKEN" \ + -d "{ \"state\": \"closed\" }" \ + -X PATCH https://api.github.com/repos/$GITHUB_PROJECT/milestones/$OLD_MILESTONE_NUMBER + +# create new milestone +# https://developer.github.com/v3/issues/milestones/#create-a-milestone +echo "Creating new milestone for $NEXT_VERSION" +curl --silent --show-error --fail -H "Authorization: token $SEVNTU_GITHUB_TOKEN" \ + -d "{ \"title\": \"$NEXT_VERSION\", \ + \"state\": \"open\", \ + \"description\": \"\" }" \ + -X POST https://api.github.com/repos/$GITHUB_PROJECT/milestones + +echo "Done" diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml index 6ce2c62a78..09f795d4eb 100644 --- a/sevntu-checks/pom.xml +++ b/sevntu-checks/pom.xml @@ -357,7 +357,7 @@ com.github.sevntu-checkstyle sevntu-checks - file://${basedir}/../gh-pages/maven2/ + file://${deployDir}/maven2/ diff --git a/sevntu-checkstyle-idea-extension/pom.xml b/sevntu-checkstyle-idea-extension/pom.xml index 1187ee7c13..d605208850 100644 --- a/sevntu-checkstyle-idea-extension/pom.xml +++ b/sevntu-checkstyle-idea-extension/pom.xml @@ -128,7 +128,7 @@ com.github.sevntu-checkstyle Sevntu Checkstyle Idea extension - file://${basedir}/../gh-pages/maven2/ + file://${deployDir}/maven2/ diff --git a/sevntu-checkstyle-maven-plugin/pom.xml b/sevntu-checkstyle-maven-plugin/pom.xml index a9658cc456..e4c6379535 100644 --- a/sevntu-checkstyle-maven-plugin/pom.xml +++ b/sevntu-checkstyle-maven-plugin/pom.xml @@ -93,7 +93,7 @@ com.github.sevntu-checkstyle Sevntu Checkstyle Maven Plugin - file://${basedir}/../gh-pages/maven2/ + file://${deployDir}/maven2/ diff --git a/sevntu-checkstyle-sonar-plugin/pom.xml b/sevntu-checkstyle-sonar-plugin/pom.xml index fcc0ccb192..b354a472b2 100644 --- a/sevntu-checkstyle-sonar-plugin/pom.xml +++ b/sevntu-checkstyle-sonar-plugin/pom.xml @@ -133,7 +133,7 @@ 1.0-beta-4 ${project.build.directory}/${project.build.finalName}.jar - file://${basedir}/../gh-pages/sonar/ + file://${deployDir}/sonar/ diff --git a/sevntu_xdoc_freemarker.template b/sevntu_xdoc_freemarker.template new file mode 100644 index 0000000000..484ee49a93 --- /dev/null +++ b/sevntu_xdoc_freemarker.template @@ -0,0 +1,56 @@ + <#escape x as x?html> +
        +

        Release ${releaseNo}

        +
        + <#if breakingMessages?has_content> +

        Breaking backward compatibility:

        +
          + <#list breakingMessages as message> +
        • + ${message.title}. + Author: ${message.author}<#if message.issueNo != -1> + #${message.issueNo} +
        • + +
        + + <#if newMessages?has_content> +

        New:

        +
          + <#list newMessages as message> +
        • + ${message.title}. + Author: ${message.author}<#if message.issueNo != -1> + #${message.issueNo} +
        • + +
        + + <#if bugMessages?has_content> +

        Bug fixes:

        +
          + <#list bugMessages as message> +
        • + ${message.title}. + Author: ${message.author}<#if message.issueNo != -1> + #${message.issueNo} +
        • + +
        + + <#if notesMessages?has_content> +

        Notes:

        +
          + <#list notesMessages as message> +
        • + ${message.title}. + Author: ${message.author}<#if message.issueNo != -1> + #${message.issueNo} +
        • + +
        + +
        +
        + + diff --git a/update-site/pom.xml b/update-site/pom.xml index 20830bdc41..301e5e82de 100644 --- a/update-site/pom.xml +++ b/update-site/pom.xml @@ -53,7 +53,7 @@ ${project.build.directory}/repository/ ** update-site - file://${project.build.directory}/../../gh-pages + file://${deployDir}
        From e5bcf6463a9ff99a1d2cf99239cd868d184bd759 Mon Sep 17 00:00:00 2001 From: rnveach Date: Sun, 1 Jul 2018 22:28:41 -0400 Subject: [PATCH 208/208] config: version bump to 1.30.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 198cf2f29f..2a5625177a 100644 --- a/eclipse-pom.xml +++ b/eclipse-pom.xml @@ -5,7 +5,7 @@ com.github.sevntu-checkstyle parent - 1.29.0 + 1.30.0 pom diff --git a/eclipsecs-sevntu-plugin-feature/feature.xml b/eclipsecs-sevntu-plugin-feature/feature.xml index e38f226ce2..172e9adee4 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 09aa736fb5..28dd54bbe8 100644 --- a/eclipsecs-sevntu-plugin-feature/pom.xml +++ b/eclipsecs-sevntu-plugin-feature/pom.xml @@ -7,7 +7,7 @@ ../eclipse-pom.xml com.github.sevntu-checkstyle parent - 1.29.0 + 1.30.0 com.github.sevntu-checkstyle diff --git a/eclipsecs-sevntu-plugin/META-INF/MANIFEST.MF b/eclipsecs-sevntu-plugin/META-INF/MANIFEST.MF index 34e4c943cb..f5d518c9f0 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.29.0 +Bundle-Version: 1.30.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 0859175af7..10051c6a44 100644 --- a/eclipsecs-sevntu-plugin/pom.xml +++ b/eclipsecs-sevntu-plugin/pom.xml @@ -9,7 +9,7 @@ ../eclipse-pom.xml com.github.sevntu-checkstyle parent - 1.29.0 + 1.30.0 com.github.sevntu-checkstyle diff --git a/sevntu-checks/pom.xml b/sevntu-checks/pom.xml index 09f795d4eb..54b1de47b1 100644 --- a/sevntu-checks/pom.xml +++ b/sevntu-checks/pom.xml @@ -11,7 +11,7 @@ com.github.sevntu-checkstyle sevntu-checks - 1.29.0 + 1.30.0 iso-8859-1 diff --git a/sevntu-checkstyle-idea-extension/pom.xml b/sevntu-checkstyle-idea-extension/pom.xml index d605208850..7a0f11f972 100644 --- a/sevntu-checkstyle-idea-extension/pom.xml +++ b/sevntu-checkstyle-idea-extension/pom.xml @@ -11,7 +11,7 @@ com.github.sevntu-checkstyle sevntu-checkstyle-idea-extension - 1.29.0 + 1.30.0 jar Sevntu Checkstyle Idea extension diff --git a/sevntu-checkstyle-maven-plugin/pom.xml b/sevntu-checkstyle-maven-plugin/pom.xml index e4c6379535..edbb53f969 100644 --- a/sevntu-checkstyle-maven-plugin/pom.xml +++ b/sevntu-checkstyle-maven-plugin/pom.xml @@ -12,7 +12,7 @@ com.github.sevntu-checkstyle sevntu-checkstyle-maven-plugin Sevntu Checkstyle Maven Plugin - 1.29.0 + 1.30.0 @@ -25,7 +25,7 @@ com.github.sevntu-checkstyle sevntu-checks - 1.29.0 + 1.30.0 org.apache.maven.plugins diff --git a/sevntu-checkstyle-sonar-plugin/pom.xml b/sevntu-checkstyle-sonar-plugin/pom.xml index b354a472b2..a1cc662022 100644 --- a/sevntu-checkstyle-sonar-plugin/pom.xml +++ b/sevntu-checkstyle-sonar-plugin/pom.xml @@ -11,7 +11,7 @@ com.github.sevntu-checkstyle sevntu-checkstyle-sonar-plugin - 1.29.0 + 1.30.0 sonar-plugin SevNTU Checkstyle Sonar Extension Plugin diff --git a/update-site/pom.xml b/update-site/pom.xml index 301e5e82de..321c5d0a46 100644 --- a/update-site/pom.xml +++ b/update-site/pom.xml @@ -7,7 +7,7 @@ ../eclipse-pom.xml com.github.sevntu-checkstyle parent - 1.29.0 + 1.30.0 com.github.sevntu.checkstyle.p2updatesite