sonar.coverage.exclusions doesn't take effect when running Sonar scanner in my case

Viewed 715

I am developing a node.js project (Nestjs) with TypeScript. I have a SonarQube container running on my laptop (In other words, my laptop is the docker host).

I have downloaded SonarScanner and configured sonar-scanner-4.6.2.2472-macosx/conf/sonar-scanner.properties to point to my SonarQube container which exposes port 9000:

#----- Default SonarQube server
sonar.host.url=http://localhost:9000

Under my project root, I have sonar-project.properties:

...
sonar.inclusions=src/**/*
sonar.exclusions=src/generated/*
sonar.coverage.inclusions=src/**/*
sonar.coverage.exclusions=src/generated/*

As you can see I have clearly said to exclude any file under src/generated/.

(In my .gitignore I also have added the src/generated/ path)

But when I run sonar scanner under my project root: sonar-scanner -Dsonar.login=<MY_PROJECT_TOKEN>

The console output contains following information:

...
INFO: Project configuration:
INFO:   Included sources: src/**/*
INFO:   Excluded sources: src/generated/*
INFO:   Excluded sources for coverage: src/generated/*, 
...
...
WARN: Could not resolve 2 file paths in [/Users/john/Projects/myproject/coverage/lcov.info]
WARN: First unresolved path: src/generated/myfile.ts (Run in DEBUG mode to get full list of unresolved paths)

As you can see above, the log shows me Sonar detected project configuration to exclude src/generated/*, but after that it gives warning :

WARN: First unresolved path: src/generated/myfile.ts

Why SonarQube doesn't exclude file(s) under src/generated but gives warning there even though it seems Sonar has detected project configuration? How to get rid of the warning?

=== tsconfig.json ===

I am also wondering does it have anything to do with tsconfig.json ? So, tried adding:

"exclude": ["src/generated/*"]

Same issue exists...

0 Answers
Related