Using editorConfig instead of ruleconfig

We are using SonarQube community edition and plan to work in connected mode by using SonarLint plugin. Looking ahead for answers of following.

When we connect Visual Studio solution with SonarQube project a ruleset file is generated. We would like to know following.

  1. Rule set files generated has only few rules and where are the other rules configured?
  2. Can we use editorConfig instead of ruleset file as that the latest standard Microsoft is following?
    3.We have existing multiple editorConfig . Are those considered while performing analysis?

This wiki page explains exactly what happens by default when binding a solution in VS.

(1) The generated ruleset file in the .sonarlint directory will contain an entry for every SonarC# rule.

(2./3) The Microsoft documentation is unfortunately slightly unclear about the relationship between editorconfig files and ruleset files. It says that the precedence for conflicting severity entries between rulesets and editor config files is undefined.

However, since you are using Connected Mode you shouldn’t need to set severities for any of the SonarC# rules in editorconfig files since they have already been set correctly for you in the generated ruleset file.

The implication is that you should be able to use editorconfig files for other settings and for other rules.

FYI there is a workitem in our backlog to investigate switching to use editorconfig files.

1 Like

This topic was automatically closed after 2 days. New replies are no longer allowed.