visual-studio-2019sonarlintsonarlint-vs

How to set severity based on the issue type for SonarLint for Visual Studio?


I want to set Bugs and Vulnerabilities as errors and Code Smells as warnings for the SonarLint extension in Visual Studio. I prefer to set it generically, rather than right-clicking each issue and setting its severity. Is it possible for me to do that? If yes, please tell me how to do it.

Thanks and Regards,

Arjun


Solution

  • Since specification for each rule is publicly available: https://github.com/SonarSource/sonar-dotnet/tree/3ab2e10b4effa8760b3ecd4fbb2b3d59f43f1b7f/analyzers/rspec/cs, it was quite easy to write a program that would generate .editorconfig with all rules.

    Here it is: https://github.com/Peska/SonarAnalyzersRules/blob/master/.editorconfig

    Grouped by type - CODE_SMELL, BUG, SECURITY_HOTSPOT, VULNERABILITY - and ordered by Severity in case you want to change something in a future.

    I cannot paste full .editorconfig as an answer it here, since there is 30k characters limit.