-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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 #11446: Update SuppressionCommentFilterTest to use verifyWithIn… #11503
Conversation
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 for both tests:
src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilterTest.java
Show resolved
Hide resolved
illegalClassNames = (default)Error, Exception, RuntimeException, Throwable, java.lang.Error, \ | ||
java.lang.Exception, java.lang.RuntimeException, java.lang.Throwable | ||
|
||
|
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.
whole content of this file is not relevant, please remove header comment, and whole body of class.
there should be only empty class.
As we do not use violation of this class.
Apply the same to another Input 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 removed all the header/comments except Filter config
as, without it, the exception is expected and the exception wasn't getting caught.
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 investigate a problem.
you use execute(treeWalkerConfig
so it means that you get config created in test method (not a Input file).
execute
method does not parse Input 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 tried to remove all the comments from the filter config and found that:
/*
SuppressionCommentFilter
offCommentFormat = (default)CHECKSTYLE:OFF
onCommentFormat = (default)CHECKSTYLE:ON
*/
With the above comments, the tests were passing but after removing offCommentFormat = (default)CHECKSTYLE:OFF
and onCommentFormat = (default)CHECKSTYLE:ON
the test gets fail and asked for the exception is 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.
I updated code to make it work, you need debug code.
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.
Changes Done. I got it.
…lineConfigParser
Resolves update for SuppressionCommentFilterTest in #11446.