Skip to content

Resolve Pitest Suppression in Pitest-Javadoc Profile #13999

Closed

Description

@Kevin222004

As a part of this issue, we have to kill the mutation listed below and remove the suppression from pitest-javadoc-suppression.xml

How to Kill the Mutation

1) Take 1 mutation and apply to the code

Pick up the one mutation from the pitest-javadoc-suppression.xml file or for better understanding you can generate the pitest report as well by Following Steps
and finally hardcode the mutation.

How to hardcode the mutation
For better understanding of mutatnt, That how it works. Please checkout Pitest Doc In this you will find the detail explaination of each mutant with example.

2) Send the pr and generate the report

After hardcoding the code please send a pull request and try to generate the regression Report. If Regression report found the diff then you got your test cases. use that part of code as your input and create a test.

How to generate the Regression Report
To learn how to generate the regression report Please go through the Following link.
https://github.com/checkstyle/contribution/tree/master/checkstyle-tester#report-generation

After reading this you found the 2 method two genrate the report please try to generate the report with Github Action.
For example https://github.com/checkstyle/contribution/tree/master/checkstyle-tester#generation-examples
Basically you have to generate the 2 report in with project file

  1. Project-list-1
  2. Project-list-2
  3. Project-list-3

3) Removal of code

If no diff found from all the report just follow the mutation apply the changes and update the pr.

Apart of this for more detailed explaination please go through Wiki-Page and Pit Documentation

Example of how we did not find by report test case that kill mutation #13342 and we simply updated code as pitest mutated.

Example of how to share analytical explanation on why removal of code is ok - #14410


List of survivals to kill mutation

please always choose single mutation for Pull Request.

  <mutation unstable="false">
    <sourceFile>JavadocTagInfo.java</sourceFile>
    <mutatedClass>com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocTagInfo$15</mutatedClass>
    <mutatedMethod>isValidOn</mutatedMethod>
    <mutator>org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_IF</mutator>
    <description>removed conditional - replaced equality check with true</description>
    <lineContent>&amp;&amp; varType.getFirstChild().getType() == TokenTypes.ARRAY_DECLARATOR</lineContent>
  </mutation>
  <mutation unstable="false">
    <sourceFile>JavadocTagInfo.java</sourceFile>
    <mutatedClass>com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocTagInfo$15</mutatedClass>
    <mutatedMethod>isValidOn</mutatedMethod>
    <mutator>org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_IF</mutator>
    <description>removed conditional - replaced equality check with true</description>
    <lineContent>return astType == TokenTypes.VARIABLE_DEF</lineContent>
  </mutation>

Abandoned work but might be good to look at:
#13601
#13600


Already done mutation kills:

1) JavadocParagraphCheck

  • MemberVariableMutator on DetailNode newLine = JavadocUtil.getPreviousSibling(node)

3) JavadocStyleCheck

  • NonVoidMethodCallMutator on builder.deleteCharAt(index)
  • NonVoidMethodCallMutator on if (Character.isWhitespace(builder.charAt(index)))
  • NonVoidMethodCallMutator on if (Character.isWhitespace(builder.charAt(index)))
  • RemoveConditionalMutator_EQUAL_ELSE on if (Character.isWhitespace(builder.charAt(index))) {
  • RemoveConditionalMutator_EQUAL_ELSE on if (Character.isWhitespace(builder.charAt(index))) {
  • RemoveConditionalMutator_EQUAL_IF on if (Character.isWhitespace(builder.charAt(index)))
  • RemoveIncrementsMutator on index += 2;
  • NakedReceiverMutator on builder.deleteCharAt(index)

4) JavadocMethodCheck

  • NonVoidMethodCallMutator on columnNo = fullIdent.getColumnNo()

  • MemberVariableMutator on columnNo = fullIdent.getColumnNo()

  • NonVoidMethodCallMutator on .lineNo = fullIdent.getLineNo();

  • MemberVariableMutator on lineNo = fullIdent.getLineNo();

  • ArgumentPropagationMutator on final int col = calculateTagColumn(noargCurlyMatcher, i, startColumnNumber)

  • NonVoidMethodCallMutator on final Token token = new Token(tag.getFirstArg(), tag.getLineNo(), tag

  • NonVoidMethodCallMutator on final int col = calculateTagColumn(noargCurlyMatcher, i, startColumnNumber)

  • NonVoidMethodCallMutator on foundThrows.add(documentedClassInfo.getName().getText())

  • NonVoidMethodCallMutator on foundThrows.add(documentedClassInfo.getName().getText())

  • RemoveConditionalMutator_EQUAL_ELSE on if (class1.contains(separator) || class2.contains(separator)) {

  • RemoveConditionalMutator_EQUAL_IF on if (arg1.startsWith(ELEMENT_START) &amp;&amp; arg1.endsWith(ELEMENT_END))

  • RemoveConditionalMutator_EQUAL_IF on if (child.getType() == TokenTypes.PARAMETER_DEF) {

  • RemoveConditionalMutator_EQUAL_IF on if (class1.contains(separator) || class2.contains(separator)) {

  • RemoveConditionalMutator_EQUAL_IF on if (ancestor.getType() == TokenTypes.LITERAL_TRY

  • RemoveConditionalMutator_EQUAL_IF on return surroundingAccessModifier != null

  • NakedReceiverMutator on final DetailAST blockAst = methodAst.findFirstToken(TokenTypes.SLIST)

  • NakedReceiverMutator on DetailAST ancestor = throwAst.getParent();


2) JavadocMethodCheck$Token

  • NonVoidMethodCallMutator on columnNo = fullIdent.getColumnNo();
  • NonVoidMethodCallMutator - Issue #13321: Kill mutation for JavadocMethod-7 #13342
  • MemberVariableMutator on columnNo = fullIdent.getColumnNo();
  • MemberVariableMutator on lineNo = fullIdent.getLineNo();
  • MemberVariableMutator on lineNo = fullIdent.getLineNo()

5) JavadocNodeImpl

  • NonVoidMethodCallMutator on + &quot;, children=&quot; + Objects.hashCode(children)

6) JavadocTagInfo$15


7) JavadocTagInfo$14


8) JavadocTagInfo$11


9) TagParser

  • ArgumentPropagationMutator on Point position = findChar(text, &apos;&lt;&apos;, new Point(0, 0))
  • ArgumentPropagationMutator on toPoint = findChar(text, &apos;&gt;&apos;, getNextPoint(text, toPoint))
  • ArgumentPropagationMutator on toPoint = findChar(text, &apos;&gt;&apos;, toPoint)
  • NonVoidMethodCallMutator on (Character.isJavaIdentifierStart(text.charAt(position))
  • NonVoidMethodCallMutator on (Character.isJavaIdentifierStart(text.charAt(position))
  • RemoveConditionalMutator_EQUAL_ELSE on if (incompleteTag) {
  • RemoveConditionalMutator_EQUAL_ELSE on .substring(0, toPoint.getColumnNo() + 1).endsWith(&quot;--&gt;&quot;))
  • RemoveConditionalMutator_EQUAL_IF on (Character.isJavaIdentifierStart(text.charAt(position))
  • NakedReceiverMutator on text = text.substring(column).trim()
  • RemoveConditionalMutator_ORDER_ELSE while (toPoint.getLineNo() &lt; text.length &amp;&amp; !text[toPoint.getLineNo()]

10) AbstractJavadocCheck

  • NonVoidMethodCallMutator on JavadocUtil.getTokenName(javadocTokenId), getClass().getName())
  • NonVoidMethodCallMutator on avadocToken, getClass().getName()
  • NonVoidMethodCallMutator on blockCommentNode.getColumnNo())
  • NonVoidMethodCallMutator on waitsForProcessing = shouldBeProcessed(curNode);
  • RemoveConditionalMutator_EQUAL_ELSE on if (curNode != null) {
  • RemoveConditionalMutator_EQUAL_IF on if (getRequiredJavadocTokens().length != 0)
  • RemoveConditionalMutator_EQUAL_IF on if (toVisit == null) {
    Issue #13501: Kill mutation for AbstarctJavadoc #13602

Activity

  1. added 2 commits that reference this issue on Nov 13, 2023
  2. added a commit that references this issue on Nov 13, 2023
  3. added this to the 10.12.5 milestone on Nov 13, 2023
  4. added a commit that references this issue on Nov 13, 2023
  5. added 2 commits that reference this issue on Nov 16, 2023
  6. nrmancuso commented on Nov 16, 2023

    @nrmancuso
    Contributor

    @Kevin222004 why aren’t we referencing #12341 (comment) and why are we rewriting the pitest procedure here?

  7. romani commented on Nov 16, 2023

    @romani
    Member

    Javadoc are very special group, we less demanding to prove that code is required. We know already that implementation of such checks are very error prone, so if regression can not be found by regression, code should be removed.

    If there will be regression, we are sorry and we will fix easily in next release.

    This rule is not applicable to AST based javadoc Checks, we might do the same for Indentation module ( I am not sure).

    This rule is not applicable to #14019 .

  8. added a commit that references this issue on Dec 4, 2023
  9. suniti0804 commented on Dec 4, 2023

    @suniti0804
    Contributor

    I am on JavadocParagraphCheck

  10. added a commit that references this issue on Dec 4, 2023
  11. 246 remaining items

  12. added a commit that references this issue on Jul 22, 2025
  13. added a commit that references this issue on Jul 22, 2025
  14. modified the milestones: 10.24.0, 11.0.0 on Jul 22, 2025
  15. added a commit that references this issue on Jul 31, 2025
  16. Hariom-kr commented on Oct 10, 2025

    @Hariom-kr
    Contributor

    Hi @romani ,I checked the JavadocTagInfo.SERIAL_FIELD mutations. The test testSerialField() already exists and covers both mutations.

  17. romani commented on Oct 11, 2025

    @romani
    Member

    I am not sure what you talk about, please rephrase.
    Please remove one of "<mutation" from
    https://github.com/checkstyle/checkstyle/blob/master/config/pitest-suppressions/pitest-javadoc-suppressions.xml
    and write test to kill such mutation

  18. added 3 commits that reference this issue on Oct 28, 2025
  19. added a commit that references this issue on Nov 1, 2025
  20. modified the milestones: 11.0.0, 12.1.2 on Nov 1, 2025
  21. romani commented on Nov 1, 2025

    @romani
    Member

    This issue is resolved, thanks a lot contributors!!!!
    It was huge effort

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions