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 #12326: Resolve Pitest suppression for AccessModifierOption #12340

Merged
merged 1 commit into from
Nov 23, 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-naming-suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,6 @@
<lineContent>curNode = curNode.getNextSibling();</lineContent>
</mutation>

<mutation unstable="false">
<sourceFile>AccessModifierOption.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.naming.AccessModifierOption</mutatedClass>
<mutatedMethod>getInstance</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.NakedReceiverMutator</mutator>
<description>replaced call to java/lang/String::trim with receiver</description>
<lineContent>return valueOf(AccessModifierOption.class, modifierName.trim().toUpperCase(Locale.ENGLISH));</lineContent>
</mutation>

<mutation unstable="false">
<sourceFile>ParameterNameCheck.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.naming.ParameterNameCheck</mutatedClass>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,17 @@ public void testSpecified()
getPath("InputParameterNameOne.java"), expected);
}

@Test
public void testWhitespaceInAccessModifierProperty() throws Exception {
final String pattern = "^h$";
final String[] expected = {
"14:69: " + getCheckMessage(MSG_INVALID_PATTERN, "parameter1", pattern),
"18:31: " + getCheckMessage(MSG_INVALID_PATTERN, "parameter2", pattern),
};
verifyWithInlineConfigParser(
getPath("InputParameterNameWhitespaceInAccessModifierProperty.java"), expected);
}

@Test
public void testDefault()
throws Exception {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
ParameterName
format = ^h$
ignoreOverridden = (default)false
accessModifiers = \tpublic
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config like this: public\t,\t,

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In other PR, we had public, \t, case taken from this PR is with tab character "on" the access modifier. The first trim in both methods took care of the single \t, the second trim takes care of the \t "on" the access modifier.



*/

package com.puppycrawl.tools.checkstyle.checks.naming.parametername;

public class InputParameterNameWhitespaceInAccessModifierProperty {

public InputParameterNameWhitespaceInAccessModifierProperty(int parameter1) {} // violation

public void v1(int h) { // ok
new Object () {
public void i(int parameter2) {} // violation
};
}

void method2(int V3) {}
}