SonarQube for IntelliJ plugin version: 10.19.0.80823
PyCharm version: 2024.3.5
Programming language you’re coding in: Python
Is connected mode used: Yes - SonarQube Server Enterprise Edition Version 10.3 (build 82913)
Our enterprise provides a SonarQube server for multiple projects to use, we are not permitted to update the rules so we make use of sonar-project.properties to ignore rules. PyCharm when bound to the server does not honor those properties so all the rules we ignored should up, and since it is bound turning the rules off in PyCharm configuration has no effect.
# Comma-delimited list of ignored code smell rules
# https://sonarqube.accenturefederaldev.com/coding_rules?languages=py&selected=python
# https://docs.sonarsource.com/sonarcloud/advanced-setup/analysis-scope/#rule-key-pattern
sonar.issue.ignore.multicriteria=e1,e2,e3,e4
# python:S117 Local variable and function parameter names should comply with a naming convention
sonar.issue.ignore.multicriteria.e1.ruleKey=python:S117
sonar.issue.ignore.multicriteria.e1.resourceKey=**/*.py
# python:S116 Field names should comply with a naming convention
sonar.issue.ignore.multicriteria.e2.ruleKey=python:S116
sonar.issue.ignore.multicriteria.e2.resourceKey=**/*.py
# python:S1542 Function names should comply with a naming convention
sonar.issue.ignore.multicriteria.e3.ruleKey=python:S1542
sonar.issue.ignore.multicriteria.e3.resourceKey=**/*.py
# python:S100 Method names should comply with a naming convention
sonar.issue.ignore.multicriteria.e4.ruleKey=python:S100
sonar.issue.ignore.multicriteria.e4.resourceKey=**/*.py
Thanks for sharing the configuration file. I guess what I was asking was: are you expecting it to be picked up automatically, or did you try to configure its use somehow?
If I don’t have the project bound to Sonar then the properties file is picked up and the excluded rules are excluded with no custom config on my part. When I bind to the server the the properties file is not picked up.
On the Sonar Server it is making use of the properties file so the ignored items are properly ignored.
This is expected. When you’re in connected mode, one of the features is that the settings saved on the server are applied in-IDE. This includes Quality Profiles and things like exclusions.
Running analysis with exclusions specified in a properties file applies them for that analysis. It does not save them server-side. And thus, they’re not there to be applied in connected mode.
So that is where I’m stuck. I’m prohibited from modifying the server which is why I’m using the properties file. But that makes binding in the IDE useless since all the ignored rules show up.
If I unbind I loose the benefit of some of the other checks but I guess I don’t have a see of highlighted warnings.