Skip to content

Commit

Permalink
supplemental: resolve checkstyle violations from expanded search #444
Browse files Browse the repository at this point in the history
  • Loading branch information
rnveach authored and muhlba91 committed Oct 23, 2022
1 parent a48beaa commit 5d04f1d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
2 changes: 2 additions & 0 deletions config/sevntu_suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@


<!-- Tone down the checking for test code -->
<suppress checks="MultipleStringLiteralsExtended" files=".*[\\/]src[\\/]it[\\/]"/>
<suppress checks="MultipleStringLiteralsExtended" files=".*[\\/]src[\\/]test[\\/]"/>
<suppress checks="ForbidCCommentsInMethods" files=".*[\\/]src[\\/]test[\\/]"/>
<suppress checks="AvoidModifiersForTypes" files=".*[\\/]src[\\/]it[\\/]"/>
</suppressions>
12 changes: 3 additions & 9 deletions src/it/java/org/checkstyle/plugins/sonar/RunPluginTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,9 @@ public static void afterAll() {
}

@Test
public void testSonarExecution() {
try {
final MavenBuild build = testProjectBuild();
executeBuildWithCommonProperties(build, true);
}
catch (IOException exception) {
LOG.error("Build execution error.", exception);
fail("Failed to execute build.");
}
public void testSonarExecution() throws IOException {
final MavenBuild build = testProjectBuild();
executeBuildWithCommonProperties(build, true);
}

private static void executeBuildWithCommonProperties(Build<?> build, boolean buildQuietly)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.stream.Collectors;

import org.junit.Rule;
Expand Down Expand Up @@ -71,11 +72,11 @@ public void test() {
});
final List<String> duplicatedRuleWithTemplate = ruleCounts.entrySet().stream()
.filter(entry -> entry.getValue() > 1)
.map(entry -> entry.getKey())
.map(Entry::getKey)
.collect(Collectors.toList());
final List<String> rulesWithDuplicateTemplate = ruleCounts.entrySet().stream()
.filter(entry -> entry.getValue() == 1)
.map(entry -> entry.getKey())
.map(Entry::getKey)
.collect(Collectors.toList());
// such number should not change during checkstyle version upgrade
assertThat(duplicatedRuleWithTemplate).hasSize(0);
Expand Down

0 comments on commit 5d04f1d

Please sign in to comment.