-
-
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
Add Check Support for Java 21 Pattern Matching for Switch Syntax: JavaNCSS #15046
Comments
this has nothing to do with the new syntax. But this check is weird in counting I can't even get the correct behavior. the difference between the two methods is just removing one line (
|
I am approving this for new test input only. I also struggle to understand exactly how this check actually works vs how it is supposed to work. If we don't find anything crazy during our PR to add new tests inputs, I suggest that we don't spend a lot of time on this check. |
It seems to me this check is suppose to cover something like "How complex can a method without comments be before it becomes too complex and you must comment it and describe the complexity". However, I may disagree that it goes far enough since it doesn't count boolean operators like
https://checkstyle.org/checks/metrics/javancss.html#Example1-code === I thought there was some issue with this on switches, but maybe it was fixed. I am no expert with this check. Here is what the input in the first issue is counting (subtract 10 from the line numbers below to match the above):
We do know
I think this may cause a bug in this check when we fix
Now that I see what is counted. It seems odd we add +2 for an http://www.kclee.de/clemens/java/javancss/ |
There is a disconnect here between the 2 methods.
We should be counting the expression inside the This looks like a bug, possibly with the SWITCH_RULE? @nrmancuso We may need to re-evaluate this being an input only issue. |
child of #14961
I have read check documentation:https://checkstyle.org/checks/metrics/javancss.html#JavaNCSS
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
check doc:
Describe what you want in detail
I think the code for the switch is working as expected here. There may be a bug with the code with if statments
The text was updated successfully, but these errors were encountered: