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
Add support to our Inputs for lines with multiple violations #13307
Comments
@jxr98 , can you help us with this issue ? |
Thanks. I would love to help with this issue. |
@jxr98 , design is not set in stone, so your suggestion to change it to get more robust implementation is appreciated. |
Gotcha. Thanks for clarifying. |
The multiple violations in one line now are specified in comments as below
As Romani pointed out, we can change to the example below
The differences between multiple violations on one line and single violation on one line:
We can use these two differences to distinguish multiple violations and single violation. Each line followed by the plural form(violations) will be regared as a violation, and the |
What if we do: /* 4 violations below:
''->' is not followed by whitespace'
''{' is not followed by whitespace'
''{' is not preceded with whitespace'
''}' is not preceded with whitespace'
*/
Runnable noop = () ->{}; and Runnable noop = () ->{};
/* 4 violations above:
''->' is not followed by whitespace'
''{' is not followed by whitespace'
''{' is not preceded with whitespace'
''}' is not preceded with whitespace'
*/ ? I find this easier to read (less noise than single line comments and no comments on the lines with the code), and probably easier to parse since we have two ways to check for end of violation list (number of violations/lines in first comment line + block comment end delimiter). |
I like both variants, if we need to choose I would use what is easier to implement now to have this feature sooner. |
From implementation perspective, I need to look into details before deciding which one is easier to implement. I will try both variants a bit. |
Reopened for: NOT done validation of messages for:
I think it is better to do this after this PR, to make sure prove of concept is megred and second PR will be easy to accept as it will just extension. |
Completed via #14156 |
This was a problem for long time but become very acute at #13276 (comment)
We need to update our Abstract Test classes to allow lines like:
so all messages are just on new lines below
4 violations, see messages below
So Reviewer will clearly see what is a violation.
example:
checkstyle/src/test/resources/com/puppycrawl/tools/checkstyle/checks/annotation/annotationlocation/InputAnnotationLocationIncorrect.java
Line 38 in 3d8ed42
but there are more in code.
pattern that used at PR, may be extra
:
is required to signal that second line is continuation:As we process lines one by one, of we detect multiple-line pattern we look ahead for defined set of lines. Processing of such lines with violation only will not match any pattern so they will be skipped by general iteration over lines. Location of single quoted message can be at any indentation, to let user user any formatting to show message as he wants.
The text was updated successfully, but these errors were encountered: