From 4e7aeca3b7ab4e943f22b6bab5d720ea0471290f Mon Sep 17 00:00:00 2001 From: Jonathan White Date: Mon, 18 Jun 2018 23:34:30 -0400 Subject: [PATCH] Add support for SonarCloud analysis --- .gitignore | 3 ++- cmake/CodeCoverage.cmake | 4 ++++ sonar-project.properties | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 sonar-project.properties diff --git a/.gitignore b/.gitignore index c96688e9f..903910a37 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,5 @@ release*/ *.swp .DS_Store -.version \ No newline at end of file +.version +\.scannerwork/ diff --git a/cmake/CodeCoverage.cmake b/cmake/CodeCoverage.cmake index a0b0ef526..d10f79723 100644 --- a/cmake/CodeCoverage.cmake +++ b/cmake/CodeCoverage.cmake @@ -131,6 +131,10 @@ FUNCTION(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname) ENDIF() # NOT GENHTML_PATH SET(coverage_info "${CMAKE_BINARY_DIR}/${_outputname}.info") + IF(MINGW) + # Replace C:/ with /C for MINGW + STRING(REGEX REPLACE "^([a-zA-Z]):" "/\\1" coverage_info ${coverage_info}) + ENDIF() SET(coverage_cleaned "${coverage_info}.cleaned") SEPARATE_ARGUMENTS(test_command UNIX_COMMAND "${_testrunner}") diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 000000000..0ba2bee8f --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,18 @@ +# https://about.sonarcloud.io/get-started/ +# Run the SonarCloud tools with the follow parameters: +# Run in the cmake build directory after cmake: build-wrapper-[platform]-x86-64 --out-dir bw-output make clean all +# Run in the project root directory: sonar-scanner.bat -Dsonar.cfamily.build-wrapper-output=build/bw-output -Dsonar.cfamily.gcov.reportsPath=build -Dsonar.login=[AUTH_TOKEN] + +# required metadata +sonar.projectKey=keepassxc +sonar.organization=droidmonkey-github +sonar.projectName=keepassxc +sonar.host.url=https://sonarcloud.io + +# path to source directories (required) +sonar.sources=src +sonar.tests=tests + +sonar.cfamily.threads=2 + +sonar.exclusions=**/zxcvbn/*