We want to use SonarAnalyzer.CSharp altogether with the Code style and Code quality analyzers that are built in to Visual Studio. It would be great to have only one type of configuration file to configure all the analyzers used in the solution. Is this possible?
Does sonaranalyzer.csharp support configuration through .editorconfig instead of SonarLint.xml?
In Standalone Mode, .editorconfig files can be used to disable or change the severity of a rule.
However, they cannot be used to pass parameters to the Sonar analyzer rules - you would have to provide a SonarLint.xml file to do that.
Example:
[*.cs]
# Disable a single Sonar rule.
# See https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/configuration-options for more information
dotnet_diagnostic.S1135.severity = none
In Connected Mode, SonarLint generates an old-style .ruleset file specifying which rules to run. I can’t find any official Microsoft documentation about the interaction between ‘.ruleset’ files and ‘.editorconfig’ files, but behaviour I observed when testing was that the the .ruleset file takes precedence in Connected Mode.