Objc-C files not being ignored (iOS build)

ERROR: Caused by: Line 2247 of report refers to a file with an unknown language: Coverage_Build/xyz/SourcePackages/checkouts/Amplitude-iOS/Sources/Amplitude/AMPDatabaseHelper.m

Amplitude is a third party library we are using, integrated via SPM. We do not need this (or any of the third party library source code) to be analyzed.

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube - sonar-scanner 4.5.0.2216

  • what are you trying to achieve
    Code coverage reporting for an iOS project

  • what have you tried so far to achieve this

  1. Settings in sonar.project.properties to ignore C/C++/Objective-C files
    sonar.c.file.suffixes=-
    sonar.cpp.file.suffixes=-
    sonar.objc.file.suffixes=-

To confirm that this was being read, I tried a run with
sonar.objc.file.suffixes=m.
which resulted in a failure because we don’t have the wrapper stuff. We don’t want to analyze any of the C languages, so we don’t plan to add the wrapper. This was just a test to confirm that the settings were being read. They are.

  1. Settings in sonar.project.properties to exclude the SourcePackages directory
    tried
    sonar.exclusions=Coverage_Build/xyz/SourcePackages,...

and

sonar.exclusions=SourcePackages,...

I’d be grateful for any help anyone can offer with this issue. THanks!

EDIT/UPDATE: After switching the third party library manager for the Amplitude package from the native SPM (Swift Package Manager) to Cocoapods, the error did not occur for Amplitude, but rather the next 3rd party library on the list of libraries integrated via SPM. I’m not sure what to do with this information and still look forward to any suggestions anyone may have. (Reverting back to cocoapods would be a pretty large setback for us.)

Hey there.

Another way of looking at this problem: why is your Test Coverage/Execution report referring to a third-party library?

Thanks Colin. That is an excellent question. I am (also) trying to exclude those libraries from … oh… the report! Right. Sonar is just looking at the report that is generated by slather. Thanks! I’ll try to adjust that and report back.

EDIT/UPDATE:
Fixed the issue by feeding a specific set of directories to sonar.source instead of just:

sonar.sources=.