Skip to content
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

Merged
merged 11 commits into from
Aug 26, 2022
16 changes: 13 additions & 3 deletions Sonarcloud.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,23 @@ function(generate_sonarcloud_project_properties sonarcloud_project_properties_pa

set(sonarcloud_project_properties_content "sonar.sourceEncoding=UTF-8\n")

set(source_files ${source_source_files} ${source_include_directories})
set(source_files ${source_source_files} ${source_include_directories} ${test_source_files})
foreach (dir ${source_include_directories})
if(${dir} MATCHES "/$")
set(source_files ${source_files} ${dir}*.h ${dir}**/*.h)
else()
set(source_files ${source_files} ${dir}/*.h ${dir}/**/*.h)
endif()
endforeach()
list(JOIN source_files ",${_sonarcloud_newline}" sonar_sources)
string(APPEND sonarcloud_project_properties_content "sonar.inclusions=${_sonarcloud_newline}${sonar_sources}\n")

set(test_files ${test_source_files})
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})
Copy link
Contributor

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?

Copy link
Contributor Author

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.

endforeach()
list(JOIN test_files ",${_sonarcloud_newline}" sonar_test_files)
string(APPEND sonarcloud_project_properties_content "sonar.coverage.exclusions=${_sonarcloud_newline}${sonar_test_files}\n")

file(GENERATE
OUTPUT "${sonarcloud_project_properties_path}"
Expand Down