Rule S00108 Empty block check - disable for ignored catch blocks

169 views
Skip to first unread message

lukas...@gmail.com

unread,
Nov 16, 2017, 8:02:49 AM11/16/17
to SonarQube
For exceptions that are supposedly ignored (usually assigned to a variable explicitely named "ignore" or "ignored" in the respective catch block),
I believe it's fine to leave those blocks empty.
Still, S00108 marks those blocks as issues.

Any ideas why it might be a bad idea to add this behaviour to the rule?
If not, I would implement it in the near future.

Nicolas Peru

unread,
Nov 23, 2017, 5:56:21 AM11/23/17
to lukas...@gmail.com, SonarQube
Hi, 

While I can get the reasoning leading to your suggestion I don't think it is a nice addition to this rule. (I assume you are talking about Java).

Basing the exclusion of raising issue on variable name is dodgy (what about cases where the name will incorrectly match ?). Then, there is also the problem of the next logical step which will be suggested : parameterzing the matching of this exclusion. 
We have the philosophy to limit the rule parameters to a minimum in order to not dump tuning of the rules on our users shoulders and avoid configuration hell for them.

I might be wrong but I do think those empty catch block should be limited to a minimum and so marking them as won't fix in special cases should be something acceptable. But I would be happy to be contradicted if you think I am wrong.

Cheers, 


--
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/c65ee168-256f-4877-b755-6ebcf8624539%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Nicolas Peru | SonarSource
Reply all
Reply to author
Forward
0 new messages