Skip to content

Commit fcfeaeb

Browse files
committed
Issue #122: Added support for multiple instances of same check
1 parent cf419b3 commit fcfeaeb

File tree

17 files changed

+306
-227
lines changed

17 files changed

+306
-227
lines changed

.gitattributes

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
# All files default to text with LF line endings
2+
* text eol=lf
3+
4+
# Windows files always have CRLF eol
5+
*.cmd text eol=crlf
6+
17
# Test resources that need specific eol
28
src/test/resources/org/checkstyle/autofix/recipe/newlineatendoffile/** -text
3-
4-
# Force LF line endings for diff test files
5-
*.diff text eol=lf

config/pitest-suppressions.xml

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,15 @@
460460
<lineContent>header = config.getProperty(HEADER_PROPERTY);</lineContent>
461461
</mutation>
462462

463+
<mutation unstable="false">
464+
<sourceFile>Header.java</sourceFile>
465+
<mutatedClass>org.checkstyle.autofix.recipe.Header</mutatedClass>
466+
<mutatedMethod>extractLicenseHeader</mutatedMethod>
467+
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator</mutator>
468+
<description>replaced call to org/checkstyle/autofix/recipe/Header::toLfLineEnding with argument</description>
469+
<lineContent>header = toLfLineEnding(Files.readString(Path.of(headerFilePath), charsetToUse));</lineContent>
470+
</mutation>
471+
463472
<mutation unstable="false">
464473
<sourceFile>Header.java</sourceFile>
465474
<mutatedClass>org.checkstyle.autofix.recipe.Header</mutatedClass>
@@ -487,6 +496,15 @@
487496
<lineContent>return &quot;Adds headers to Java source files when missing.&quot;;</lineContent>
488497
</mutation>
489498

499+
<mutation unstable="false">
500+
<sourceFile>Header.java</sourceFile>
501+
<mutatedClass>org.checkstyle.autofix.recipe.Header</mutatedClass>
502+
<mutatedMethod>toLfLineEnding</mutatedMethod>
503+
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.NakedReceiverMutator</mutator>
504+
<description>replaced call to java/lang/String::replaceAll with receiver</description>
505+
<lineContent>return text.replaceAll(&quot;(?x)\\\\r(?=\\\\n)|\\r(?=\\n)&quot;, &quot;&quot;);</lineContent>
506+
</mutation>
507+
490508
<mutation unstable="false">
491509
<sourceFile>Header.java</sourceFile>
492510
<mutatedClass>org.checkstyle.autofix.recipe.Header</mutatedClass>
@@ -505,13 +523,22 @@
505523
<lineContent>return violations.removeIf(violation -&gt; {</lineContent>
506524
</mutation>
507525

526+
<mutation unstable="false">
527+
<sourceFile>Header.java</sourceFile>
528+
<mutatedClass>org.checkstyle.autofix.recipe.Header$HeaderVisitor</mutatedClass>
529+
<mutatedMethod>lambda$extractCurrentHeader$0</mutatedMethod>
530+
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator</mutator>
531+
<description>replaced call to org/checkstyle/autofix/recipe/Header::toLfLineEnding with argument</description>
532+
<lineContent>+ toLfLineEnding(comment.getSuffix());</lineContent>
533+
</mutation>
534+
508535
<mutation unstable="false">
509536
<sourceFile>Header.java</sourceFile>
510537
<mutatedClass>org.checkstyle.autofix.recipe.Header$HeaderVisitor</mutatedClass>
511538
<mutatedMethod>lambda$extractCurrentHeader$0</mutatedMethod>
512539
<mutator>org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator</mutator>
513540
<description>removed call to org/checkstyle/autofix/recipe/Header$HeaderVisitor::getCursor</description>
514-
<lineContent>return comment.printComment(getCursor()) + comment.getSuffix();</lineContent>
541+
<lineContent>return comment.printComment(getCursor())</lineContent>
515542
</mutation>
516543

517544
<mutation unstable="false">
@@ -1303,7 +1330,7 @@
13031330
<mutatedMethod>parseErrorTag</mutatedMethod>
13041331
<mutator>org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator</mutator>
13051332
<description>removed call to java/util/Optional::empty</description>
1306-
<lineContent>Optional&lt;CheckstyleCheck&gt; source = Optional.empty();</lineContent>
1333+
<lineContent>Optional&lt;CheckstyleCheck&gt; check = Optional.empty();</lineContent>
13071334
</mutation>
13081335

13091336
<mutation unstable="false">
@@ -1312,7 +1339,7 @@
13121339
<mutatedMethod>parseErrorTag</mutatedMethod>
13131340
<mutator>org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_IF</mutator>
13141341
<description>removed conditional - replaced equality check with true</description>
1315-
<lineContent>if (source.isPresent()) {</lineContent>
1342+
<lineContent>if (check.isPresent()) {</lineContent>
13161343
</mutation>
13171344

13181345
<mutation unstable="false">

0 commit comments

Comments
 (0)