Connecting SonarCloud to a VS Project that uses StyleCop stops the .editorconfig file taking effect


  • SonarLint v4.38.0.36876
  • StyleCop.Analyzers v1.1.118
  • Visual Studio v16.8.3


We are in the process of connecting our projects to SonarCloud. We have been using StyleCop to catch some common code styling issues and used the .editorconfig file to define some of the rules, below is an example file:


# SA1201: Elements should appear in the correct order
dotnet_diagnostic.SA1201.severity = none

# SA1413: Use trailing comma in multi-line initializers
dotnet_diagnostic.SA1413.severity = none

# SA1600: Elements should be documented
dotnet_diagnostic.SA1600.severity = none

# SA1602: Enumeration items should be documented
dotnet_diagnostic.SA1602.severity = none

# SA1629: Documentation text should end with a period
dotnet_diagnostic.SA1629.severity = none

# SA1633: File should have header
dotnet_diagnostic.SA1633.severity = none


After connecting the project to SonarCloud using the SonarLint for Visual Studio extension the .editorconfig file is ignored and StyleCop begins to report the issues that were turned off in the config.


By adding suppressions to the GlobalSuppressions.cs file, example as follows, then the issues are suppressed as expected:

using System.Diagnostics.CodeAnalysis;

[assembly: SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1633:File should have header", Justification = "New rule that needs review")]
[assembly: SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "New rule that needs review")]
[assembly: SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1602:Enumeration items should be documented", Justification = "New rule that needs review")]

Expected Behaviour

We would expect to be able to connect the Visual Studio project to SonarCloud and the .editorconfig file to continue to work as expected with StyleCop.


Hey guys,

Is this something that should be fixed, or not because there is an work around ?


Hello @robc,

My apologies for the very delayed response.

SonarLint in connected mode generates a ruleset. Can you please try to change the project’s ruleset and configure StyleCop via a ruleset file instead of editorconfig?

@aircplp is this the issue that you’re experiencing as well?