Intention of NuGet package SonarAnalyzer.CSharp after change in SonarLint

SonarLint was changed to move configuration out of Source Control, see Why SonarLint integeration was moved out of scope of the Source Control

What is the relevance of the NuGet package SonarAnalyzer.CSharp, today?

Hi,

Sorry, but I’m struggling to see how the two things connect. Could you provide some more details, please?

 
Thx,
Ann

In the past, we used SonarLint to bind a solution to the SonarQube project. SonarLint was creating files like SonarLint.xml within the solution folder, which provides the server side configuration for rules like “S1451” and its expected file header content.
We installed the nuget packge SonarAnalyzer.CSharp which was consuming the configuration.

Now, the configuration is moved to a folder which is user specific. The the nuget packge SonarAnalyzer.CSharp cannot find anymore the configuration in SonarLint.xml, isn’t it?

So, what is the intention for this package today? It can only work with the default configuration of the rules. At least rules like “S1451” are not usable anymore.

I hope that you can clarify some misunderstanding on our side…

Hi @lg2de,

I see two sides of your question here.

1) SonarLint vs. SonarQube (or SonarCloud)

If you have SonarQube with your Quality Profile (and custom S1451 license header) and you are using SonarLint, there should not be a reason to use the NuGet package as well. As the setup might be contradictory.

All SonarLint users should use SonarLint in connected mode. And that will give them the latest S1451 license header, without polluting the repository. You can use the relatively new feature to share connected mode settings in the team, see Save and share your setup: Recommended for teams from here:

That will make it easier for every team member to bind to the same project.

2) SonarAnalyzer.CSharp Nuget

The purpose of the NuGet package is to benefit from our rules in situations where developers do not have access to SonarQube/SonarCloud for some reason.

As long as the SonarLint.xml file exists, has valid content and is referenced as additional file in the compilation, it will be picked up by the analyzers from NuGet package. So you can activate and use the S1451 rule in this setup, too. Although it’s more difficult to maintain this file manually, as the setup of this can be contradictory to the setup of the SonarQube/SonarCloud server.

Overall, I’d suggest using SonarQube with SonarLint in connected mode everywhere.

Does it clarify the situation?

When using SonarLint in connected mode (with SonarQube or SonarCloud) you should NOT use SonarAnalyzer.CSharp NuGet package.
Correct?

Yes, exactly.