From 17b311c9980275d930160c306a1c763c36665842 Mon Sep 17 00:00:00 2001 From: David Yang Date: Fri, 17 Mar 2017 10:02:48 +0100 Subject: [PATCH 1/2] Add -nounittests and -usesonarscanner parameters to run-sonar.sh script --- src/main/shell/run-sonar.sh | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/main/shell/run-sonar.sh b/src/main/shell/run-sonar.sh index c2df8ed3..a48c66a5 100755 --- a/src/main/shell/run-sonar.sh +++ b/src/main/shell/run-sonar.sh @@ -123,16 +123,21 @@ function runCommand() { ## COMMAND LINE OPTIONS vflag="" nflag="" +unittests="on" oclint="on" fauxpas="on" lizard="on" +sonarscanner="" + while [ $# -gt 0 ] do case "$1" in -v) vflag=on;; -n) nflag=on;; - -nooclint) oclint="";; + -nounittests) unittests="";; + -nooclint) oclint="";; -nofauxpas) fauxpas="";; + -usesonarscanner) sonarscanner="on";; --) shift; break;; -*) echo >&2 "Usage: $0 [-v]" @@ -248,7 +253,7 @@ oclint-xcodebuild # Transform the xcodebuild.log file into a compile_command.jso # Unit tests and coverage -if [ "$testScheme" = "" ]; then +if [ "$testScheme" = "" ] || [ "$unittests" = "" ]; then echo 'Skipping tests as no test scheme has been provided!' # Put default xml files with no tests and no coverage... @@ -430,8 +435,21 @@ else fi # SonarQube -echo -n 'Running SonarQube using SonarQube Runner' -runCommand /dev/stdout sonar-runner +if [ "$sonarscanner" = "on" ]; then + echo -n 'Running SonarQube using SonarQube Scanner' + if hash /dev/stdout sonar-scanner 2>/dev/null; then + runCommand /dev/stdout sonar-scanner + else + echo 'Skipping sonar-scanner (not installed!)' + fi +else + echo -n 'Running SonarQube using SonarQube Runner' + if hash /dev/stdout sonar-runner 2>/dev/null; then + runCommand /dev/stdout sonar-runner + else + runCommand /dev/stdout sonar-scanner + fi +fi # Kill progress indicator stopProgress From c27b7748630fca02c253690e052de7ab0131e218 Mon Sep 17 00:00:00 2001 From: David Yang Date: Fri, 17 Mar 2017 10:43:02 +0100 Subject: [PATCH 2/2] Update run-sonar.sh --- src/main/shell/run-sonar.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/shell/run-sonar.sh b/src/main/shell/run-sonar.sh index a48c66a5..fe8d2d16 100755 --- a/src/main/shell/run-sonar.sh +++ b/src/main/shell/run-sonar.sh @@ -254,7 +254,7 @@ oclint-xcodebuild # Transform the xcodebuild.log file into a compile_command.jso # Unit tests and coverage if [ "$testScheme" = "" ] || [ "$unittests" = "" ]; then - echo 'Skipping tests as no test scheme has been provided!' + echo 'Skipping tests!' # Put default xml files with no tests and no coverage... echo "" > sonar-reports/TEST-report.xml