SonarCloud - Python - Suppress specific rules

Hi,

When suppression of specific rules will be supported in python? (Same as can be done in other supported languages like Java)

1 Like

Iā€™m not expert in python but I guess the scanner works like in PHP. Do you need to disable the rules for the whole project or only for certain directories/files?
I think you can put an exception to the rules in your sonar.properties file.

Sth like this:

sonar.issue.ignore.multicriteria=e1,e2

# Console usage - ignore a single class
sonar.issue.ignore.multicriteria.e1.ruleKey=java:S106
sonar.issue.ignore.multicriteria.e1.resourceKey=**/SonarExclude.java
# Too many parameters - ignore the whole package
sonar.issue.ignore.multicriteria.e2.ruleKey=java:S107
sonar.issue.ignore.multicriteria.e2.resourceKey=com/baeldung/sonar/*.java

Hope it helps. KR

Carlos

1 Like