SonarLint read sonar-project.properties

Does SonarLint read settings from the sonar-project.properties file in the root of a repo?
If not, can a ticket be open for it to read from it?

I find without a global configuration on SonarCloud it makes it a real pain to manage consistent settings across repositories. Right now the only option is for me to use a sonar-project.properties file or manually enter settings each and every time I create a SonarCloud project. It would be really great for SonarLint to read from the sonar-project.properties if one exists.

We already discussed this possibility in the past, but we always rejected it, because of multi-module complexity (previously, for multi-module projects, it was required to bind each module individually).
Now the situation is different, since we have removed modules on SonarCloud server side, and changed SonarLint to be “smart” enough to find the best match between IDE modules and SonarCloud folders.

All that to say that I was about to answer “no”, but after more thinking, that could (now) be an interesting option. I will discuss that internally, and we will come back to you.

Thanks for the suggestion.

Interesting. Modules were a legacy feature?

Thanks for considering.

Yes, they were coming from the Maven world, not playing well with other modular build systems were for example you can have the same file part of multiple modules. Now on server side we have only a physical view, with folders and files.

Is this still open.I’m looking to configure SonarLint from Sonar.properties file.trying to configure sonarLint in IntelliJ with grade plugin

I know it’s been a while, is this still open or implemented? this would be a truly awesome feature to use the project key from the sonar-project.properties file.

Nothing has been implemented. I moved the topic to a feature request, so that people can vote for it.

Don’t hesitate to share your use case. What are the scanner properties you would like SonarLint to automatically recognize?

For example, we have some plans to make the project binding process smoother, so reading the sonar.projectKey directly from sonar-project.properties is definitely a valuable idea.

2 Likes

I’d love for the list of exclusions to be loaded from the file, as well as multicriteria ignore. For instance, I work with a Python project, and for unit tests, our pytest functions use the naming schema of test_<class name>_<function>. This tends to be flagged as a violation of naming convention which I don’t want to tag, so I add an ignore for unit test files (files beginning with test_ in unit_test folders) for that specific rule.

Hi Josh,

The proper fix would be to have SonarLint correctly recognize test files, and don’t report such issues. Can you give a bit more details please:

  • what is your IDE
  • are pytest functions located in dedicated source files, or are they mixed with production code?

2 posts were split to a new topic: Test files are not correctly recognized in PyCharm

This is an amazing option in order to avoid DRY and miss configurations, also to be able to read global config from sonar-scanner like token and sonar url

@Tomas_Carrillo Don’t tell me you store credentials in your SCM?

Credentials are stored on “sonar-scanner.properties” on “conf” path for sonar-scanner.