Integrate SonarQube with your AI agent, scan for secrets and dependency risks, and explore and manage issues—all from the command line.
Start using SonarQube CLI
I run the scanner from the frontend directory, so it should scan the frontend/apps and frontend/libs directories. However, sometimes I encounter an error:
It seems that CoverageSensor is looking for files outside the directories specified in the sonar.sources properties, specifically in frontend/dist. This directory might be removed by a parallel task, which can cause the scanner to throw an error.
I asked Sonar to look for all **/coverage-test/lcov.info. However, since my sonar-properties.properties file specifies sonar.sources and sonar.tests to point only to the libs and apps directories, I expected it to search only within those directories and not in the dist directory, which is parallel to them.
The project structure is:
frontend/
sonar-properties.properties
dist/
apps/
libs/
Why is CoverageSensor looking for files outside the directories specified in the sonar.sources and sonar.tests properties ?
Yes, the root cause is the same—Sonar scan traverses files outside the directories defined in the sonar.sources and sonar.tests properties.
As for the coverage report, I have an Angular monorepo in the frontend repository with multiple projects, each with its own coverage information. To gather all coverage data, I set the property:
The frontend/dist directory doesn’t contain any coverage information. A build step (running in parallel with Sonar) can create or delete files under frontend/dist, which I suspect is causing the error.