How can I delete roslyn:CS~ rule?

*Sonarqube version : Sonarqube 7.9.1, scanner-msbuild-4.6.2, my own custom rule plugin(C#)
As you can see below picture,


I’ve never added these rules(roslyn:CS0436, 0618, …).

I’m not using another rules on my Quality Profiles. There are all of my custom rule in there.

I think that roslyn:CS is providing by default.
I just wanted to remove these rules but I couldn’t.
I also have only 2 plugins. sonarC# and my own custom rule plugin.
How can I fix it?

It looks like all of those CS* issues are compiler issues i.e. they are reported directly by the compiler, not an external analyzer. By default, the Sonar Scanner for MSBuild (“S4MSB”) will now import non-Sonar issues as External Issues.

You have a number of options:

  • set the Warning level and/or Suppress warnings options in the project properties to control which compiler warnings are reported:
    image

  • use a ruleset to tell VS/MSBuild to disable those compiler rules. The S4MSB v4.7+ will merge the rules configuration from SonarQube with your local ruleset and use that merged ruleset during build/analysis (although see S4MSB-833 for a bug which means this won’t work for test projects).

  • tell S4MSB not to import any third-party Roslyn rules by setting sonar.roslyn.cs.ignoreIssues. See the section Notes on external .NET issues in the External Issues link above for more information.
    Note that if you are referencing your custom analyzer using NuGet in your MSBuild project then issues raised by your rules won’t be imported either.
    If you have packaged your custom analyzer into a SonarQube plugin using the SonarQube Roslyn SDK then your issues will still be imported.

Thank you for your answering.
I really appreciate that you concern about my question.

I solved this issue by activating “sonar.roslyn.cs.ignoreIssues” on my sonarqube web(Administration - Configuration - External Analyzers)

1 Like