Correct way to submit COV files to Sonar for both Swift and ObjC/C++ at the same time?

Correct way to submit COV files to Sonar for both Swift and ObjC/C++ at the same time?

Sonar version 9.9.4.87374.

Note: We will be updating to a newer version in the coming weeks.

I believe I can get it to coverage for either Swfit or ObjC/C++ but not both.

We are trying not to use the sonarqube-generic-coverage.xml as the conversion to this formate is taking 80% of our scan time, l8 minutes per build.

We have been using this for now which basically multi threads the conversion process.
The conversion is much slower without it.

---- Some sample settings.

works for ObjC/C++

sonar.cfamily.llvm-cov.reportPath=./output/cov_data

works for swift

#sonar.swift.coverage.reportPaths=./output/cov_data

Does not work

#sonar.coverageReportPaths=./output/cov_data

Hi,

Are you saying you have the coverage data for both languages in the same file?

And if so… how?

 
Thx,
Ann

I believe that llvm-cov show, generates coverage date for ObjC/C++/Swift all at once.
It makes a human readable file you can check inside of. The data seems to all be there for all languages. When given to sonar tho it seems to be ignore based on what path I we feed it in through. The notes for cocoa I linked to in the post also suggest using this method.

  • xcrun --run llvm-cov show ./derivedData/Build/Products/Debug-iphonesimulator/MYAPP.app/appbinary --instr-profile ./output/merged_profdata_file >> ./output/cov_data1

this… >> will append other binaries data to the file. So it can be called on multiple binaries if needed.

Hi,

Can you provide your full analysis log?

The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.

This guide will help you find them.

 
Thx,
Ann


### SETTINGS ###
sonar.cfamily.llvm-cov.reportPath=./output/cov_data1
sonar.swift.coverage.reportPaths=./output/cov_data2
sonar.cfamily.compile-commands=./output/compile_commands.json

sonar.log.level=DEBUG

#####

LOG SECTIONS. Not going to bother with the full log at this point.

11:47:43.524 INFO: Sensor Swift Code Quality and Security [swift]

[14593](https://gitlab.tcc.li/climate/mobile/ios/cab/fieldview-cab-ios/-/jobs/6633236/viewer#L14593)

11:47:43.524 INFO: Sensor Swift Code Quality and Security is restricted to changed files only

[14594](https://gitlab.tcc.li/climate/mobile/ios/cab/fieldview-cab-ios/-/jobs/6633236/viewer#L14594)

11:47:43.528 INFO: 3 source files to be analyzed

[14595](https://gitlab.tcc.li/climate/mobile/ios/cab/fieldview-cab-ios/-/jobs/6633236/viewer#L14595)

11:47:44.774 INFO: 3/3 source files have been analyzed

[14596](https://gitlab.tcc.li/climate/mobile/ios/cab/fieldview-cab-ios/-/jobs/6633236/viewer#L14596)

11:47:45.049 INFO: Parse coverage report (./output/cov_data2)

[14597](https://gitlab.tcc.li/climate/mobile/ios/cab/fieldview-cab-ios/-/jobs/6633236/viewer#L14597)

11:47:45.052 DEBUG: Can't parse hits number in coverage report: 1.63k. Value of 1 will be saved for this line.

[14598](https://gitlab.tcc.li/climate/mobile/ios/cab/fieldview-cab-ios/-/jobs/6633236/viewer#L14598)

11:47:45.052 DEBUG: Can't parse hits number in coverage report: 1.63k. Value of 1 will be saved for this line.

[14599](https://gitlab.tcc.li/climate/mobile/ios/cab/fieldview-cab-ios/-/jobs/6633236/viewer#L14599)

11:47:45.053 DEBUG: Can't parse hits number in coverage report: 1.12k. Value of 1 will be saved for this line.

[14600](https://gitlab.tcc.li/climate/mobile/ios/cab/fieldview-cab-ios/-/jobs/6633236/viewer#L14600)

11:47:45.053 DEBUG: Can't parse hits number in coverage report: 1.12k. Value of 1 will be saved for this line.

11:48:02.395 INFO: Sensor Swift Code Quality and Security [swift] (done) | time=18870ms

### About a million of that 1 error



[79936](https://gitlab.tcc.li/climate/mobile/ios/cab/fieldview-cab-ios/-/jobs/6633236/viewer#L79936)

11:48:02.396 INFO: Sensor llvm-cov [cpp]

[79937](https://gitlab.tcc.li/climate/mobile/ios/cab/fieldview-cab-ios/-/jobs/6633236/viewer#L79937)

11:48:02.397 INFO: Parsing /Users/gitlabbuilder/builds/HaLiZaLUD/0/climate/mobile/ios/cab/fieldview-cab-ios/./output/cov_data1

[79938](https://gitlab.tcc.li/climate/mobile/ios/cab/fieldview-cab-ios/-/jobs/6633236/viewer#L79938)

11:48:03.131 INFO: Sensor llvm-cov [cpp] (done) | time=735ms

[79939](https://gitlab.tcc.li/climate/mobile/ios/cab/fieldview-cab-ios/-/jobs/6633236/viewer#L79939)

11:48:03.131 INFO: Sensor JaCoCo XML Report Importer [jacoco]

[79940](https://gitlab.tcc.li/climate/mobile/ios/cab/fieldview-cab-ios/-/jobs/6633236/viewer#L79940)

11:48:03.133 INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml

[79941](https://gitlab.tcc.li/climate/mobile/ios/cab/fieldview-cab-ios/-/jobs/6633236/viewer#L79941)

11:48:03.134 INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer

[79942](https://gitlab.tcc.li/climate/mobile/ios/cab/fieldview-cab-ios/-/jobs/6633236/viewer#L79942)

11:48:03.134 INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=3ms

[79943](https://gitlab.tcc.li/climate/mobile/ios/cab/fieldview-cab-ios/-/jobs/6633236/viewer#L79943)

11:48:03.134 INFO: Sensor JavaScript inside YAML analysis [javascript]

[79944](https://gitlab.tcc.li/climate/mobile/ios/cab/fieldview-cab-ios/-/jobs/6633236/viewer#L79944)

11:48:03.148 INFO: No input files found for analysis

[79945](https://gitlab.tcc.li/climate/mobile/ios/cab/fieldview-cab-ios/-/jobs/6633236/viewer#L79945)

11:48:03.148 INFO: Hit the cache for 0 out of 0

[79946](https://gitlab.tcc.li/climate/mobile/ios/cab/fieldview-cab-ios/-/jobs/6633236/viewer#L79946)

11:48:03.149 INFO: Miss the cache for 0 out of 0

That gives us this… which seems to be SWIFT but not Obj/C++ if I understand this correctly… and I am not sure I do :slight_smile:

Hi,

I really would like to see the full analysis log.

 
Thx,
Ann

Here you go.

sonar_log1.txt (9.6 MB)