Skip to content

Commit

Permalink
Issue #12430: Resolve Pitest suppression for SeparatorWrapCheck
Browse files Browse the repository at this point in the history
  • Loading branch information
arinmodi authored and rnveach committed Nov 22, 2022
1 parent d9f8c4b commit 55e09e5
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 9 deletions.
9 changes: 0 additions & 9 deletions .ci/pitest-suppressions/pitest-whitespace-suppressions.xml
Expand Up @@ -81,15 +81,6 @@
<lineContent>processLeft(ast.findFirstToken(TokenTypes.LPAREN));</lineContent>
</mutation>

<mutation unstable="false">
<sourceFile>SeparatorWrapCheck.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.whitespace.SeparatorWrapCheck</mutatedClass>
<mutatedMethod>visitToken</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator</mutator>
<description>replaced call to com/puppycrawl/tools/checkstyle/utils/CodePointUtil::trim with argument</description>
<lineContent>final int[] substringAfterToken = CodePointUtil.trim(</lineContent>
</mutation>

<mutation unstable="false">
<sourceFile>SingleSpaceSeparatorCheck.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.whitespace.SingleSpaceSeparatorCheck</mutatedClass>
Expand Down
4 changes: 4 additions & 0 deletions config/checkstyle_resources_suppressions.xml
Expand Up @@ -84,6 +84,10 @@
files="[\\/]InputRegexpTrailingComment10\.java"/>
<suppress id="noTrailingWhitespace"
files="[\\/]InputRegexpSinglelineJavaTrailingComment10\.java"/>

<!-- Input file contains trailing whitespace to kill pitest mutation -->
<suppress id="noTrailingWhitespace"
files="separatorwrap[\\/]InputSeparatorWrapForTestTrailingWhitespace\.java"/>

<!-- intentional problem for testing -->
<suppress checks="FileTabCharacter"
Expand Down
Expand Up @@ -139,4 +139,14 @@ public void testTrimOptionProperty() throws Exception {
verifyWithInlineConfigParser(
getPath("InputSeparatorWrapSetOptionTrim.java"), expected);
}

@Test
public void testCommaOnNewLine() throws Exception {
final String[] expected = {
"16:10: " + getCheckMessage(MSG_LINE_NEW, ","),
"21:26: " + getCheckMessage(MSG_LINE_NEW, ","),
};
verifyWithInlineConfigParser(
getPath("InputSeparatorWrapForTestTrailingWhitespace.java"), expected);
}
}
@@ -0,0 +1,30 @@
/*
SeparatorWrap
tokens = COMMA
option = nl
*/

package com.puppycrawl.tools.checkstyle.checks.whitespace.separatorwrap;

public class InputSeparatorWrapForTestTrailingWhitespace {

String s;

// Trailing whitespace after ',' in variable declaration
// violation below '',' should be on a new line.'
int a,
b;

// Trailing whitespace after ',' in function arguments
// violation below '',' should be on a new line.'
public void foo(int a,
int b) {
int r
, t; // OK
}

public void bar(int p
, int q) { // OK
}
}

0 comments on commit 55e09e5

Please sign in to comment.