-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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 #13345: Enabled SeverityMatch example tests #15021
base: master
Are you sure you want to change the base?
Conversation
GitHub, generate website |
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.
all good,
minor improvemnt:
public void method1(int V1){} // ok, ParameterNameCheck's severity is info | ||
|
||
public void Method2(){} // violation, 'must match pattern' |
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 do us a favor and change Example to:
public class Example1 {
public void method1(int V1){} // ok, ParameterName's severity is info
public void Method2(){} // violation, MethodName's severity is default it is error
}
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.
Do I have to change it one by one? If so, how do I make it pass the CI?
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.
Strange, we just changed wording of explanations, can you check if '
in reasons is root of problems?
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.
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 should match to VIOLATION_WITH_EXPLANATION_PATTERN
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 pushed extra commit to let you see more clearly what was a problem
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.
Ok, squashed the commit
73260d3
to
8c47813
Compare
5db5145
to
f9a75d1
Compare
f9a75d1
to
330f763
Compare
330f763
to
b7af14b
Compare
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.
Ok to merge.
Removed violation comments are good as they are at wrong place, they were never active, with fix become active - required to be removed
@rnveach I wanted to remind you to review my changes here. The last feedback was over a week ago and I think I should notify you by now. |
@@ -98,7 +98,7 @@ public final class InlineConfigParser { | |||
|
|||
/** A pattern to find the string: "// violation, explanation". */ | |||
private static final Pattern VIOLATION_WITH_EXPLANATION_PATTERN = Pattern | |||
.compile(".*//\\s*violation,\\s.+\\s(?:['\"](.*)['\"])?$"); | |||
.compile(".*//\\s*violation,\\s.+\\s(?:.*)?$"); |
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 was this changed? No other PRs so far have had an issue.
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.
Nobody noticed defect in this code before until this migration.
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.
What was the defect?
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.
Before it assumed that there should be quotation marks around the explanation just like it would be around violation's message
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.
It was copy paste mistake, fortunately no much usage of this violation style in use.
This PR is first actual usage of this style.
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.
".*//\\s*violation,\\s.+\\s(?:.*)?$"
=> ".*//\\s*violation,\\s+(?:.*)?$"
The extra .+\\s
doesn't really make sense.
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.
moved to #15256
checkWhetherViolationSpecified(specifyViolationMessage, violationMessage, | ||
violationLineNum); | ||
inputConfigBuilder.addViolation(violationLineNum, violationMessage); | ||
inputConfigBuilder.addViolation(violationLineNum, null); |
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.
Same for this code.
@@ -12,15 +12,15 @@ public boolean equals(String o) { | |||
return true; | |||
} | |||
} | |||
public static class TestClass2 { // violation, no correct `equals` | |||
public static class TestClass2 { |
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.
This also.
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.
This location of comment is wrong, it was ignored before. With this update it becomes actionable and can not stay at this line
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 was this missed? Is this connected to the regexp change?
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.
Regexp was bad, all such lines were ignored.
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.
If this is an issue we ignored such lines, won't we ignore more lines that don't match the regexp? What about violation
with no comma? Or with comma but nothing afterwards?
Why aren't we finding all violation lines, and then checking if they match a message and if they don't then fail with an unrecognized message.
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.
It also sounds like this should be split into 2 commits. 1 on bad regexp, other on severity match which PR is tied to.
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.
@SteLeo1602 , ok, this update becomes confusing for others.
Let's create issue on fact that trailing comments without message but with some reason wording is not working. We will fix only it in scope of this issue, separate PR.
And after merging of such update, we will enable this Example.
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 don't feel any confusion. It seems like there is more going on here and a more deep investigation needs to be done.
We completely missed a // violation
comment, and that can happen again regardless of what we update regular expression to.
Also this PR was definitely missing explanations on what its doing and why.
#15021 (comment)
Never got an explanation on this.
Just cause this is tied to an existing issue, doesn't mean we should make a whole bunch of what appears to be unrelated updates without an explanation. If we find bugs, either make them their own PR, own commit, or tie them to their own issue separate from approved work.
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.
@SteLeo1602
new issue is created.
#15256
please fix only it in separate PR.
...examples/resources/com/puppycrawl/tools/checkstyle/filters/severitymatchfilter/Example1.java
Outdated
Show resolved
Hide resolved
555f800
to
8305282
Compare
8305282
to
d431950
Compare
d431950
to
5253eab
Compare
Issue: #13345
Enabled the example tests for SeverityMatch filter.