Skip to content

Issue #13672: Kill mutation using utility class#13800

Merged
romani merged 1 commit intocheckstyle:masterfrom
Kevin222004:MutationKilledUsingUtil
Sep 30, 2023
Merged

Issue #13672: Kill mutation using utility class#13800
romani merged 1 commit intocheckstyle:masterfrom
Kevin222004:MutationKilledUsingUtil

Conversation

@Kevin222004
Copy link
Copy Markdown
Contributor

Issue #13672: Kill mutation using utility class

@romani
Copy link
Copy Markdown
Member

romani commented Sep 29, 2023

Pitest is not happy

@Kevin222004 Kevin222004 force-pushed the MutationKilledUsingUtil branch from 6e1a711 to ba69205 Compare September 29, 2023 15:26
@romani
Copy link
Copy Markdown
Member

romani commented Sep 29, 2023

Still problem

@Kevin222004 Kevin222004 force-pushed the MutationKilledUsingUtil branch from ba69205 to b878463 Compare September 29, 2023 16:32
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

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.

One doubt:

<param>com.puppycrawl.tools.checkstyle.checks.coding.IllegalTypeCheckTest</param>
</targetTests>
<avoidCallsTo>
<avoidCallsTo>org.apache.commons.logging</avoidCallsTo>
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.

Why avoid calls to Apache logging?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

By default when avoidCallsTo is not used then pit will by default avoid it but when we explicitly applied it will not be considered
https://pitest.org/quickstart/maven/#:~:text=If%20a%20list%20is%20not%20explicitly%20supplied%20then%20PIT%20will%20default%20to%20a%20list%20of%20common%20logging%20packages%20as%20follows

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.

this actually required:

$ git diff
diff --git a/config/pitest-suppressions/pitest-common-suppressions.xml b/config/pitest-suppressions/pitest-common-suppressions.xml
index 4041118..34258c9 100644
--- a/config/pitest-suppressions/pitest-common-suppressions.xml
+++ b/config/pitest-suppressions/pitest-common-suppressions.xml
@@ -85,6 +85,24 @@
     <sourceFile>Checker.java</sourceFile>
     <mutatedClass>com.puppycrawl.tools.checkstyle.Checker</mutatedClass>
     <mutatedMethod>processFile</mutatedMethod>
+    <mutator>org.pitest.mutationtest.engine.gregor.mutators.VoidMethodCallMutator</mutator>
+    <description>removed call to org/apache/commons/logging/Log::debug</description>
+    <lineContent>log.debug(&quot;Exception occurred.&quot;, ex);</lineContent>
+  </mutation>
+
+  <mutation unstable="false">
+    <sourceFile>Checker.java</sourceFile>
+    <mutatedClass>com.puppycrawl.tools.checkstyle.Checker</mutatedClass>
+    <mutatedMethod>processFile</mutatedMethod>
+    <mutator>org.pitest.mutationtest.engine.gregor.mutators.VoidMethodCallMutator</mutator>
+    <description>removed call to org/apache/commons/logging/Log::debug</description>
+    <lineContent>log.debug(&quot;IOException occurred.&quot;, ioe);</lineContent>
+  </mutation>
+
+  <mutation unstable="false">
+    <sourceFile>Checker.java</sourceFile>
+    <mutatedClass>com.puppycrawl.tools.checkstyle.Checker</mutatedClass>
+    <mutatedMethod>processFile</mutatedMethod>
     <mutator>org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator</mutator>
     <description>removed call to java/io/IOException::getMessage</description>
     <lineContent>new String[] {ioe.getMessage()}, null, getClass(), null));</lineContent>
diff --git a/pom.xml b/pom.xml
index 70f3a90..7be5ccf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4365,7 +4365,6 @@
                 <param>com.puppycrawl.tools.checkstyle.checks.coding.IllegalTypeCheckTest</param>
               </targetTests>
               <avoidCallsTo>
-                <avoidCallsTo>org.apache.commons.logging</avoidCallsTo>
                 <avoidCallsTo>com.puppycrawl.tools.checkstyle.utils.UnmodifiableCollectionUtil</avoidCallsTo>
               </avoidCallsTo>
               <excludedMethods>

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.

Resolved

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.

LGTM!

@romani romani merged commit 56af761 into checkstyle:master Sep 30, 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.

3 participants