Well, the easiest way:
Fix what the sonar says :)
but suppose it is false positive.
The following is a list of possible solutions to this problem:
From November 2014: tag support
now fully supported by JavaScript validation (thanks @ RPallas )
If you don't control sonar: a pretty ugly method
try { the code who display Sonar error } catch(err) { }
If you catch any possible problem, Sonar will not be able to detect something (thanks @ JavaScript ).
But the best way is to definitely reconfigure Sonar:
When you control Sonar: add a plugin
To use the CheckStyle plugin on Sonar: ( http://checkstyle.sourceforge.net/ )
The solution is to add a structured Checkstyle comment to the intruder class to suppress a particular check.
The required format for suppressing comments (SuppressionCommentFilter) is as follows:
But I am sending you to the documentation of this plugin ( http://checkstyle.sourceforge.net/config.html )
Hope this answer helps.
source share