Skip to content

Commit

Permalink
Issue #12264: Resolve Pitest suppression for MethodParamPadCheck
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin222004 authored and rnveach committed Oct 7, 2022
1 parent 4f9c2a4 commit 34d8e15
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 9 deletions.
9 changes: 0 additions & 9 deletions .ci/pitest-suppressions/pitest-whitespace-suppressions.xml
Expand Up @@ -99,15 +99,6 @@
<lineContent>depth = 0;</lineContent>
</mutation>

<mutation unstable="false">
<sourceFile>MethodParamPadCheck.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.whitespace.MethodParamPadCheck</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 = PadOption.valueOf(optionStr.trim().toUpperCase(Locale.ENGLISH));</lineContent>
</mutation>

<mutation unstable="false">
<sourceFile>ParenPadCheck.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.whitespace.ParenPadCheck</mutatedClass>
Expand Down
Expand Up @@ -200,4 +200,13 @@ public void testInvalidOption() throws Exception {
}
}

@Test
public void testTrimOptionProperty() throws Exception {
final String[] expected = {
"15:24: " + getCheckMessage(MSG_WS_NOT_PRECEDED, "("),
"26:27: " + getCheckMessage(MSG_WS_NOT_PRECEDED, "("),
};
verifyWithInlineConfigParser(
getPath("InputMethodParamPadSetOptionTrim.java"), expected);
}
}
@@ -0,0 +1,32 @@
/*
MethodParamPad
allowLineBreaks = (default)false
option = \tspace
tokens = (default)CTOR_DEF, LITERAL_NEW, METHOD_CALL, METHOD_DEF, SUPER_CTOR_CALL, \
ENUM_CONSTANT_DEF, RECORD_DEF
*/

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

public class InputMethodParamPadSetOptionTrim {

public void method1() { // violation ''(' is not preceded with whitespace'
int a = 1, b = 2;
if (a > b) {
System.out.println (a);
}
}

public int method2 () { // ok
return 1;
}

public Boolean method3() { // violation ''(' is not preceded with whitespace'
if (4 < 5) {
return true;
}
return false;
}
}

0 comments on commit 34d8e15

Please sign in to comment.