Sonarcloud is no longer picking up code (ie. no code coverage or other analysis)

We had sonarcloud working but we wanted to tweak the code coverage and now sonarcloud is no longer picking up the source code in its analysis.

This was the old configuration


sonar.projectKey=witty-works_nlp_api
sonar.organization=witty-works

sonar.python.version=3.9
sonar.source=app
sonar.source=tests
sonar.python.coverage.reportPaths=coverage.xml

What was odd is that with this configuration it was still including files in the root for code coverage. Now we decided to move all the shell scripts in the root to a “bin” directory. For those files we don’t have tests and therefore we don’t want those files to he included in the code coverage. I updated the configuration and at the same time also fix the typo “sonar.source=tests” to “sonar.tests=tests”.

sonar.projectKey=..
sonar.organization=..

sonar.python.version=3.9
sonar.source=app, bin
sonar.tests=tests
sonar.coverage.exclusions=bin
sonar.python.coverage.reportPaths=coverage.xml

However now the only files that show up in the code tab of my main branch are “tests”. Also all the other quality gates are at A because seemingly its not seeing any code anyway.

Hey there.

sonar.source does not exist – you need to use sonar.sources.

If that doesn’t immediately solve the issue, I would reccomend turning on DEBUG level logging (sonar.verbose=true) and check which files are indexed (what does the scanner see?) and how they’re indexed (source or test?)

ok great … now the code shows up again … also fixed the exclusion rule “sonar.coverage.exclusions=/bin/” and now everything is as expected.

1 Like

Great to hear! Thanks for the follow-up.

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