Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: JAVASCRIPT-1.1
-
Fix Version/s: JAVASCRIPT-1.3
-
Component/s: JavaScript
-
Labels:None
-
Environment:Sonar 3.3, Win2k8 64bit
-
Number of attachments :
Description
When I analyze a JS project with the rule "For-in statement must filter items" enabled, I'm getting false positives when I use "continue" rather than a wrapping if condition.
FR #SONARPLUGINS-1819 states to support the following snippet:
for (name in object) { if (object.hasOwnProperty(name)) { .... } }
However this code snippet creates a false positive:
for (name in object) { if (!object.hasOwnProperty(name)) continue; .... }
This should not happen as both snippets are valid (at least when "object.hasOwnProperty(name)" is the first statement in the loop).
Works well Evgeny, could you just change the violation message of this rule :