aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrnveach <rveach02@gmail.com>2017-04-09 12:08:22 -0400
committerRoman Ivanov <romani@users.noreply.github.com>2017-04-12 11:25:26 -0700
commit84b438cc5cb7f747a99c99ba7b3f94b0c4169ae0 (patch)
tree9cca47f4823bbec85f437b85226210ffec7a4f0f /src
parent32cea1a74209953f8923d4209cff4eef6cba9af2 (diff)
downloadcheckstyle-84b438cc5cb7f747a99c99ba7b3f94b0c4169ae0.tar.gz
Issue #4119: fixed verifying tokens being referenced in configs
Diffstat (limited to 'src')
-rw-r--r--src/test/java/com/puppycrawl/tools/checkstyle/internal/AllChecksTest.java18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/internal/AllChecksTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/internal/AllChecksTest.java
index 4447580ed..3738076ed 100644
--- a/src/test/java/com/puppycrawl/tools/checkstyle/internal/AllChecksTest.java
+++ b/src/test/java/com/puppycrawl/tools/checkstyle/internal/AllChecksTest.java
@@ -130,7 +130,8 @@ public class AllChecksTest extends BaseCheckTestSupport {
// https://github.com/checkstyle/checkstyle/issues/3730
CHECKSTYLE_TOKENS_IN_CONFIG_TO_IGNORE.put("AnnotationLocation",
Stream.of("TYPECAST", "DOT", "TYPE_ARGUMENT", "LITERAL_NEW", "LITERAL_THROWS",
- "IMPLEMENTS_CLAUSE").collect(Collectors.toSet()));
+ "IMPLEMENTS_CLAUSE", "CLASS_DEF", "CTOR_DEF", "ENUM_DEF", "INTERFACE_DEF",
+ "METHOD_DEF", "VARIABLE_DEF").collect(Collectors.toSet()));
CHECKSTYLE_TOKENS_IN_CONFIG_TO_IGNORE.put("NoLineWrap", Stream.of(
// method declaration could be long due to "parameters/exceptions", it is ok to
// be not strict there
@@ -190,8 +191,11 @@ public class AllChecksTest extends BaseCheckTestSupport {
// can be empty for special cases via '6.2 Caught exceptions: not ignored'
"LITERAL_CATCH",
// specifically allowed via '5.2.4 Constant names'
- "ARRAY_INIT")
- .collect(Collectors.toSet()));
+ "ARRAY_INIT",
+ // state of the configuration when test was made until
+ // https://github.com/checkstyle/checkstyle/issues/4121
+ "INSTANCE_INIT", "LITERAL_DO", "LITERAL_FOR", "LITERAL_SYNCHRONIZED",
+ "LITERAL_WHILE", "STATIC_INIT").collect(Collectors.toSet()));
GOOGLE_TOKENS_IN_CONFIG_TO_IGNORE.put("WhitespaceAround", Stream.of(
// allowed via '4.8.3 Arrays'
"ARRAY_INIT",
@@ -208,7 +212,10 @@ public class AllChecksTest extends BaseCheckTestSupport {
// assignment operators and they are allowed to break before or after the symbol
"DIV_ASSIGN", "BOR_ASSIGN", "SL_ASSIGN", "ASSIGN", "BSR_ASSIGN", "BAND_ASSIGN",
"PLUS_ASSIGN", "MINUS_ASSIGN", "SR_ASSIGN", "STAR_ASSIGN", "BXOR_ASSIGN",
- "MOD_ASSIGN").collect(Collectors.toSet()));
+ "MOD_ASSIGN",
+ // state of the configuration when test was made until
+ // https://github.com/checkstyle/checkstyle/issues/4122
+ "COLON", "TYPE_EXTENSION_AND").collect(Collectors.toSet()));
}
@Test
@@ -368,7 +375,7 @@ public class AllChecksTest extends BaseCheckTestSupport {
configTokens.addAll(overrideTokens);
}
- configTokens.addAll(CheckUtil.getTokenNameSet(check.getDefaultTokens()));
+ configTokens.addAll(CheckUtil.getTokenNameSet(check.getRequiredTokens()));
checkTokens.put(checkName,
CheckUtil.getTokenNameSet(check.getAcceptableTokens()));
}
@@ -379,6 +386,7 @@ public class AllChecksTest extends BaseCheckTestSupport {
}
catch (CheckstyleException ex) {
// no tokens defined, so it is using default
+ configTokens.addAll(CheckUtil.getTokenNameSet(check.getDefaultTokens()));
}
}
}