How to provide project specific SonarLint Rules configuration

Please provide

  • Operating system: Windows 10
  • SonarLint plugin version: 3.15.1
  • Programming language you’re coding in: Java
  • Is connected mode used: No.

Is there anyway to put the SonarLint rules settings in the Project specific settings.json file? If I put a rule in the .vscode/settings.json file, it has no effect, but if I put the same rule in the user settings.json file, it is used. I would very much like to be able to set certain rules separately by project.

Hello Brian, thank you for raising this topic.

Your request looks similar to this one. The answer remains that, currently, the only available option for having project-level rules configuration is by using SonarLint in Connected Mode with SonarQube or SonarCloud projects. This will ensure that the same rules are applied locally as on the server, hiding the Won't Fix and False Positive issues configured on the SonarQube or SonarCloud side.

The feature suggestion to be able to Import/Export local ruleset from SonarLint exists on our Product Roadmap page. Make sure to vote for it if it is important for you :slight_smile:

I hope that helps. :hugs:
Sophio from SonarLint :sonarlint:

It might, I am not sure of the viability of using connected mode for our projects. We are not always connected to the Internet. The fact that the rules can be set in the user settings file and that other configuration settings can be set in workspace settings files makes it seem rather anomalous for rules not to be able to be set in the workspace.

It is important to our workflow to be able to control the configuration of our projects within the projects themselves, so they are under source control. Every external step that needs to be taken lowers the utility of any feature for us.

1 Like