diff --git a/.gitignore b/.gitignore index 7c4ab4c6..a851fa3c 100644 --- a/.gitignore +++ b/.gitignore @@ -40,6 +40,8 @@ examples/* !examples/Makefile cov-int libxlsxwriter-coverity.tgz +.scannerwork/ +.sonar_output/ third_party/zlib-1.2.8/configure.log third_party/zlib-1.2.8/contrib/minizip/miniunz diff --git a/Makefile b/Makefile index bcb06390..2ff86607 100644 --- a/Makefile +++ b/Makefile @@ -164,6 +164,26 @@ coverity: all $(Q)$(MAKE) -C src clean $(Q)rm -f lib/* + +# Run sonarcloud analysis. +sonarcloud: +ifndef SONAR_TOKEN + @echo "Please define SONAR_TOKEN to run this analysis." + @exit 1 +endif + + $(Q)$(MAKE) clean + $(Q)../sonar-scanner-4.6.1.2450-macosx/bin/build-wrapper-macosx-x86 --out-dir .sonar_output make all + $(Q)../sonar-scanner-4.6.1.2450-macosx/bin/sonar-scanner \ + -Dsonar.organization=jmcnamara-github \ + -Dsonar.projectKey=jmcnamara_libxlsxwriter \ + -Dsonar.sources=src \ + -Dsonar.sourceEncoding=UTF-8 \ + -Dsonar.cfamily.build-wrapper-output=.sonar_output \ + -Dsonar.host.url=https://sonarcloud.io \ + -Dsonar.cfamily.threads=4 \ + -Dsonar.cfamily.cache.enabled=false + # Run a scan-build static analysis. scan_build: all $(Q)$(MAKE) -C src clean