Skip to content

Commit

Permalink
Issue checkstyle#11720: Kill surviving mutation in VariableDeclaratio…
Browse files Browse the repository at this point in the history
…nUsageDistanceCheck in searchVariableUsageExpressions
  • Loading branch information
Vyom-Yadav committed Jul 28, 2022
1 parent af99318 commit 3077c23
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 20 deletions.
18 changes: 0 additions & 18 deletions .ci/pitest-suppressions/pitest-coding-1-suppressions.xml
Expand Up @@ -233,22 +233,4 @@
<description>replaced call to com/puppycrawl/tools/checkstyle/api/DetailAST::findFirstToken with receiver</description>
<lineContent>.orElseGet(() -&gt; block.findFirstToken(TokenTypes.SWITCH_RULE));</lineContent>
</mutation>

<mutation unstable="false">
<sourceFile>VariableDeclarationUsageDistanceCheck.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.coding.VariableDeclarationUsageDistanceCheck</mutatedClass>
<mutatedMethod>searchVariableUsageExpressions</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator</mutator>
<description>removed call to com/puppycrawl/tools/checkstyle/api/DetailAST::getType</description>
<lineContent>&amp;&amp; currentStatementAst.getType() != TokenTypes.RCURLY) {</lineContent>
</mutation>

<mutation unstable="false">
<sourceFile>VariableDeclarationUsageDistanceCheck.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.coding.VariableDeclarationUsageDistanceCheck</mutatedClass>
<mutatedMethod>searchVariableUsageExpressions</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_IF</mutator>
<description>removed conditional - replaced equality check with true</description>
<lineContent>&amp;&amp; currentStatementAst.getType() != TokenTypes.RCURLY) {</lineContent>
</mutation>
</suppressedMutations>
Expand Up @@ -687,8 +687,7 @@ else if (variableUsageExpressions.isEmpty()) {
final List<DetailAST> variableUsageExpressions = new ArrayList<>();
int distance = 0;
DetailAST currentStatementAst = statementAst;
while (currentStatementAst != null
&& currentStatementAst.getType() != TokenTypes.RCURLY) {
while (currentStatementAst != null) {
if (currentStatementAst.getFirstChild() != null) {
if (isChild(currentStatementAst, variableAst)) {
variableUsageExpressions.add(currentStatementAst);
Expand Down

0 comments on commit 3077c23

Please sign in to comment.