How to configure sonar issue as warning instead of error


(Ganesh) #1


I have installed sonar lint on my visual studio 2015. I have connected to our sonar qube server and bonded solution successfully with local solution.

Suppose this solution contains 2 projects. project1 and project2.

Now for Project1, I am getting" S103 - Lines should not be too long" as a warning.
but for Project2, I am getting “S103 -Lines should not be too long” as an error which results in Build Failure.

Why this behavior is different across projects in same solution. How can I change this behavior?


(Amaury Levé) #2

Hi @ganeshmate333,

Could you have a look and see if your projects contain ruleset files? Ruleset are the classical way to turn on or off a rule and change its severity.


(Ganesh) #3

No I don’t want to turn off any rule. Even these issues are existing and having low or normal severity., but due to my project build settings these low severity warnings are also getting considered as error. I know this is default behavior but Can I change this behavior only for sonar issues. I want these warning should show as per their severity configured in rule and not as per build configuration.

I have configured “Treat warning as error” in my project settings which I don’t want to change.

Project->Right click properties -> Build -> Treat warning as error -> All

Now our project is very old and I have configured sonar lint recently which (sonar analyzer) gives lots of existing issues(warnings).

Now due to my project settings all my existing sonar warnings are getting considered as error due to which I am not able to build project.

So my question is, Is there any way to exclude sonar warnings from this configuration (treat warning as error) and I don’t want to change my project settings.

(Amaury Levé) #4

Hi Ganesh,

Your question is actually not really related to our product but more of a general msbuild configuration question. On this stackoverflow page you will find 2 ways (one which requires modifying your projects and the other the build command line arguments)