You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rule S131 ('"switch" statements should end with a "default" clause') triggers on a switch statement when a default case does not exist. Adding a clause that "contain(s) a suitable comment as to why no action is taken" is supposed to be a valid resolution for S131 per its descriptive text.
Rule S3532 ('Empty "default" clauses should be removed') triggers on a switch statement when a default case has no actual code. Even if there is a comment (per S131's resolution suggestions), this rule will still trigger.
Repro steps
Run the SonarQube scanner against the attached solution.
When the default case contains a comment, S3532 is not triggered.
Actual behavior
A default case containing a comment but no other code triggers rule S3532.
Known workarounds
None.
Related information
SonarC# 5.10.1, though I don't see either of these rules as having been updated in a subsequent release
Visual Studio 2015
Scanner for MSBuild, 2.3.2.573
The text was updated successfully, but these errors were encountered:
valhristov
changed the title
S3532 should not consider default clauses with comments to be empty
Fix S3532: default clauses with comments should not be reported
Nov 27, 2017
Description
Rule S131 ('"switch" statements should end with a "default" clause') triggers on a switch statement when a default case does not exist. Adding a clause that "contain(s) a suitable comment as to why no action is taken" is supposed to be a valid resolution for S131 per its descriptive text.
Rule S3532 ('Empty "default" clauses should be removed') triggers on a switch statement when a default case has no actual code. Even if there is a comment (per S131's resolution suggestions), this rule will still trigger.
Repro steps
Run the SonarQube scanner against the attached solution.
SonarQubeSwitching.zip
Expected behavior
When the default case contains a comment, S3532 is not triggered.
Actual behavior
A default case containing a comment but no other code triggers rule S3532.
Known workarounds
None.
Related information
The text was updated successfully, but these errors were encountered: