Skip to content

Commit

Permalink
Issue checkstyle#12267: Resolve Pitest suppression for SeperatorWrapC…
Browse files Browse the repository at this point in the history
…heck
  • Loading branch information
Kevin222004 committed Oct 7, 2022
1 parent 5ebdef4 commit 5d2f010
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 19 deletions.
18 changes: 0 additions & 18 deletions .ci/pitest-suppressions/pitest-whitespace-suppressions.xml
Expand Up @@ -153,24 +153,6 @@
<lineContent>switch (ast.getType()) {</lineContent>
</mutation>

<mutation unstable="false">
<sourceFile>SeparatorWrapCheck.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.whitespace.SeparatorWrapCheck</mutatedClass>
<mutatedMethod>setOption</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.NakedReceiverMutator</mutator>
<description>replaced call to java/lang/String::toUpperCase with receiver</description>
<lineContent>option = WrapOption.valueOf(optionStr.trim().toUpperCase(Locale.ENGLISH));</lineContent>
</mutation>

<mutation unstable="false">
<sourceFile>SeparatorWrapCheck.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.whitespace.SeparatorWrapCheck</mutatedClass>
<mutatedMethod>setOption</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.NakedReceiverMutator</mutator>
<description>replaced call to java/lang/String::trim with receiver</description>
<lineContent>option = WrapOption.valueOf(optionStr.trim().toUpperCase(Locale.ENGLISH));</lineContent>
</mutation>

<mutation unstable="false">
<sourceFile>SeparatorWrapCheck.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.whitespace.SeparatorWrapCheck</mutatedClass>
Expand Down
Expand Up @@ -131,4 +131,12 @@ public void testWithEmoji() throws Exception {
getPath("InputSeparatorWrapWithEmoji.java"), expected);
}

@Test
public void testTrimOptionProperty() throws Exception {
final String[] expected = {
"18:56: " + getCheckMessage(MSG_LINE_NEW, "::"),
};
verifyWithInlineConfigParser(
getPath("InputSeparatorWrapSetOptionTrim.java"), expected);
}
}
@@ -1,6 +1,6 @@
/*
SeparatorWrap
option = NL
option = nl
tokens = DOT
Expand Down
@@ -0,0 +1,21 @@
/*
SeparatorWrap
option = \tNL
tokens = METHOD_REF
*/

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

import java.util.Arrays;

public class InputSeparatorWrapSetOptionTrim {

void Method() {
String[] stringArray = { "Barbara", "James", "Mary", "John",
"Patricia", "Linda" }; // violation below ''::' should be on a new line'
/* violation */ Arrays.sort(stringArray, String::
compareToIgnoreCase);
}
}

0 comments on commit 5d2f010

Please sign in to comment.