Hello,
How do I disable blocks of lines (or single lines of codes) from SonarQube scanning for C# code?
We have a SonarQube Server Version 5.6 that kicks off scanning from a continuous integration system and reports its results.
Locally, I installed SonarLint to detect SonarQube bugs and vulnerabilities from MS Visual Studio 2015.
I noticed when I place "#pragma warning disable S2952" it excluded the lines of code that violated that rule, but it only worked with the SonarLint Visual Studio plugin.
For example:
#pragma warning disable S2952
myImage.Dispose();
#pragma warning restore S2952
S2952 being the csharpsquid number, instead all the aforementioned example accomplishes is exclude it from the SonarQube results when it is run locally using [SonarLint][1].
When our continuous integration systems reports its results to the SonarQube server, then the bug is still reported.
I know how to exclude entire projects from SonarQube, but I have not been able to do a line-by-line or block exceptions.
Is this something that can be accomplished in SonarQube V5.6?
Any help or suggestions would be appreciated.
[1]:
http://www.sonarlint.org/visualstudio/index.html