Skip to content

Commit fd75183

Browse files
authored
Merge pull request Idean#88 from STEAMULO/fixCoverage
Fix coverage with mixed objc swift project
2 parents a8d914e + 1700e3a commit fd75183

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

sonar-project.properties

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ sonar.sourceEncoding=UTF-8
6262
# Change it only if you generate the file on your own
6363
# sonar.swift.lizard.report=sonar-reports/lizard-report.xml
6464

65-
# Cobertura report generated by run-sonar.sh is stored in sonar-reports/coverage.xml
65+
# Cobertura report generated by run-sonar.sh is stored in sonar-reports/coverage-swift.xml
6666
# Change it only if you generate the file on your own
67-
# sonar.swift.coverage.reportPattern=sonar-reports/coverage*.xml
67+
# sonar.swift.coverage.reportPattern=sonar-reports/coverage-swift*.xml
6868

6969
# OCLint report generated by run-sonar.sh is stored in sonar-reports/oclint.xml
7070
# Change it only if you generate the file on your own

src/main/java/org/sonar/plugins/swift/coverage/SwiftCoberturaSensor.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public final class SwiftCoberturaSensor implements Sensor {
3838
private static final Logger LOGGER = LoggerFactory.getLogger(SwiftCoberturaSensor.class);
3939

4040
public static final String REPORT_PATTERN_KEY = SwiftPlugin.PROPERTY_PREFIX + ".coverage.reportPattern";
41-
public static final String DEFAULT_REPORT_PATTERN = "sonar-reports/coverage*.xml";
41+
public static final String DEFAULT_REPORT_PATTERN = "sonar-reports/coverage-swift*.xml";
4242

4343
private final ReportFilesFinder reportFilesFinder;
4444

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ if [ "$unittests" = "on" ]; then
261261

262262
# Put default xml files with no tests and no coverage...
263263
echo "<?xml version='1.0' encoding='UTF-8' standalone='yes'?><testsuites name='AllTestUnits'></testsuites>" > sonar-reports/TEST-report.xml
264-
echo "<?xml version='1.0' ?><!DOCTYPE coverage SYSTEM 'http://cobertura.sourceforge.net/xml/coverage-03.dtd'><coverage><sources></sources><packages></packages></coverage>" > sonar-reports/coverage.xml
264+
echo "<?xml version='1.0' ?><!DOCTYPE coverage SYSTEM 'http://cobertura.sourceforge.net/xml/coverage-03.dtd'><coverage><sources></sources><packages></packages></coverage>" > sonar-reports/coverage-swift.xml
265265

266266
echo -n 'Running tests'
267267
buildCmd=(xcodebuild clean build test)
@@ -312,7 +312,7 @@ if [ "$unittests" = "on" ]; then
312312
echo "${slatherCmd[@]}"
313313

314314
runCommand /dev/stdout "${slatherCmd[@]}"
315-
mv sonar-reports/cobertura.xml sonar-reports/coverage.xml
315+
mv sonar-reports/cobertura.xml sonar-reports/coverage-swift.xml
316316
fi
317317

318318
# SwiftLint

0 commit comments

Comments
 (0)