Skip to content

Issue #13501: Kill mutation for JavadocContentLocationCheck#13517

Merged
romani merged 1 commit intocheckstyle:masterfrom
Kevin222004:JDCL
Aug 10, 2023
Merged

Issue #13501: Kill mutation for JavadocContentLocationCheck#13517
romani merged 1 commit intocheckstyle:masterfrom
Kevin222004:JDCL

Conversation

@Kevin222004
Copy link
Copy Markdown
Contributor

@Kevin222004 Kevin222004 commented Aug 5, 2023

Issue #13501: Kill mutation for JavadocContentLocationCheck


Check

https://checkstyle.org/checks/javadoc/javadoccontentlocation.html#JavadocContentLocation


Mutation

<mutation unstable="false">
<sourceFile>JavadocContentLocationCheck.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocContentLocationCheck</mutatedClass>
<mutatedMethod>&lt;init&gt;</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator</mutator>
<description>Removed assignment to member variable location</description>
<lineContent>private JavadocContentLocationOption location = JavadocContentLocationOption.SECOND_LINE;</lineContent>
</mutation>


Explaintaion

private JavadocContentLocationOption location = JavadocContentLocationOption.SECOND_LINE;

This line of code is mutated as
private JavadocContentLocationOption location;
know this changes will not affect the check functionality becuase the current logic here in visitToken
if (location == JavadocContentLocationOption.FIRST_LINE) {
if (indexOfFirstNonBlankLine != 0) {
log(ast, MSG_JAVADOC_CONTENT_FIRST_LINE);
}
}
else if (indexOfFirstNonBlankLine != 1) {
log(ast, MSG_JAVADOC_CONTENT_SECOND_LINE);
}

here in if condition we check if option is JavadocContentLocationOption.FIRST_LINE but for default/JavadocContentLocationOption.SECOND_LINE we don't have any condition so as result whether on line 170
private JavadocContentLocationOption location = JavadocContentLocationOption.SECOND_LINE; it will not affect if we write it as private JavadocContentLocationOption location;.

In my opinion this might not be the good design Thats why I have change the logic.


Regression

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

Report-2 :-


Diff Regression config: https://gist.githubusercontent.com/Kevin222004/56384ed9cfdddef897ec082ec71ad650/raw/246172cbe8caeca3a236d319b014417f5770442e/JavadocContentLocation.xml
Diff Regression projects: https://gist.githubusercontent.com/Kevin222004/9600f179b602d4c971bdb0a050099005/raw/360a95ed7bb60d7a0956e531199d484c4d6f6617/test-projects.properties
Report label: Report-2

@Kevin222004
Copy link
Copy Markdown
Contributor Author

#13517 (comment)
I am also fine with the removal of code .

@romani
Copy link
Copy Markdown
Member

romani commented Aug 5, 2023

Please share reports, to let us start reviewing.

@Kevin222004
Copy link
Copy Markdown
Contributor Author

Github, generate report

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Aug 5, 2023

@Kevin222004
Copy link
Copy Markdown
Contributor Author

Github, generate report

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Aug 6, 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

@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 Aug 9, 2023
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 Aug 10, 2023
@romani romani merged commit 8134680 into checkstyle:master Aug 10, 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