Improve rule configuration for non-connected projects

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

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

(Sorry for bumping this old thread, but I believe it’s still relevant.)

Yes, in the meantime I did that. I didn’t check extensively whether the default config matches Sonar Way, though.

Anyway, that’s not my main point. Let me illustrate this with a recent example: a few days ago, we started a code base for a customer who does not have a SonarCloud/SonarQube instance, and (for business reasons) will likely not get one for the next few months. But we could at least use SonarLint, right? We do, but of course we wanted to use our usual quality profile. We couldn’t do that because our quality profile currently includes 86 rules which are not part of Sonar Way, and activating them manually is not a good use of our developers’ time.

So I still suggest that SonarSource considers one of the following feature ideas for SonarLint:

  • For each language, allow choosing a default quality profile from one of the SonarQube/SonarCloud servers configured in SonarLint.
  • Allow binding a local project to a quality profile directly instead of to a SonarQube/SonarCloud project.
  • Allow importing a rule configuration from a quality profile backup file downloaded from SonarQube/SonarCloud.
1 Like

For such cases we use dummy projects created in Sonarqube with the appropriate quality profile
as workaround.
So it’s possible for Sonarlint to bind to this dummy project and use your quality profile - even if your
project is not yet included in your normal workflows.
But your proposal is reasonable!
+1

1 Like

I totally support the initial post’s intention and am missing the same thing.

+1

1 Like