Skip to content

Issue #13321: Kill mutation for JavadocMethod-7#13342

Merged
rnveach merged 2 commits into
checkstyle:masterfrom
Kevin222004:JDM7
Nov 13, 2023
Merged

Issue #13321: Kill mutation for JavadocMethod-7#13342
rnveach merged 2 commits into
checkstyle:masterfrom
Kevin222004:JDM7

Conversation

@Kevin222004

@Kevin222004 Kevin222004 commented Jul 2, 2023

Copy link
Copy Markdown
Contributor

Issue #13321: Kill mutation for JavadocMethod-7


Check :-

https://checkstyle.org/checks/javadoc/javadocmethod.html#JavadocMethod


Mutation

<mutation unstable="false">
<sourceFile>JavadocMethodCheck.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck</mutatedClass>
<mutatedMethod>getMethodTags</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator</mutator>
<description>removed call to com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck::calculateTagColumn</description>
<lineContent>final int col = calculateTagColumn(noargCurlyMatcher, i, startColumnNumber);</lineContent>
</mutation>
<mutation unstable="false">
<sourceFile>JavadocMethodCheck.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck</mutatedClass>
<mutatedMethod>getMethodTags</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator</mutator>
<description>replaced call to com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck::calculateTagColumn with argument</description>
<lineContent>final int col = calculateTagColumn(noargCurlyMatcher, i, startColumnNumber);</lineContent>
</mutation>


Explaination

no argsCurlyMatcher will execute and add the @inheritdoc in tags list.

getMethodsTag is called by only checkComment method in which all the condition in if and else use only ast.getline no not tag's coloum is used any where which we make it to 0

so their is no such use of tag column here


Regression :-


Diff Regression config: https://gist.githubusercontent.com/Kevin222004/df2ff7a8f9969bb2c68d7251a97ffa8b/raw/6a4e81a624fa36483f23b0adcf1fc513ca6df350/JavadocMethod.xml
Diff Regression projects: https://gist.githubusercontent.com/Kevin222004/c16e31ce9283effe5b7ca057999d1b58/raw/b7eda4dd43b3b3c0d9eeba3030e1a22993123b04/github-action-projects2.properties
Report label: Project-list-3

@Kevin222004

Copy link
Copy Markdown
Contributor Author

Github, generate report

@github-actions

github-actions Bot commented Jul 2, 2023

Copy link
Copy Markdown
Contributor

@Kevin222004

Copy link
Copy Markdown
Contributor Author

Github, generate report

@github-actions

github-actions Bot commented Jul 4, 2023

Copy link
Copy Markdown
Contributor

@Kevin222004 Kevin222004 force-pushed the JDM7 branch 2 times, most recently from 52722d2 to ad14bb7 Compare July 5, 2023 07:27
@Kevin222004 Kevin222004 marked this pull request as ready for review July 5, 2023 07:47
@Kevin222004 Kevin222004 marked this pull request as draft July 6, 2023 09:05
@nrmancuso

Copy link
Copy Markdown
Contributor

@Kevin222004 what do we need to do to get this PR out of draft mode?

@Kevin222004

Copy link
Copy Markdown
Contributor Author

Github, generate report

@github-actions

github-actions Bot commented Nov 8, 2023

Copy link
Copy Markdown
Contributor

@Kevin222004

Copy link
Copy Markdown
Contributor Author

Github, generate report

@github-actions

github-actions Bot commented Nov 8, 2023

Copy link
Copy Markdown
Contributor

@Kevin222004

Copy link
Copy Markdown
Contributor Author

Github, generate report

@github-actions

github-actions Bot commented Nov 8, 2023

Copy link
Copy Markdown
Contributor

@romani

romani commented Nov 9, 2023

Copy link
Copy Markdown
Member

@Kevin222004 , please update Checker suppression and convert PR to ready for review.

This is good example how we follow pitest to remove extra code in non AST based checks if regression can not find anything.
Such Checks will be rewritten in future projects. Java code will not be reused so this pitest activity extends our test base (that will be reused) or main code is shrinking.

This PR is referencing old issue, it is ok.

I put this PR as example to #13999

@romani romani left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ok to merge

@romani

romani commented Nov 11, 2023

Copy link
Copy Markdown
Member

hmm, unrelated pitest:
https://github.com/checkstyle/checkstyle/actions/runs/6831156451/job/18580202698?pr=13342#step:7:15

patch -p1 << EOF
diff --git a/config/pitest-suppressions/pitest-common-suppressions.xml b/config/pitest-suppressions/pitest-common-suppressions.xml
index fe31289..47a734a 100644
--- a/config/pitest-suppressions/pitest-common-suppressions.xml
+++ b/config/pitest-suppressions/pitest-common-suppressions.xml
@@ -9,6 +9,15 @@
     <lineContent>final String stripped = CommonUtil.relativizeAndNormalizePath(basedir, fileName);</lineContent>
   </mutation>
 
+  <mutation unstable="false">
+    <sourceFile>Checker.java</sourceFile>
+    <mutatedClass>com.puppycrawl.tools.checkstyle.Checker</mutatedClass>
+    <mutatedMethod>finishLocalSetup</mutatedMethod>
+    <mutator>org.pitest.mutationtest.engine.gregor.mutators.VoidMethodCallMutator</mutator>
+    <description>removed call to com/puppycrawl/tools/checkstyle/LocalizedMessage::setLocale</description>
+    <lineContent>LocalizedMessage.setLocale(locale);</lineContent>
+  </mutation>
+
   <mutation unstable="false">
     <sourceFile>Checker.java</sourceFile>
     <mutatedClass>com.puppycrawl.tools.checkstyle.Checker</mutatedClass>
EOF

@Kevin222004

Kevin222004 commented Nov 11, 2023

Copy link
Copy Markdown
Contributor Author

I am looking on that #13342 (comment)

@Kevin222004

Copy link
Copy Markdown
Contributor Author

In my local no new surviving is found so probably it will pass as it is re-run

@rnveach rnveach requested a review from nrmancuso November 11, 2023 21:25
@rnveach rnveach assigned nrmancuso and unassigned rnveach Nov 11, 2023

@nrmancuso nrmancuso left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Provided explanation is incorrect, we use the column number from the collection of tags in a bunch of places. Examples:

I see no real evidence that this mutation can't be killed by test input.

However, I am good to merge this update; we have a bunch of clean regression tests, and potential ROI for finding some obscure test case in probably not worth it.

@nrmancuso nrmancuso assigned rnveach and unassigned nrmancuso Nov 13, 2023
@rnveach rnveach merged commit 26d37d2 into checkstyle:master Nov 13, 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.

5 participants