[Java] False negative with squid:S128 - Switch cases should end with an unconditional "break" statement

116 views
Skip to first unread message

David Racodon

unread,
Oct 13, 2015, 5:49:12 AM10/13/15
to SonarQube
Hi,

Any chance you can deal with the following false negative?

Inline image 1

Thank you

Regards,

David RACODON
Freelance QA Consultant

Francis Galiegue

unread,
Oct 13, 2015, 8:57:47 AM10/13/15
to SonarQube
Hello,


On Tuesday, October 13, 2015 at 11:49:12 AM UTC+2, David Racodon wrote:
Hi,

Any chance you can deal with the following false negative?

Inline image 1
 
While I disagree with this rule as a whole (there are perfectly legitimate uses of fall through in switch cases), here it is not a false positive; if your value is 1 in the switch case, the return of the value is not unconditional and depends on whether j == 3.

The rule itself, in fact, should probably be rephrased, with the message being something like "this switch case falls through the next one; ensure that this is intended" or something.

Regards

David Racodon

unread,
Oct 13, 2015, 9:53:40 AM10/13/15
to Francis Galiegue, SonarQube
Hi Francis,

here it is not a false positive; if your value is 1 in the switch case, the return of the value is not unconditional and depends on whether j == 3.

I'm talking about false negative here, not false positive. I don't get any issue but I do expect one to be raised on "case 1".

Regards,

David RACODON
Freelance QA Consultant

--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/8ba1c95f-9f33-4415-8e12-5e4c5445e629%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Francis Galiegue

unread,
Oct 13, 2015, 11:28:25 AM10/13/15
to SonarQube, fgal...@gmail.com
Hello,


On Tuesday, October 13, 2015 at 3:53:40 PM UTC+2, David Racodon wrote:
Hi Francis,

here it is not a false positive; if your value is 1 in the switch case, the return of the value is not unconditional and depends on whether j == 3.

I'm talking about false negative here, not false positive. I don't get any issue but I do expect one to be raised on "case 1".


Uhm, yes, sorry for the noise. Although I have some difficulty about the description of it being a "false negative"; rather an "undetected case".

Regardless of whether this case is actually detected though, I believe the rule's message should be changed to something along the lines of my suggestion.

Regards

David Racodon

unread,
Oct 13, 2015, 11:32:17 AM10/13/15
to Francis Galiegue, SonarQube
Uhm, yes, sorry for the noise. Although I have some difficulty about the description of it being a "false negative"; rather an "undetected case".

This is the same for me. 

Regardless of whether this case is actually detected though, I believe the rule's message should be changed to something along the lines of my suggestion.

I wouldn't mind your proposal about the issue message to be implemented. 

David RACODON
Freelance QA Consultant

--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.

Michael Gumowski

unread,
Oct 14, 2015, 3:00:17 AM10/14/15
to David Racodon, Francis Galiegue, SonarQube
Hey guys,

Thank you for the feedback. 
I created the following JIRA ticket to handle the issue: https://jira.sonarsource.com/browse/SONARJAVA-1336

Regards,

Michael GUMOWSKI | SonarSource
Software Developer @ Language Team
http://sonarsource.com

David Racodon

unread,
Oct 14, 2015, 4:49:49 AM10/14/15
to Michael Gumowski, Francis Galiegue, SonarQube
Thanks Michael.

David RACODON
Freelance QA Consultant

Reply all
Reply to author
Forward
0 new messages