Issue #13321: Kill mutation for SummaryJavaDocCheck-1#13311
Issue #13321: Kill mutation for SummaryJavaDocCheck-1#13311romani merged 1 commit intocheckstyle:masterfrom
Conversation
|
Github, generate report |
|
Github, generate report |
|
@Kevin222004 I have found a regression test case with the current changes: With the original code: @Test
public void testAsd() throws Exception {
final String[] expected = {
"16: " + getCheckMessage(MSG_SUMMARY_JAVADOC),
};
verifyWithInlineConfigParser(
getPath("InputSummaryJavadocTestForbiddenFragmentsFoo.java"), expected);
} Input file: /*
SummaryJavadoc
violateExecutionOnNonTightHtml = true
forbiddenSummaryFragments = ^Returns the customer ID. This method returns.$
period = .
*/
package com.puppycrawl.tools.checkstyle.checks.javadoc.summaryjavadoc;
// ok
public class InputSummaryJavadocTestForbiddenFragmentsFoo {
// violation 2 lines below
/**
* {@summary Returns the customer ID.
* This method returns. }
*/
public void foo() {
}
}With your changes: This is both a good and bad regression. /*
SummaryJavadoc
violateExecutionOnNonTightHtml = true
forbiddenSummaryFragments = ^Returns the customer ID. This method returns. $
period = .
*/
package com.puppycrawl.tools.checkstyle.checks.javadoc.summaryjavadoc;
// ok
public class InputSummaryJavadocTestForbiddenFragmentsFoo {
// ok, no violation here with the original code, IMO there should be a violation.
/**
* {@summary Returns the customer ID.
* This method returns. }
*/
public void foo() {
}
}with your changes: /*
SummaryJavadoc
violateExecutionOnNonTightHtml = true
forbiddenSummaryFragments = ^Returns the customer ID. This method returns. $
period = .
*/
package com.puppycrawl.tools.checkstyle.checks.javadoc.summaryjavadoc;
// ok
public class InputSummaryJavadocTestForbiddenFragmentsFoo {
// violation 2 lines below
/**
* {@summary Returns the customer ID.
* This method returns. }
*/
public void foo() {
}
}@romani @rdiachenko Please share your opinion about the above mentioned test case (the one with extra space.) |
Vyom-Yadav
left a comment
There was a problem hiding this comment.
Items:
Main item: #13311 (comment)
|
@Kevin222004 , please add Inputs from @Vyom-Yadav to our code base.
It should be a violation. As with inline tags we consider all until |
|
@romani done test added |
...rces/com/puppycrawl/tools/checkstyle/checks/javadoc/summaryjavadoc/InputSummaryJavadoc1.java
Outdated
Show resolved
Hide resolved
Vyom-Yadav
left a comment
There was a problem hiding this comment.
LGTM! @Kevin222004 Please create an issue for the other case I mentioned in the PR. @romani CircleCI failed due to a connection reset. Please re-run.
|
@Kevin222004 , please review what is not done |
|
@Vyom-Yadav , I think you mentioned only one case and we opened issue for it #13347 |
|
Yes I messaged him for same but not get replied yet |
Issue #13321: Kill mutation for SummaryJavaDocCheck-1
Check :-
https://checkstyle.org/checks/javadoc/summaryjavadoc.html#SummaryJavadoc
Mutation
checkstyle/config/pitest-suppressions/pitest-javadoc-suppressions.xml
Lines 858 to 865 in 3d8ed42
Explaination
The removal of trim will effect the programme it will increase the number of times in loop.
There are total 3 usage of the
containsForbiddenFragmentvalidateUntaggedSummarymethod atcheckstyle/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/SummaryJavadocCheck.java
Lines 343 to 345 in 6073cd4
Note:- If this
conditionexecute then violation thrown and violation message doesn't contains any relation with the text.Know when
containsForbiddenFragmentwill be execute thencheckstyle/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/SummaryJavadocCheck.java
Lines 603 to 606 in 6073cd4
javadocText will not be trimmed lets suppose if we have sentence
This is summary javadoc .then javaDoctext would become
This is summary javadocand as a return statment we call
trimExcessWhitespacesto matchforbiddenSummaryFragmentand in trimExcessWhitespaces for loop will run as more time as we have extra spaces which is not been removed as we remove trim.and the string will return with the extra space but it will not affect the output.
And for the second and third usage the explaintaion is same as above
checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/SummaryJavadocCheck.java
Lines 528 to 530 in 6073cd4
and
checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/SummaryJavadocCheck.java
Lines 511 to 513 in 6073cd4
Regression :-
Report-1 :- https://checkstyle-diff-reports.s3.us-east-2.amazonaws.com/5d08f12_2023202818/reports/diff/index.html
Report-2:- https://checkstyle-diff-reports.s3.us-east-2.amazonaws.com/5d08f12_2023084141/reports/diff/index.html
Diff Regression config: https://gist.githubusercontent.com/Kevin222004/61eaa69fe98585b6ee1882ca082362bc/raw/c74195e574d09886a3406be17a9d46787da9545e/Summary.xml
Diff Regression projects: https://gist.githubusercontent.com/Kevin222004/9600f179b602d4c971bdb0a050099005/raw/360a95ed7bb60d7a0956e531199d484c4d6f6617/test-projects.properties
Report label: Regression-2