-
-
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
False positive in FallThroughCheck on last case #13553
Comments
I am on it |
@romani @Kevin222004 So we have to resolve that issue: when only one case in switch and checklist property is set true and check style must not return any error? Is it |
Cases in switch can be few. |
@romani can you please highlight this better ? The checklastgroup property is used to check the last group but according to you we need to remove the violation for the last group that is check then what is need to of checklastgroup property? |
@AayushSaini101
Both the violation needs to remove. |
I need a reminder why the violation needs to be removed. https://checkstyle.org/checks/coding/fallthrough.html#Description
So we are saying the suppression comment can have another comment before and after it on the same line as long as the other criteria matches? If so, we should add this to the documentation with an example.
Isn't that means this issue is a false positive, and not a negative as it is titled. |
@rnveach This issue is opened during #12966 For example in 10.12.2 or 10.2.3
for version 10.2.3 and 10.2.2
for 10.2.4
So the issue is opened becuase of this changes. After again looking on docs
Yes this is actually not an issue. it is as similar as docs. |
Docs don't clear say no other comments can be before or after. With this specific declaration missing, this issue can go either way and is a call for @romani to decide. Either documentation is missing saying that this is not an issue , or it is an issue and both code and documentation needs to be updated. I remember the PR to change the code, but I don't remember how we came to this issue. |
@romani Can you please check this ? Should i start on this issue |
I am on it |
@romani Please provide clarity on which way this issue is going. Also, is this going to be the default or with an option? |
from doc:
specifically:
this limitation is from time when we had no ability to deal with comments except for loading whole file again as text and get line content by line number. After migration to AST this is not a problem anymore. So I am ok to remove it limitation from doc.
this requirement is ok to make code looks like:
where comment is like "statement" that do move execution point to end of switch (break/continue/.....) but in fact explicit declaration of continue to execute. I am confirming that issue declare expected behavior AND doc needs to be updated to remove extra limitation. |
I am fine with your decision. |
Issue description is updated to mention update of doc. |
@AayushSaini101, issue is ready to be fixed. |
Thanks @romani |
@romani So Multiline comments are also allowed in that case like
Output: Is this correct ? |
We need that whole comment is matching our word.
|
@romani Is this violation correct, After removing the limitation
|
Yes, as allowance comment is not the last comment before next case. |
code in #14016 can be reused to finish this issue, majority of work is done, averyone is welcome to finish this work |
I am on this |
I have read check documentation: https://checkstyle.org/checks/coding/fallthrough.html#FallThrough
I have downloaded the latest checkstyle from: https://checkstyle.org/cmdline.html#Download_and_Run
I have executed the cli and showed it below, as cli describes the problem better than 1,000 words
Config
code
output
Expected
No violation
Update in doc to remove:
The text was updated successfully, but these errors were encountered: