Skip to content

Commit

Permalink
Issue #4394: rearranged pitest-checkstyle-api-filters profile
Browse files Browse the repository at this point in the history
  • Loading branch information
Nimfadora authored and romani committed Jul 9, 2017
1 parent a2ed764 commit 6e67426
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 6 deletions.
44 changes: 40 additions & 4 deletions pom.xml
Expand Up @@ -2123,7 +2123,7 @@
</build>
</profile>
<profile>
<id>pitest-checkstyle-api-filters</id>
<id>pitest-checkstyle-api</id>
<build>
<plugins>
<plugin>
Expand All @@ -2133,8 +2133,6 @@
<configuration>
<targetClasses>
<param>com.puppycrawl.tools.checkstyle.api.*</param>
<param>com.puppycrawl.tools.checkstyle.filefilters.*</param>
<param>com.puppycrawl.tools.checkstyle.filters.*</param>
</targetClasses>
<targetTests>
<param>com.puppycrawl.tools.checkstyle.api.*</param>
Expand All @@ -2146,7 +2144,45 @@
<param>com.puppycrawl.tools.checkstyle.checks.javadoc.WriteTagCheckTest</param>
<param>com.puppycrawl.tools.checkstyle.checks.naming.ParameterNameCheckTest</param>
</targetTests>
<mutationThreshold>90</mutationThreshold>
<mutationThreshold>88</mutationThreshold>
<timeoutFactor>${pitest.plugin.timeout.factor}</timeoutFactor>
<timeoutConstant>${pitest.plugin.timeout.constant}</timeoutConstant>
<threads>${pitest.plugin.threads}</threads>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>pitest-checkstyle-filters</id>
<build>
<plugins>
<plugin>
<groupId>org.pitest</groupId>
<artifactId>pitest-maven</artifactId>
<version>${pitest.plugin.version}</version>
<configuration>
<targetClasses>
<param>com.puppycrawl.tools.checkstyle.filefilters.*</param>
<param>com.puppycrawl.tools.checkstyle.filters.*</param>
</targetClasses>
<targetTests>
<param>com.puppycrawl.tools.checkstyle.filefilters.*</param>
<param>com.puppycrawl.tools.checkstyle.filters.*</param>
</targetTests>
<excludedMethods>
<!-- till https://github.com/checkstyle/checkstyle/issues/4396 -->
<param>compareTo</param>
<!-- till https://github.com/checkstyle/checkstyle/issues/4396 -->
<param>findNearestMatch</param>
<!-- till https://github.com/checkstyle/checkstyle/issues/4396 -->
<param>tagSuppressions</param>
<!-- till https://github.com/checkstyle/checkstyle/issues/4396 -->
<param>tagSuppressions</param>
<!-- till https://github.com/checkstyle/checkstyle/issues/4396 -->
<param>startElement</param>
</excludedMethods>
<mutationThreshold>100</mutationThreshold>
<timeoutFactor>${pitest.plugin.timeout.factor}</timeoutFactor>
<timeoutConstant>${pitest.plugin.timeout.constant}</timeoutConstant>
<threads>${pitest.plugin.threads}</threads>
Expand Down
3 changes: 2 additions & 1 deletion shippable.yml
Expand Up @@ -9,7 +9,8 @@ env:
- PROFILE="-Ppitest-checkstyle-common,no-validations"
- PROFILE="-Ppitest-checkstyle-main,no-validations"
- PROFILE="-Ppitest-checkstyle-tree-walker,no-validations"
- PROFILE="-Ppitest-checkstyle-api-filters,no-validations"
- PROFILE="-Ppitest-checkstyle-api,no-validations"
- PROFILE="-Ppitest-checkstyle-filters,no-validations"
- PROFILE="-Ppitest-checkstyle-utils,no-validations"
- PROFILE="-Ppitest-checks-annotation,no-validations"
- PROFILE="-Ppitest-checks-blocks,no-validations"
Expand Down
Expand Up @@ -333,7 +333,7 @@ public Tag(String text, int line, SuppressWithNearbyCommentFilter filter) {
throw new IllegalArgumentException("unable to parse influence from '" + text
+ "' using " + filter.influenceFormat, ex);
}
if (influence >= 0) {
if (influence >= 1) {
firstLine = line;
lastLine = line + influence;
}
Expand Down
Expand Up @@ -258,6 +258,25 @@ public void testInvalidInfluenceFormat() throws Exception {
}
}

@Test
public void testInfluenceFormat() throws Exception {
final DefaultConfiguration filterConfig =
createFilterConfig(SuppressWithNearbyCommentFilter.class);
filterConfig.addAttribute("influenceFormat", "1");

final String[] suppressed = {
"14:17: Name 'A1' must match pattern '^[a-z][a-zA-Z0-9]*$'.",
"15:17: Name 'A2' must match pattern '^[a-z][a-zA-Z0-9]*$'.",
"16:59: Name 'A3' must match pattern '^[a-z][a-zA-Z0-9]*$'.",
"18:17: Name 'B1' must match pattern '^[a-z][a-zA-Z0-9]*$'.",
"19:17: Name 'B2' must match pattern '^[a-z][a-zA-Z0-9]*$'.",
"20:59: Name 'B3' must match pattern '^[a-z][a-zA-Z0-9]*$'.",
"80:59: Name 'A2' must match pattern '^[a-z][a-zA-Z0-9]*$'.",
"81:17: Name 'A1' must match pattern '^[a-z][a-zA-Z0-9]*$'.",
};
verifySuppressed(filterConfig, suppressed);
}

@Test
public void testInvalidCheckFormat() throws Exception {
final DefaultConfiguration filterConfig =
Expand Down

0 comments on commit 6e67426

Please sign in to comment.