Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #12430: Resolve Pitest suppression for SeparatorWrapCheck #12432

Merged
merged 1 commit into from
Nov 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 0 additions & 9 deletions .ci/pitest-suppressions/pitest-whitespace-suppressions.xml
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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);
}
}
Original file line number Diff line number Diff line change
@@ -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
}
}