Skip to content

Commit 72c984a

Browse files
authored
Merge pull request Idean#73 from Backelite/davidy4ng-patch-usesonarscanner
Add -usesonarscanner parameter
2 parents 31f6da7 + 0643be5 commit 72c984a

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

src/main/shell/run-sonar-swift.sh

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -129,20 +129,22 @@ unittests="on"
129129
swiftlint="on"
130130
tailor="on"
131131
lizard="on"
132+
sonarscanner=""
132133

133134
while [ $# -gt 0 ]
134135
do
135136
case "$1" in
136137
-v) vflag=on;;
137138
-n) nflag=on;;
138139
-nounittests) unittests="";;
139-
-noswiftlint) swiftlint="";;
140-
-notailor) tailor="";;
141-
--) shift; break;;
142-
-*)
140+
-noswiftlint) swiftlint="";;
141+
-notailor) tailor="";;
142+
-usesonarscanner) sonarscanner="on";;
143+
--) shift; break;;
144+
-*)
143145
echo >&2 "Usage: $0 [-v]"
144146
exit 1;;
145-
*) break;; # terminate while loop
147+
*) break;; # terminate while loop
146148
esac
147149
shift
148150
done
@@ -368,11 +370,20 @@ else
368370
fi
369371

370372
# SonarQube
371-
echo -n 'Running SonarQube using SonarQube Runner'
372-
if hash /dev/stdout sonar-runner 2>/dev/null; then
373-
runCommand /dev/stdout sonar-runner
373+
if [ "$sonarscanner" = "on" ]; then
374+
echo -n 'Running SonarQube using SonarQube Scanner'
375+
if hash /dev/stdout sonar-scanner 2>/dev/null; then
376+
runCommand /dev/stdout sonar-scanner
377+
else
378+
echo 'Skipping sonar-scanner (not installed!)'
379+
fi
374380
else
375-
runCommand /dev/stdout sonar-scanner
381+
echo -n 'Running SonarQube using SonarQube Runner'
382+
if hash /dev/stdout sonar-runner 2>/dev/null; then
383+
runCommand /dev/stdout sonar-runner
384+
else
385+
runCommand /dev/stdout sonar-scanner
386+
fi
376387
fi
377388

378389
# Kill progress indicator

0 commit comments

Comments
 (0)