SonarQube Developer Edition Version 9.2.4 (build 50792)
I am trying to exclude a directory of files from SQ code coverage reports but they are still included in the coverage reports for master and PR branches. This is a problem because I have a quality gate that includes test coverage.
From project properties (in SonarQube UI) for sonar.coverage.exclusions
upgrade/**/*,lib/postgres.js
From SonarQube log:
22:34:42 INFO: Project configuration:
22:34:42 INFO: Excluded sources: **/node_modules/**, coverage/**, **/test/**, testc/**, testb/**, testwo/**, routesb/**, routeswo/**, doc/**, .idea/**, .migration/**, .portal/**, **/*.yaml, **/*.yml, **/*.json, **/*.html, **/*.htm, **/*.sql, routes/integration.js
22:34:42 INFO: Excluded sources for coverage: upgrade/**/*,lib/postgres.js
22:34:43 INFO: 444 files indexed
22:34:43 INFO: 28177 files ignored because of inclusion/exclusion patterns
22:34:43 INFO: 0 files ignored because of scm ignore settings
Directories/files I want to exclude:
upgrade/upgrade.js
upgrade/steps/1/
upgrade/steps/2/
…
upgrade/steps/75/
Observed behaviour:
-
PR with new code in upgrade/steps/75/ failed SonarQube Quality Gate
‘0.0% Coverage on New Code (is less than 70%)’ -
SonarQube UI shows lots of files under upgrade/ with low coverage, including upgrade.upgrade.js and lib/postgres.js which is also on the exclude list
https://<my_server>/component_measures?id=velox%3Aapim&metric=coverage&view=list
Hopefully I am just doing something wrong. Help appreciated.
I have some settings in sonar-project.properties file, but not sonar.coverage property.
I am adding that now to see if it makes any difference.