-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Sonarcloud sonar-project.properties #127
Conversation
Fixes the emitted sonar.properties file so that header and test files are picked up by Sonarcloud analysis. According to the docs `sonar.tests` is ignored for C/C++ code, so test paths should be treated the same as source paths. Also switches `sonar.inclusions` with `sonar.sources` to fix the include paths being filtered out.
Fixes code coverage builds by switching to using the sonar.inclusions property. Some of our build targets set their source directories in the include paths. Those paths are then emitted in the sonar-project.properties file here. The issue is that this can lead to files being indexed twice which the sonar-scanner treats as an error. Using the `sonar.inclusions` property and adding pattern strings avoids this issue.
Kudos, SonarCloud Quality Gate passed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good but I would like to see some tests that activate the coverage.
list(JOIN test_files ",${_sonarcloud_newline}" sonar_tests) | ||
string(APPEND sonarcloud_project_properties_content "sonar.tests.inclusions=${_sonarcloud_newline}${sonar_tests}\n") | ||
foreach(source_file ${source_source_files}) | ||
list(REMOVE_ITEM test_files ${source_file}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the purpose of this? There's intersection between these sets of files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, e.g.: swiftlets-core
library and unit-test-swiftlets-harness
test target have threaded_swiftlet.cc
source file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM let's give it a go.
The purpose of this PR is to generate code coverage from the headers which are included only in the test cases.
This PR:
sonar.inclusions
propertysonar.coverage.exclusions
property