New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #4394: increase coverage of pitest-checkstyle-api profile to 96% #4704
Conversation
@@ -227,11 +227,12 @@ public int getLineNo() { | |||
// with initialize(String text) | |||
resultNo = findLineNo(getFirstChild()); | |||
|
|||
if (resultNo < 0) { | |||
//line number cannot be less than 1 | |||
if (resultNo == -1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we add comment here but no where else in this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just forgot to remove this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then please remove.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -49,12 +49,6 @@ | |||
*/ | |||
public abstract class AbstractLoader | |||
extends DefaultHandler { | |||
/** Feature that enables loading external DTD when loading XML files. */ | |||
private static final String LOAD_EXTERNAL_DTD = | |||
"http://apache.org/xml/features/nonvalidating/load-external-dtd"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@romani Please review these removals.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those features are enabled by default. I moved them to the tests - to always be sure that they are still enabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Nimfadora This is not true. Look at blame for these lines and associated issue.
https://github.com/checkstyle/checkstyle/blame/154f120d7b71c30ec64f3ef801fb080a24a21c4a/src/main/java/com/puppycrawl/tools/checkstyle/api/AbstractLoader.java#L52
#3605
This removal must be reversed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Nimfadora ,
Unfortunately, this is weird feature request from googlers , please see commit and related issue #3605 .
How can we suppress pitest there or any other workaround (I am ok to move that code to special method addFeauresForVerySecureJavaInstallations
and suppress pitest on this method)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@romani it's kinda troublesome. I can exclude addFeauresForVerySecureJavaInstallations
from being mutated, but I cannot suppress mutation of the call to this method. avoidCallTo
in PIT config didn't help, cause it allows only class names as params.
I can pull this method to the separate class, eg AbstractLoaderUtils
, and this helps. Is it fine or an overkill?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please try to do this by means of inner class in AbstractLoader, if it does not help ... ok to make separate top level class FeauresForVerySecureJavaInstallations
in javadoc make it clear that it is result of conflict of pitest and user requirements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
check.log(0, "key", "args"); | ||
final Collection<LocalizedMessage> messages = | ||
(Collection<LocalizedMessage>) Whitebox.getInternalState(check, "messages"); | ||
check.clearMessages(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add an assertion right before this that messages' size isn't 0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
final BitSet branchTokenTypes = Whitebox.invokeMethod(parent, "getBranchTokenTypes"); | ||
method.accept(null); | ||
final BitSet branchTokenTypes2 = Whitebox.invokeMethod(parent, "getBranchTokenTypes"); | ||
assertNotSame(branchTokenTypes, branchTokenTypes2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't do more than notSame
? It makes this a vague test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not really sure how. BitSets actually are equals each time. By this test, I wanted to ensure that each call to add/set sibling/child methods force bitset to be recalculated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we then assert the resulting values are the same?
NotSame
atleast verifies instance is different.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
testNonValidCoordinates(0, 0, "MyTest.MyTestik[15x14]"); | ||
} | ||
|
||
private static void testNonValidCoordinates(int columnNo, int lineNo, String expected) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-test methods shouldn't start with test
. Rename test
to validate
.
Also romani doesn't like assertions outside of test method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
items to improve:
@@ -49,12 +49,6 @@ | |||
*/ | |||
public abstract class AbstractLoader | |||
extends DefaultHandler { | |||
/** Feature that enables loading external DTD when loading XML files. */ | |||
private static final String LOAD_EXTERNAL_DTD = | |||
"http://apache.org/xml/features/nonvalidating/load-external-dtd"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Nimfadora ,
Unfortunately, this is weird feature request from googlers , please see commit and related issue #3605 .
How can we suppress pitest there or any other workaround (I am ok to move that code to special method addFeauresForVerySecureJavaInstallations
and suppress pitest on this method)?
Build failed with |
First thing that comes to mind is make sure you are up to date with master. |
@Nimfadora , on my local for your branch the same on Travis:
please recheck that tests are passing before pitest execution as it heavily affect pitest. |
Codecov Report
@@ Coverage Diff @@
## master #4704 +/- ##
======================================
Coverage 100% 100%
======================================
Files 287 287
Lines 15386 15388 +2
Branches 3501 3501
======================================
+ Hits 15386 15388 +2
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as Shippable pas , we could merge
Issue #4394
pitest-checkstyle-api profile before changes
increased mutation threshold for pitest-checkstyle-api-filters profile by 8%
current threshold: 96%
execution time: 9:51 min