Are custom rules supported in Sonarlint-Visual Studio connected mode?


(Felicia Teo) #1

I have the following installed:

  • Visual Studio 2017 v 15.9.2
  • SonarLint for Visual Studio 2017 v4.7.0.3891
  • SonarQube v7.4(Build 18908)

I created a C# code analyzer using Visual Studio 2015 Update 3 (Due to code analyzer created via VS 2017 15.9.2 is not supported by SonarQube.Roslyn.SDK-2.0). After installing the generated jar file to my SonarQube server, I am able to activate the custom rule in my default quality profile. Then I bind a C# solution in VS2017 to a SonarQube project via the connected mode. I am able to see the custom rule in .sonarlint\xxx.ruleset file that was generated for my solution

However, when I run code analysis on the solution in VS2017, the custom rule was not applied. If I activate a standard SonarQube rule (example S126) in my quality profile and update the connection, then S126 is applied correctly.

I tried installing the Nuget package for the custom rule for my project, but the rule was applied even when I deactivated it in my SonarQube quality profile.

Are custom rules supported in this scenario? If yes, what can I do to make it work?

(Amaury Levé) #2

Hi @feliciateo,

Custom plugins/analyzers are not supported in SonarLint.