Improve rule configuration for non-connected projects

sonarlint

(Jens Bannmann) #1

Hi all,

when I use SonarLint on projects not (yet) connected to a SonarQube server, most Java rules are enabled by default - only 11 are disabled. Consequently, SonarLint reports issues for rules that I do not have in my SonarQube profile and that are not even part of Sonar way, so I have two options:

  1. Disable the rules that are not active in my SonarQube quality profile. As of this writing, that would be a whopping 107 rules to disable manually and individually, and would be even more work for people with fewer rules active (e.g. 156 for those using Sonar way). To put it mildly, this is cumbersome.
  2. Set up the project in SonarQube so I can connect my local project to it in SonarLint. But this is not feasible for smaller projects that should never show up “officially” in SonarQube, projects not yet ready for that step, or personal projects where I just want to use the same rules as at work.

Please make SonarLint more suited for this use case by implementing one or more of the following rough ideas:

  • For each language, allow choosing a default quality profile from one of the SonarQube servers configured in SonarLint.
  • Allow binding a local project to a quality profile directly instead of to a SonarQube project.
  • Allow importing a rule configuration from a quality profile backup file downloaded from SonarQube.
  • Change SonarLint’s defaults to align with Sonar way.

If it matters, I use SonarCloud and IntelliJ.

Best regards,
Jens


(Christophe Lévis) #2

Hi Jens,

Did you try to restore default rules configuration in SonarLint settings?
Restore%20defaults

In most cases, the rules that are enabled by default in SonarLint should to be the same than the ones that are active in Sonar way. With some exceptions like, for example, the rules on coverage and duplication that are not available in SonarLint…
Of course, the built-in quality profiles evolve over the time, and the default rules set you have on SonarLint may be different at a given time from the Sonar way you see on SonarQube/SonarCloud.

Chris