Skip to content

Issue #13321: Kill mutation for TODOCommentCheck-1#13367

Merged
romani merged 1 commit intocheckstyle:masterfrom
Kevin222004:TODO
Jul 10, 2023
Merged

Issue #13321: Kill mutation for TODOCommentCheck-1#13367
romani merged 1 commit intocheckstyle:masterfrom
Kevin222004:TODO

Conversation

@Kevin222004
Copy link
Copy Markdown
Contributor

Issue #13321: Kill mutation for TODOCommentCheck-1


Check

https://checkstyle.org/checks/misc/todocomment.html#TodoComment


Mutation

<mutation unstable="false">
<sourceFile>TodoCommentCheck.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.TodoCommentCheck</mutatedClass>
<mutatedMethod>&lt;init&gt;</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator</mutator>
<description>removed call to java/util/regex/Pattern::compile</description>
<lineContent>private Pattern format = Pattern.compile(&quot;TODO:&quot;);</lineContent>
</mutation>
<mutation unstable="false">
<sourceFile>TodoCommentCheck.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.TodoCommentCheck</mutatedClass>
<mutatedMethod>&lt;init&gt;</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator</mutator>
<description>Removed assignment to member variable format</description>
<lineContent>private Pattern format = Pattern.compile(&quot;TODO:&quot;);</lineContent>
</mutation>


Explaination

Test added

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

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! The best type of mutation PRs!

@Vyom-Yadav Vyom-Yadav assigned romani and unassigned Vyom-Yadav Jul 8, 2023
@Vyom-Yadav Vyom-Yadav requested a review from romani July 8, 2023 07:31
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.

Item:

public class InputTodoCommentDefault {
int i;
public void method() {
i++; // TODO: do differently in future // violation 'Comment matches to-do format 'TODO:''
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.

As we targeting comment, please move // violation .... on line above or below and skip usage of TODO in message.
We should not mix them and we should see clearly what triggers violation.

Please keep this in mind for all comment and javadoc Checks .

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Screenshot from 2023-07-10 11-46-18
I am not sure why this is happening.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

may be

return new int[] {TokenTypes.COMMENT_CONTENT };

this needs to be TokenTypes.SingleLineComment and TokenTypes.BlockComment

I have worked with comment in fall-thru pr but i never face this in that pr

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

@romani romani merged commit 63d8289 into checkstyle:master Jul 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