Issue #13109: Kill mutation for FullIdent.java-2#13179
Issue #13109: Kill mutation for FullIdent.java-2#13179romani merged 1 commit intocheckstyle:masterfrom
Conversation
|
Ci failure is not related to changes only test added |
|
@romani This is ready fir review |
|
This class is mistake to be in API. Better to find way to cover it by Inputs. |
Agreed. FullIdent is used by a lot of checks, used even in sevntu. You can find such a list here: |
|
@Kevin222004 could you resolve the conflict please and follow @Vyom-Yadav's suggestion to test it. Your current approach doesn't use any checks, you need a check which uses FullIdent class and input for that check to write a proper test. |
60a4eef to
13a3756
Compare
|
@rdiachenko Please check i have updated branch |
| @@ -0,0 +1 @@ | |||
| import.ordering=Wrong order for ''{0}'' import. | |||
There was a problem hiding this comment.
- Why do we include message properties specific to
import.orderingonly into main resources but not the test ones? - Do we need all the locals to do testing or it's just enough to use a single message properties to test the case?
There was a problem hiding this comment.
-
I have just followed all the check, to throw the message in all the check it is on the resources of main, so I also put it in the resource section of main
-
import.orderingis only one which is require to throw the violation message at least for the test which I write so single message property is fine
There was a problem hiding this comment.
- But it's a copy paste of existing properties into a different directory under main (non test) resources. @romani why do we allow this?
- Why do you need all those
messages_XX.properties, shouldn't a single file be enough?
There was a problem hiding this comment.
@rdiachenko for second question
[INFO]
[INFO] --- maven-antrun-plugin:3.1.0:run (ant-phase-verify) @ checkstyle ---
[INFO] Executing tasks
[INFO] [echo] Checkstyle started (checkstyle-checks.xml): 22/06/2023 06:47:12 pm
[INFO] [checkstyle] Running Checkstyle on 1626 files
[ERROR] [checkstyle] [ERROR] /home/kevin/Desktop/check_style/checkstyle/checkstyle/src/main/resources/com/puppycrawl/tools/checkstyle/api:1: Properties file 'messages_de.properties' is missing. [Translation]
[ERROR] [checkstyle] [ERROR] /home/kevin/Desktop/check_style/checkstyle/checkstyle/src/main/resources/com/puppycrawl/tools/checkstyle/api:1: Properties file 'messages_fi.properties' is missing. [Translation]
[ERROR] [checkstyle] [ERROR] /home/kevin/Desktop/check_style/checkstyle/checkstyle/src/main/resources/com/puppycrawl/tools/checkstyle/api:1: Properties file 'messages_ru.properties' is missing. [Translation]
[ERROR] [checkstyle] [ERROR] /home/kevin/Desktop/check_style/checkstyle/checkstyle/src/main/resources/com/puppycrawl/tools/checkstyle/api:1: Properties file 'messages_pt.properties' is missing. [Translation]
[ERROR] [checkstyle] [ERROR] /home/kevin/Desktop/check_style/checkstyle/checkstyle/src/main/resources/com/puppycrawl/tools/checkstyle/api:1: Properties file 'messages_ja.properties' is missing. [Translation]
[ERROR] [checkstyle] [ERROR] /home/kevin/Desktop/check_style/checkstyle/checkstyle/src/main/resources/com/puppycrawl/tools/checkstyle/api:1: Properties file 'messages_fr.properties' is missing. [Translation]
[ERROR] [checkstyle] [ERROR] /home/kevin/Desktop/check_style/checkstyle/checkstyle/src/main/resources/com/puppycrawl/tools/checkstyle/api:1: Properties file 'messages_es.properties' is missing. [Translation]
[ERROR] [checkstyle] [ERROR] /home/kevin/Desktop/check_style/checkstyle/checkstyle/src/main/resources/com/puppycrawl/tools/checkstyle/api:1: Properties file 'messages_tr.properties' is missing. [Translation]
[ERROR] [checkstyle] [ERROR] /home/kevin/Desktop/check_style/checkstyle/checkstyle/src/main/resources/com/puppycrawl/tools/checkstyle/api:1: Properties file 'messages_zh.properties' is missing. [Translation]
[INFO] [echo] Checkstyle finished (checkstyle-checks.xml) : 22/06/2023 06:48:19 pm
it give error
There was a problem hiding this comment.
Considering that FullIdent is used by other checks, it should already be covered by the tests of those checks. I just did what pitest suggested, removed .getFirstChild() and run tests in EqualsHashCodeCheckTest. Many of them failed.
@romani why can't we make that test as part of pitest-api profile?
@Kevin222004 could you try to extend pitest-api profile with additional test class in the pom.xml?
git diff pom.xml
diff --git a/pom.xml b/pom.xml
index 6bbbdfc62..92b07ca5d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4604,6 +4604,7 @@
<param>com.puppycrawl.tools.checkstyle.api.*</param>
<!-- 1% mutation in FullIdent -->
<param>com.puppycrawl.tools.checkstyle.checks.coding.UnusedLocalVariableCheckTest</param>
+ <param>com.puppycrawl.tools.checkstyle.checks.coding.EqualsHashCodeCheckTest</param>
<!-- 1% mutation in CheckUtil -->
<param>com.puppycrawl.tools.checkstyle.checks.OuterTypeFilenameCheckTest</param>
<param>org.checkstyle.suppressionxpathfilter.XpathRegressionUnusedLocalVariableTest</param>
There was a problem hiding this comment.
Yes sure I will do that
There was a problem hiding this comment.
I also not have any issue to following thing that i done.
if everyone will not agree on #13179 (comment)
No changes should done in src/main/resources folder at all.
I update this soon
There was a problem hiding this comment.
This class is not API. Unfortunately leaked a long time ago. It is pure implementation and code in this implementation is not required by any of our Checks , it should be removed.
One day in future we will remove this class from API, it should be just another internal class.
9289aa9 to
80777b6
Compare
|
@Kevin222004 please resolve conflicts in the meantime. |
| @Test | ||
| public void testCreateFullIdentBelow2() throws Exception { | ||
| final DefaultConfiguration checkConfig = createModuleConfig(ImportOrderCheck.class); | ||
| final String[] expected = { | ||
| "3:1: " + getCheckMessage(ImportOrderCheck.class, | ||
| MSG_ORDERING, "java.util.HashMap"), | ||
| }; | ||
|
|
||
| verify(checkConfig, getPath("InputFullIdent.java"), | ||
| expected); | ||
| } |
There was a problem hiding this comment.
Why haven't we used the InlineConfigParser?
There was a problem hiding this comment.
done removed verify method.
3784688 to
8a20f5b
Compare
Issue #13109: Kill mutation for FullIdent.java-2
Mutation covered
checkstyle/config/pitest-suppressions/pitest-api-suppressions.xml
Lines 48 to 55 in b8753a7