Skip to content

Issue #13321: Kill mutation for SummaryJavaDocCheck-3#13313

Merged
romani merged 1 commit intocheckstyle:masterfrom
Kevin222004:s3
Jul 2, 2023
Merged

Issue #13321: Kill mutation for SummaryJavaDocCheck-3#13313
romani merged 1 commit intocheckstyle:masterfrom
Kevin222004:s3

Conversation

@Kevin222004
Copy link
Copy Markdown
Contributor

@Kevin222004 Kevin222004 commented Jun 26, 2023

Issue #13321: Kill mutation for SummaryJavaDocCheck-3


Check :-

https://checkstyle.org/checks/javadoc/summaryjavadoc.html#SummaryJavadoc


Mutation

<mutation unstable="false">
<sourceFile>SummaryJavadocCheck.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.javadoc.SummaryJavadocCheck</mutatedClass>
<mutatedMethod>getSummarySentence</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator</mutator>
<description>removed call to com/puppycrawl/tools/checkstyle/api/DetailNode::getType</description>
<lineContent>if (child.getType() == JavadocTokenTypes.JAVADOC_TAG) {</lineContent>
</mutation>
<mutation unstable="false">
<sourceFile>SummaryJavadocCheck.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.javadoc.SummaryJavadocCheck</mutatedClass>
<mutatedMethod>getSummarySentence</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_ELSE</mutator>
<description>removed conditional - replaced equality check with false</description>
<lineContent>if (child.getType() == JavadocTokenTypes.JAVADOC_TAG) {</lineContent>
</mutation>


Explaination

getSummaryDentence is used only at validateUntaggedSummary

Removal of

if (child.getType() == JavadocTokenTypes.JAVADOC_TAG) {
break;
}
will not make any issue the loop run 1 time more.

https://checkstyle.org/apidocs/com/puppycrawl/tools/checkstyle/api/JavadocTokenTypes.html#JAVADOC

according to this instead of loop stop at javadoc tag ot will stop at eof. and it doesn't effect output.

lets assume in case if we have code like this

    /** 
     *  Comment of java.
     *  
     *  @param a
     *  worst case test
     */
    public void foo1(int a) throws Exception {
    }

then worst case test become descripion which is also under javadoctag

    |   |   |   |       |--WS ->    [18:6]
    |   |   |   |       |--JAVADOC_TAG -> JAVADOC_TAG [18:8]
    |   |   |   |       |   |--PARAM_LITERAL -> @param [18:8]
    |   |   |   |       |   |--WS ->   [18:14]
    |   |   |   |       |   |--PARAMETER_NAME -> a [18:15]
    |   |   |   |       |   |--NEWLINE -> \n [18:16]
    |   |   |   |       |   `--DESCRIPTION -> DESCRIPTION [19:0]
    |   |   |   |       |       |--LEADING_ASTERISK ->      * [19:0]
    |   |   |   |       |       |--TEXT ->   worst case test [19:6]
    |   |   |   |       |       |--NEWLINE -> \n [19:23]
    |   |   |   |       |       `--TEXT ->       [20:0]
    |   |   |   |       `--EOF -> <EOF> [20:5]


Regression :-

Report-1 :- https://checkstyle-diff-reports.s3.us-east-2.amazonaws.com/58c7e7f_2023162747/reports/diff/index.html

Report-2 :- https://checkstyle-diff-reports.s3.us-east-2.amazonaws.com/58c7e7f_2023105658/reports/diff/index.html


Diff Regression config: https://gist.githubusercontent.com/Kevin222004/61eaa69fe98585b6ee1882ca082362bc/raw/316ca02ce9fd290119d9bfc560f2b11e84a1b685/Summary.xml
Diff Regression projects: https://gist.githubusercontent.com/Kevin222004/21e3934e85f802e2fbd48af06d122364/raw/604256badd733d8568064f371d55657c04b00dfd/test-projects-2.properties
Report label: change-config-Regression-1

@Kevin222004
Copy link
Copy Markdown
Contributor Author

Github, generate report

@github-actions
Copy link
Copy Markdown
Contributor

@Kevin222004 Kevin222004 changed the title Issue #13109: Kill mutation for SummaryJavaDocCheck-3 Issue #13321: Kill mutation for SummaryJavaDocCheck-3 Jun 28, 2023
@Kevin222004 Kevin222004 marked this pull request as ready for review June 28, 2023 07:19
@Kevin222004
Copy link
Copy Markdown
Contributor Author

Github, generate report

@Kevin222004
Copy link
Copy Markdown
Contributor Author

Github, generate report

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions
Copy link
Copy Markdown
Contributor

@Kevin222004
Copy link
Copy Markdown
Contributor Author

Github, generate report

@github-actions
Copy link
Copy Markdown
Contributor

Comment on lines +886 to +903


















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.

What's the reason for empty lines?

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.

Some sort of avoiding conflicts

Copy link
Copy Markdown
Member

@rdiachenko rdiachenko left a comment

Choose a reason for hiding this comment

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

lgtm

@rdiachenko rdiachenko assigned Vyom-Yadav and unassigned rdiachenko Jun 29, 2023
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.

LGTM!

@Vyom-Yadav Vyom-Yadav assigned romani and unassigned Vyom-Yadav Jul 2, 2023
@romani romani merged commit 46651a2 into checkstyle:master Jul 2, 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.

4 participants