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

Resolve Pitest suppression for ParenPad #12282

Closed
Kevin222004 opened this issue Oct 9, 2022 · 6 comments
Closed

Resolve Pitest suppression for ParenPad #12282

Kevin222004 opened this issue Oct 9, 2022 · 6 comments

Comments

@Kevin222004
Copy link
Collaborator

Kevin222004 commented Oct 9, 2022

Related to #7797

kill mutation

<mutation unstable="false">
<sourceFile>ParenPadCheck.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.whitespace.ParenPadCheck</mutatedClass>
<mutatedMethod>visitToken</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.RemoveSwitchMutator_3</mutator>
<description>RemoveSwitch 3 mutation</description>
<lineContent>switch (ast.getType()) {</lineContent>
</mutation>

@Kevin222004
Copy link
Collaborator Author

Kevin222004 commented Oct 20, 2022

@rnveach We have currently this line of code which is mutated

and the source code for this mutated code is just to remove it

@rnveach
Copy link
Member

rnveach commented Oct 20, 2022

the source code for this mutated code is just to remove it

The mutation is not to remove it.
https://github.com/checkstyle/checkstyle/wiki/How-to-Generate-and-Analyze-Pitest-Reports#experimental-switch-mutator

We change each label to the default label
This mutation will change the 0th index case label and put it into the default label list.

Wiki saying remove it is not correct, but we change case and move it to default.

@Kevin222004
Copy link
Collaborator Author

@rnveach yes we don't have to remove the switch case according to wiki I have also done like that before. and know it is clear to me

when we are making the changes like that I am getting errors in three input file i am sharing one with you

String foo() {
return ( (Object // violation
) bar( ( 1 > 2 ) ? // 3 violations
( ( 3 < 4 )? false : true ) : // 4 violations
( ( 1 == 1 ) ? false : true) ) ).toString(); // 5 violations

here the violation is missing in line 125 at 2 places
according to the current scenario checkstyle don't generate the violation for any case for QUESTION I just want to know it is expected a violation in such condition like line no 126 in same file according to its config comment msg

@rnveach
Copy link
Member

rnveach commented Oct 20, 2022

If you make a change to mimic a mutation and our test fails, then either the mutation you applied isn't correct or there is more going on with pitest than the mutation alone (caching, etc...). Normally tests do not fail with the mutation applied.

Please provide me the step by step we request. Provide me the mutated branch pushed to the server and paste the URL here. Let me know if tests fail with the mutation applied.

@romani
Copy link
Member

romani commented Oct 21, 2022

Please send PR with mutation to let us see all details.

Please try to remove all other "case" one by one.

@rnveach
Copy link
Member

rnveach commented Oct 22, 2022

Fix was merged, complex understanding of pitest is at #12318 (comment) and simpler understanding at #12318 (comment)

@rnveach rnveach closed this as completed Oct 22, 2022
@rnveach rnveach added this to the 10.3.5 milestone Oct 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

No branches or pull requests

3 participants