Issue #7877: Removed redundant conditional #9307
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #7877
Pitest Report before fix: https://bossever.github.io/issue7877/pit-reports/202102122217/com.puppycrawl.tools.checkstyle.checks.imports/ImportOrderCheck.java.html#org.pitest.mutationtest.report.html.SourceFile@476dda8b_878
Hardcoded mutation on line 878:
removed conditional - replaced equality check with true → SURVIVED
Pitest Report after fix: https://bossever.github.io/issue7877/pit-reports/202102182308/com.puppycrawl.tools.checkstyle.checks.imports/index.html
Rationale behind removing
!beforeFirstImport
I tried coming up with test cases where the mutation could be killed, but came to the conclusion that there exists no such test case, please read comment on issue - #7877 (comment).
As @nmancus1 has pointed out in issue conversation, I suppose this condition can be safely removed if no test cases were found, and
mvn clean verify
is passing.Please let me know if I have missed anything, or if there is another way to fix this issue.
Diff Regression config: https://gist.githubusercontent.com/bossever/ff126a13b0f1422daa5626db6fcdc384/raw/96d1898cdc28233c7a7fef6b3f855b939b2cf694/config.xml
Diff Regression projects: https://gist.githubusercontent.com/bossever/ff126a13b0f1422daa5626db6fcdc384/raw/6e8f8cbf0eb40baaf072ec9a3fe93883614709a9/projects-to-test-on.properties
Report label: Diff Regression Report after fix