-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #11439: Converted test for SuppressionXpathSingleFilterTest to …
…use inlined config in Input files
- Loading branch information
1 parent
51c0412
commit 56a87ad
Showing
18 changed files
with
521 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
357 changes: 165 additions & 192 deletions
357
src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressionXpathSingleFilterTest.java
Large diffs are not rendered by default.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
...ls/checkstyle/filters/suppressionxpathsinglefilter/InputSuppressionXpathSingleFilter.java
This file was deleted.
Oops, something went wrong.
41 changes: 41 additions & 0 deletions
41
...e/filters/suppressionxpathsinglefilter/InputSuppressionXpathSingleFilterComplexQuery.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
SuppressionXpathSingleFilter | ||
files = (default)(null) | ||
checks = (default)(null) | ||
message = (default)(null) | ||
id = (default)(null) | ||
query = /COMPILATION_UNIT/CLASS_DEF[./IDENT \ | ||
[@text='InputSuppressionXpathSingleFilterComplexQuery']]/OBJBLOCK/METHOD_DEF[./IDENT \ | ||
[@text='countTokens']]/SLIST/VARIABLE_DEF[./IDENT[@text='pi']] \ | ||
/ASSIGN/EXPR/NUM_FLOAT[@text='3.14'] | ||
com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck | ||
ignoreNumbers = (default)-1, 0, 1, 2 | ||
ignoreHashCodeMethod = (default)false | ||
ignoreAnnotation = (default)false | ||
ignoreFieldDeclaration = (default)false | ||
ignoreAnnotationElementDefaults = (default)true | ||
constantWaiverParentToken = (default)TYPECAST, METHOD_CALL, EXPR, ARRAY_INIT, UNARY_MINUS, \ | ||
UNARY_PLUS, ELIST, STAR, ASSIGN, PLUS, MINUS, DIV, LITERAL_NEW | ||
tokens = (default)NUM_DOUBLE, NUM_FLOAT, NUM_INT, NUM_LONG | ||
*/ | ||
package com.puppycrawl.tools.checkstyle.filters.suppressionxpathsinglefilter; | ||
|
||
public class InputSuppressionXpathSingleFilterComplexQuery { | ||
private int countTokens() { | ||
double pi = 3.14; // filtered violation | ||
return 123; // violation | ||
} | ||
|
||
public String getName() { | ||
int someVariable = 123; // violation | ||
return "InputSuppressByXpathThree"; | ||
} | ||
|
||
public int sum(int a, int b) { | ||
String someVariable = "Hello World"; | ||
return a + b; | ||
} | ||
|
||
} |
38 changes: 38 additions & 0 deletions
38
...ilters/suppressionxpathsinglefilter/InputSuppressionXpathSingleFilterDecideByMessage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
SuppressionXpathSingleFilter | ||
files = (null) | ||
checks = (null) | ||
message = Missing a Javadoc comment | ||
id = (null) | ||
query = (null) | ||
com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck | ||
scope = (default)public | ||
excludeScope = (default)(null) | ||
skipAnnotations = (default)Generated | ||
tokens = CLASS_DEF | ||
com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck | ||
ignoreNumbers = (default)-1, 0, 1, 2 | ||
ignoreHashCodeMethod = (default)false | ||
ignoreAnnotation = (default)false | ||
ignoreFieldDeclaration = (default)false | ||
ignoreAnnotationElementDefaults = (default)true | ||
constantWaiverParentToken = (default)TYPECAST, METHOD_CALL, EXPR, ARRAY_INIT, UNARY_MINUS, \ | ||
UNARY_PLUS, ELIST, STAR, ASSIGN, PLUS, MINUS, DIV, LITERAL_NEW | ||
tokens = (default)NUM_DOUBLE, NUM_FLOAT, NUM_INT, NUM_LONG | ||
*/ | ||
package com.puppycrawl.tools.checkstyle.filters.suppressionxpathsinglefilter; | ||
|
||
public class InputSuppressionXpathSingleFilterDecideByMessage { // filtered violation | ||
private int countTokens() { | ||
double pi = 3.14; // violation | ||
return 123; // violation | ||
} | ||
|
||
public String getName() { | ||
int someVariable = 123; // violation | ||
return "InputSuppressByXpathThree"; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...lters/suppressionxpathsinglefilter/InputSuppressionXpathSingleFilterMatchingModuleId.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
SuppressionXpathSingleFilter | ||
files = InputSuppressionXpathSingleFilterMatchingModuleId | ||
checks = (default)(null) | ||
message = (default)(null) | ||
id = 007 | ||
query = /COMPILATION_UNIT/CLASS_DEF \ | ||
[./IDENT[@text='InputSuppressionXpathSingleFilterMatchingModuleId']] | ||
com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck | ||
id = 007 | ||
scope = (default)public | ||
excludeScope = (default)(null) | ||
skipAnnotations = (default)Generated | ||
tokens = CLASS_DEF | ||
*/ | ||
package com.puppycrawl.tools.checkstyle.filters.suppressionxpathsinglefilter; | ||
|
||
public class InputSuppressionXpathSingleFilterMatchingModuleId { // filtered violation | ||
|
||
} |
21 changes: 21 additions & 0 deletions
21
...ters/suppressionxpathsinglefilter/InputSuppressionXpathSingleFilterMatchingTokenType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
SuppressionXpathSingleFilter | ||
files = InputSuppressionXpathSingleFilterMatchingTokenType | ||
checks = MissingJavadocTypeCheck | ||
message = (default)(null) | ||
id = (default)(null) | ||
query = /COMPILATION_UNIT/CLASS_DEF \ | ||
[./IDENT[@text='InputSuppressionXpathSingleFilterMatchingTokenType']] | ||
com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck | ||
scope = (default)public | ||
excludeScope = (default)(null) | ||
skipAnnotations = (default)Generated | ||
tokens = CLASS_DEF | ||
*/ | ||
package com.puppycrawl.tools.checkstyle.filters.suppressionxpathsinglefilter; | ||
|
||
public class InputSuppressionXpathSingleFilterMatchingTokenType { // filtered violation | ||
|
||
} |
19 changes: 19 additions & 0 deletions
19
...kstyle/filters/suppressionxpathsinglefilter/InputSuppressionXpathSingleFilterNoQuery.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
SuppressionXpathSingleFilter | ||
files = InputSuppressionXpathSingleFilterNoQuery | ||
checks = (default)(null) | ||
message = (default)(null) | ||
id = (default)(null) | ||
query = (default)(null) | ||
com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck | ||
scope = (default)public | ||
excludeScope = (default)(null) | ||
skipAnnotations = (default)Generated | ||
tokens = CLASS_DEF | ||
*/ | ||
package com.puppycrawl.tools.checkstyle.filters.suppressionxpathsinglefilter; | ||
|
||
public class InputSuppressionXpathSingleFilterNoQuery { // filtered violation | ||
} |
20 changes: 20 additions & 0 deletions
20
...lters/suppressionxpathsinglefilter/InputSuppressionXpathSingleFilterNonMatchingCheck.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
SuppressionXpathSingleFilter | ||
files = InputSuppressionXpathSingleFilterNonMatchingCheck | ||
checks = UnusedLocalVariableCheck | ||
message = (default)(null) | ||
id = (default)(null) | ||
query = /COMPILATION_UNIT/CLASS_DEF \ | ||
[./IDENT[@text='InputSuppressionXpathSingleFilterNonMatchingCheck']] | ||
com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck | ||
scope = (default)public | ||
excludeScope = (default)(null) | ||
skipAnnotations = (default)Generated | ||
tokens = CLASS_DEF | ||
*/ | ||
package com.puppycrawl.tools.checkstyle.filters.suppressionxpathsinglefilter; | ||
|
||
public class InputSuppressionXpathSingleFilterNonMatchingCheck { // violation | ||
} |
28 changes: 28 additions & 0 deletions
28
...uppressionxpathsinglefilter/InputSuppressionXpathSingleFilterNonMatchingColumnNumber.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
SuppressionXpathSingleFilter | ||
files = InputSuppressionXpathSingleFilterNonMatchingColumnNumber | ||
checks = TypeNameCheck | ||
message = (default)(null) | ||
id = (default)(null) | ||
query = /COMPILATION_UNIT/CLASS_DEF[./IDENT \ | ||
[@text='InputSuppressionXpathSingleFilterNonMatchingColumnNumber']] | ||
com.puppycrawl.tools.checkstyle.checks.naming.TypeNameCheck | ||
format = (default)^[A-Z][a-zA-Z0-9]*$ | ||
applyToPublic = (default)true | ||
applyToProtected = (default)true | ||
applyToPackage = (default)true | ||
applyToPrivate = (default)true | ||
tokens = CLASS_DEF | ||
*/ | ||
package com.puppycrawl.tools.checkstyle.filters.suppressionxpathsinglefilter; | ||
|
||
public class InputSuppressionXpathSingleFilterNonMatchingColumnNumber { | ||
|
||
class testClass { // violation | ||
} | ||
|
||
class anotherTestClass { // violation | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...athsinglefilter/InputSuppressionXpathSingleFilterNonMatchingFileNameModuleIdAndCheck.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
SuppressionXpathSingleFilter | ||
files = SomeFile | ||
checks = UnusedLocalVariableCheck | ||
message = (default)(null) | ||
id = 64 | ||
query = /COMPILATION_UNIT/CLASS_DEF \ | ||
[./IDENT[@text='InputSuppressionXpathSingleFilterNonMatchingFileNameModuleIdAndCheck']] | ||
com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck | ||
id = 007 | ||
scope = (default)public | ||
excludeScope = (default)(null) | ||
skipAnnotations = (default)Generated | ||
tokens = CLASS_DEF | ||
*/ | ||
package com.puppycrawl.tools.checkstyle.filters.suppressionxpathsinglefilter; | ||
|
||
public class InputSuppressionXpathSingleFilterNonMatchingFileNameModuleIdAndCheck { // violation | ||
} |
19 changes: 19 additions & 0 deletions
19
.../suppressionxpathsinglefilter/InputSuppressionXpathSingleFilterNonMatchingFileRegexp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
SuppressionXpathSingleFilter | ||
files = NonMatchingClassName | ||
checks = (default)(null) | ||
message = (default)(null) | ||
id = (default)(null) | ||
query = (default)(null) | ||
com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck | ||
scope = (default)public | ||
excludeScope = (default)(null) | ||
skipAnnotations = (default)Generated | ||
tokens = CLASS_DEF | ||
*/ | ||
package com.puppycrawl.tools.checkstyle.filters.suppressionxpathsinglefilter; | ||
|
||
public class InputSuppressionXpathSingleFilterNonMatchingFileRegexp { // violation | ||
} |
22 changes: 22 additions & 0 deletions
22
.../suppressionxpathsinglefilter/InputSuppressionXpathSingleFilterNonMatchingLineNumber.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
SuppressionXpathSingleFilter | ||
files = InputSuppressionXpathSingleFilterNonMatchingLineNumber | ||
checks = MissingJavadocTypeCheck | ||
message = (default)(null) | ||
id = (default)(null) | ||
query = /COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='TestClass']] | ||
com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck | ||
scope = package | ||
excludeScope = (default)(null) | ||
skipAnnotations = (default)Generated | ||
tokens = CLASS_DEF | ||
*/ | ||
package com.puppycrawl.tools.checkstyle.filters.suppressionxpathsinglefilter; | ||
|
||
public class InputSuppressionXpathSingleFilterNonMatchingLineNumber { // violation | ||
} | ||
|
||
class TestClass { // filtered violation | ||
} |
21 changes: 21 additions & 0 deletions
21
...rs/suppressionxpathsinglefilter/InputSuppressionXpathSingleFilterNonMatchingModuleId.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
SuppressionXpathSingleFilter | ||
files = InputSuppressionXpathSingleFilterNonMatchingModuleId | ||
checks = MissingJavadocTypeCheck | ||
message = (default)(null) | ||
id = 64 | ||
query = /COMPILATION_UNIT/CLASS_DEF \ | ||
[./IDENT[@text='InputSuppressionXpathSingleFilterNonMatchingModuleId']] | ||
com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck | ||
id = 007 | ||
scope = (default)public | ||
excludeScope = (default)(null) | ||
skipAnnotations = (default)Generated | ||
tokens = CLASS_DEF | ||
*/ | ||
package com.puppycrawl.tools.checkstyle.filters.suppressionxpathsinglefilter; | ||
|
||
public class InputSuppressionXpathSingleFilterNonMatchingModuleId { // violation | ||
} |
20 changes: 20 additions & 0 deletions
20
...s/suppressionxpathsinglefilter/InputSuppressionXpathSingleFilterNonMatchingTokenType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
SuppressionXpathSingleFilter | ||
files = InputSuppressionXpathSingleFilterNonMatchingTokenType | ||
checks = MissingJavadocTypeCheck | ||
message = (default)(null) | ||
id = (default)(null) | ||
query = /COMPILATION_UNIT/CLASS_DEF[./IDENT \ | ||
[@text='InputSuppressionXpathSingleFilterNonMatchingTokenType']] | ||
com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck | ||
scope = (default)public | ||
excludeScope = (default)(null) | ||
skipAnnotations = (default)Generated | ||
tokens = CLASS_DEF, INTERFACE_DEF | ||
*/ | ||
package com.puppycrawl.tools.checkstyle.filters.suppressionxpathsinglefilter; | ||
|
||
public interface InputSuppressionXpathSingleFilterNonMatchingTokenType { // violation | ||
} |
19 changes: 19 additions & 0 deletions
19
...e/filters/suppressionxpathsinglefilter/InputSuppressionXpathSingleFilterNullFileName.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
SuppressionXpathSingleFilter | ||
files = (default)(null) | ||
checks = (default)(null) | ||
message = (default)(null) | ||
id = (default)(null) | ||
query = /COMPILATION_UNIT | ||
com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck | ||
scope = (default)public | ||
excludeScope = (default)(null) | ||
skipAnnotations = (default)Generated | ||
tokens = CLASS_DEF | ||
*/ | ||
package com.puppycrawl.tools.checkstyle.filters.suppressionxpathsinglefilter; | ||
|
||
public class InputSuppressionXpathSingleFilterNullFileName { // violation | ||
} |
21 changes: 21 additions & 0 deletions
21
...onxpathsinglefilter/InputSuppressionXpathSingleFilterNullModuleIdAndNonMatchingCheck.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
SuppressionXpathSingleFilter | ||
files = SomeFile | ||
checks = UnusedLocalVariableCheck | ||
message = (default)(null) | ||
id = (default)(null) | ||
query = /COMPILATION_UNIT/CLASS_DEF \ | ||
[./IDENT[@text='InputSuppressionXpathSingleFilterNullModuleIdAndNonMatchingCheck']] | ||
com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck | ||
id = 007 | ||
scope = (default)public | ||
excludeScope = (default)(null) | ||
skipAnnotations = (default)Generated | ||
tokens = CLASS_DEF | ||
*/ | ||
package com.puppycrawl.tools.checkstyle.filters.suppressionxpathsinglefilter; | ||
|
||
public class InputSuppressionXpathSingleFilterNullModuleIdAndNonMatchingCheck { // violation | ||
} |
Oops, something went wrong.