Skip to content
This repository has been archived by the owner on Aug 24, 2019. It is now read-only.

Commit

Permalink
Merge pull request #23 from Backelite/davidy4ng-patch-run-sonar-params
Browse files Browse the repository at this point in the history
Add -nounittests and -usesonarscanner parameters to run-sonar.sh script
  • Loading branch information
zippy1978 authored Apr 21, 2017
2 parents 418557b + c27b774 commit 72b10cf
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions src/main/shell/run-sonar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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]"
Expand Down Expand Up @@ -247,8 +252,8 @@ runCommand xcodebuild.log "${buildCmd[@]}"
cat xcodebuild.log | $XCPRETTY_CMD -r json-compilation-database -o compile_commands.json

# Unit tests and coverage
if [ "$testScheme" = "" ]; then
echo 'Skipping tests as no test scheme has been provided!'
if [ "$testScheme" = "" ] || [ "$unittests" = "" ]; then
echo 'Skipping tests!'

# Put default xml files with no tests and no coverage...
echo "<?xml version='1.0' encoding='UTF-8' standalone='yes'?><testsuites name='AllTestUnits'></testsuites>" > sonar-reports/TEST-report.xml
Expand Down Expand Up @@ -429,8 +434,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
Expand Down

0 comments on commit 72b10cf

Please sign in to comment.