How to ignore the file and duplicate code line_

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • how is SonarQube deployed: zip, Docker, Helm
  • what are you trying to achieve
  • what have you tried so far to achieve this

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

I would like to ignore the file frontend/src/pages/PrintImage.tsx by sonarscanner.
I tried to set like below code in sonar-project.properties file to ignore the file.

# General Settings
sonar.projectKey=APP-FE
sonar.qualitygate.wait=true

# ESLint reportPaths
sonar.eslint.reportPaths="report/eslint-report.json"

# Unit Test (Jest) reportPaths
sonar.testExecutionReportPaths="report/test-report.xml"
sonar.language="js"
sonar.sources="./src"
sonar.tests="src"
sonar.test.inclusions="**/*.test.ts*"
sonar.exclusions="./node_modules,./src/pages/PrintImage.tsx"

# Coverage Test (Jest) reportPaths
sonar.typescript.lcov.reportPaths="coverage/lcov.info"

#  Duplication Exclusions
sonar.cpd.exclusions="./src/pages/PrintImage.tsx"

But it does not work.

Secondly, I set like pictures. But it does not work.


Please help me.

You need to use glob patterns as documented here.

For example:

**/frontend/src/pages/PrintImage.tsx

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.