Rules settings in .editorConfig file is not used by sonar scanner

Must-share information (formatted with Markdown):

  • which versions are you using
    I’m using SonarQube Server / Community Build version and sonar-scanner for .NET framework to scan the C# files.

  • how is SonarQube deployed:
    I’m running sonarQube Server locally in my machine.

  • what are you trying to achieve
    I have configured some sonarQube rule not to throw warnings by setting its severity to none in .editorConfig file, If I run the build locally, I get no warnings at all for those sonarQube rule. But With SonarQube, warnings were shown up in sonarQube server for all the rules with none severity. I saw already some topics were posted for the same issue.

  • what have you tried so far to achieve this
    posting some previous comment links below, now I want to know it is possible to configure rule settings in .editorConfig rule, and will that will be considered by sonarQube?
    https://community.sonarsource.com/t/sonar-cloud-ignoring-rules-with-editorconfig-is-not-working/119701/8
    https://community.sonarsource.com/t/question-on-editorconfig-is-correctly-handled-by-sonarqube/132528/9

Hi,

First, running SonarQube Server on your localhost is not a good practice. You should talk to your DevOps folks about offloading this to a centralized host.

Can you provide the versions of the server and scanner you’re using?

And can you also provide the .editorconfig file? Because that usage is valid for specific files or directories, but not generally, AFAICT.

If you really want to fully disable a rule, you should remove it from your Quality Profile.

 
HTH,
Ann

Hi @ganncamp,
Thanks for your reply.
Sure we are planning to offload the sonarQube server from local machine to a centralized host soon.

SonarQube server version: 25.6.0.109173
Sonar Scanner for .NET framework: 10.2.0.117568

I’m having this .editorconfig file in the root folder. Below is my .editorconfig file:

# .editorconfig
root = true
# C# files
[*.cs]
dotnet_diagnostic.S2930.severity = warning
dotnet_diagnostic.S3880.severity = warning
dotnet_diagnostic.S2931.severity = warning
dotnet_diagnostic.S3881.severity = none
dotnet_diagnostic.S4426.severity = none
dotnet_diagnostic.S4428.severity = none
dotnet_diagnostic.S4663.severity = none
dotnet_diagnostic.S5753.severity = none
dotnet_diagnostic.S5766.severity = none
dotnet_diagnostic.S6607.severity = none
dotnet_diagnostic.S6608.severity = none
dotnet_diagnostic.S6609.severity = none
dotnet_diagnostic.S6613.severity = none
dotnet_diagnostic.S6960.severity = none
dotnet_diagnostic.S6961.severity = none
dotnet_diagnostic.S6962.severity = none
dotnet_diagnostic.S6965.severity = none
dotnet_diagnostic.S6966.severity = none

With this setup I get warnings for the rules that configured its severity as none. Is it possible to control sonarQube rules in .editorconfig file?

Thanks,
Ragu

Hi Ragu,

For what you’re trying to do - turn specific rules off for all files - you should edit the Quality Profile.

 
HTH,
Ann