Skip to content

Commit 808835a

Browse files
Updated run-sonar-swift.sh and sonar-project.properties
1 parent e9d4f45 commit 808835a

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

sonar-project.properties

+4
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ sonar.sourceEncoding=UTF-8
4646
# The XML files have to be prefixed by TEST- otherwise they are not processed
4747
# sonar.junit.reportsPath=sonar-reports/
4848

49+
# Lizard report generated by run-sonar.sh is stored in sonar-reports/lizard-report.xml
50+
# Change it only if you generate the file on your own
51+
# sonar.swift.lizard.report=sonar-reports/lizard-report.xml
52+
4953
# Cobertura report generated by run-sonar.sh is stored in sonar-reports/coverage.xml
5054
# Change it only if you generate the file on your own
5155
# sonar.swift.coverage.reportPattern=sonar-reports/coverage*.xml

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

+16
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ function runCommand() {
124124
vflag=""
125125
nflag=""
126126
swiftlint="on"
127+
lizard="on"
128+
127129
while [ $# -gt 0 ]
128130
do
129131
case "$1" in
@@ -165,6 +167,8 @@ fi
165167
srcDirs=''; readParameter srcDirs 'sonar.sources'
166168
# The name of your application scheme in Xcode
167169
appScheme=''; readParameter appScheme 'sonar.swift.appScheme'
170+
# The name of your test scheme in Xcode
171+
testScheme=''; readParameter testScheme 'sonar.swift.testScheme'
168172

169173
# Read destination simulator
170174
destinationSimulator=''; readParameter destinationSimulator 'sonar.swift.simulator'
@@ -276,6 +280,18 @@ else
276280
echo 'Skipping SwiftLint (test purposes only!)'
277281
fi
278282

283+
# Lizard Complexity
284+
if [ "$lizard" = "on" ]; then
285+
if hash lizard 2>/dev/null; then
286+
echo -n 'Running Lizard...'
287+
lizard --xml "$srcDirs" > sonar-reports/lizard-report.xml
288+
else
289+
echo 'Skipping Lizard (not installed!)'
290+
fi
291+
else
292+
echo 'Skipping Lizard (test purposes only!)'
293+
fi
294+
279295
# SonarQube
280296
echo -n 'Running SonarQube using SonarQube Runner'
281297
runCommand /dev/stdout sonar-runner

0 commit comments

Comments
 (0)