5

I'm struggling to override rules on my Sonar project. I've got a custom profile set on my project, but it seems I can't override its rules in the sonar-project.properties.

Here is my config file:


# --- Sonar basic configuration ---

sonar.projectKey=<redacted>
sonar.projectName=<redacted>
sonar.projectVersion=1.0

# --- Sonar folder configs ---

sonar.sources=src
sonar.exclusions=**/node_modules/**, **/*.config.js
sonar.tests=src
sonar.test.inclusions=**/**.test.jsx,**/**.test.js,**/**.spec.js,**/**.spec.jsx
sonar.javascript.lcov.reportPaths=coverage/lcov.info

# --- Sonar rule overrides ---

# We're using ESLint to analyse javascript. If an eslint rule is broken,
# the build fails, which means we can fully rely on eslint for syntax
# errors. This file mostly overrides rules that are in conflicts with
# our eslint configuration, or rules that go against best practices.

sonar.issue.ignore.multicriteria=g1,g2,g3,g4,g5,r1,r2,r3

# - Global rules -

# Allow trailing comma (eslint conflict)
sonar.issue.ignore.multicriteria.g1.ruleKey=javascript:TrailingComma
sonar.issue.ignore.multicriteria.g1.resourceKey=**/*

# Bypass the 25% comments rules per file (useless)
sonar.issue.ignore.multicriteria.g2.ruleKey=common-js:InsufficientCommentDensity
sonar.issue.ignore.multicriteria.g2.resourceKey=**/*

#... and it continues like so

When I start the scanner I can see it uses my config file and setting up the parameters based on the custom profile, however rules are not overriden.

Thanks for your help!

SylvainAr
  • 154
  • 5
  • If you have a custom Quality Profile configured already, why are you trying to change the rules in the properties file, rather than just changing the Quality Profile? – duncanp Apr 24 '20 at 07:41
  • 1
    I don't have access to the rules dashboard :( – SylvainAr Apr 24 '20 at 08:00

0 Answers0