Skip to content

Issue #13109: Kill mutation for UnusedLocalVariableCheck 1#13144

Merged
rdiachenko merged 1 commit intocheckstyle:masterfrom
Kevin222004:ul1
Jun 6, 2023
Merged

Issue #13109: Kill mutation for UnusedLocalVariableCheck 1#13144
rdiachenko merged 1 commit intocheckstyle:masterfrom
Kevin222004:ul1

Conversation

@Kevin222004
Copy link
Copy Markdown
Contributor

@Kevin222004 Kevin222004 commented Jun 3, 2023

Issue #13109: Kill mutation for UnusedLocalVariableCheck 1

Covering

<mutation unstable="false">
<sourceFile>UnusedLocalVariableCheck.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.coding.UnusedLocalVariableCheck</mutatedClass>
<mutatedMethod>&lt;init&gt;</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator</mutator>
<description>Removed assignment to member variable depth</description>
<lineContent>depth = 0;</lineContent>
</mutation>
<mutation unstable="false">
<sourceFile>UnusedLocalVariableCheck.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.coding.UnusedLocalVariableCheck</mutatedClass>
<mutatedMethod>&lt;init&gt;</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator</mutator>
<description>Removed assignment to member variable packageName</description>
<lineContent>packageName = null;</lineContent>
</mutation>

Explanation:-
The values are initialized in the constructor and they are default values so no changes would be there after the removal.

Diff Regression config: https://gist.githubusercontent.com/Kevin222004/0dbdfb487f8e9a050ed0e6356f1a35b4/raw/31f7927f400e11e4285e86fd086b373095227848/unusedLocal.xml
Diff Regression projects: https://gist.githubusercontent.com/Kevin222004/ba19d7151a6a0fa19dd55d1442f4b756/raw/d672a5aa0d6e30f539c6556af3c50c9e9433e9a8/intellij.properties
Report label: Regression on intellij

@Kevin222004
Copy link
Copy Markdown
Contributor Author

Github, generate report

@romani
Copy link
Copy Markdown
Member

romani commented Jun 4, 2023

@Kevin222004 , please fix Checker failure.
<message>the constructor does not initialize fields: packageName</message>

Removal from ctor is good, we create Check ones for execution. If values are default for jdk , they can be omitted or done at field declaration

@Kevin222004
Copy link
Copy Markdown
Contributor Author

I have started regression

Copy link
Copy Markdown
Member

@romani romani left a comment

Choose a reason for hiding this comment

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

ok to merge

@Kevin222004
Copy link
Copy Markdown
Contributor Author

Reason to suppress checker similar as #13158 (comment)

@Kevin222004
Copy link
Copy Markdown
Contributor Author

Copy link
Copy Markdown
Member

@Vyom-Yadav Vyom-Yadav left a comment

Choose a reason for hiding this comment

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

We aren't targeting checker suppressions anyway, I am ok with checker suppression.

@Kevin222004
Copy link
Copy Markdown
Contributor Author

Kevin222004 commented Jun 5, 2023

@Kevin222004
Copy link
Copy Markdown
Contributor Author

Github, generate report

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jun 5, 2023

@Kevin222004
Copy link
Copy Markdown
Contributor Author

@Vyom-Yadav
Copy link
Copy Markdown
Member

#13144 (comment) looks like bug in existing version https://gist.githubusercontent.com/Kevin222004/30029098f8498ffa093d05e857785562/raw/05fc6a6fb41b76aef355f6a396d5e5c8c4598888/check.txt

Yes, please open an issue for it with the case that is causing NPE.

@rdiachenko
Copy link
Copy Markdown
Member

Yes, please open an issue for it with the case that is causing NPE.

@Kevin222004 please give a link to the opened issue.

@Kevin222004
Copy link
Copy Markdown
Contributor Author

Yes, please open an issue for it with the case that is causing NPE.

@Kevin222004 please give a link to the opened issue.

#13167

Copy link
Copy Markdown
Member

@rdiachenko rdiachenko left a comment

Choose a reason for hiding this comment

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

lgtm

@rdiachenko rdiachenko merged commit bf99e06 into checkstyle:master Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants