Wildcards in sonar.coverageReportPaths?

We are switching from opencover coverage reports to Sonar’s generic coverage. Is it possible to use wildcards in sonar.coverageReportPaths? I’m trying to pass the following parameter to sonar-dotnet:

/d:sonar.coverageReportPaths='**/SonarQube.xml'

Which fails with

ERROR: Error during SonarScanner execution
java.lang.IllegalArgumentException: Unable to resolve path '**/SonarQube.xml'
	at org.sonar.api.batch.fs.internal.DefaultFileSystem.resolvePath(DefaultFileSystem.java:227)
	at org.sonar.scanner.genericcoverage.GenericCoverageSensor.execute(GenericCoverageSensor.java:100)
	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:62)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:75)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:51)
	at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:64)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:173)
	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:169)
	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:140)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
	at org.sonar.scanner.bootstrap.ScannerContainer.doAfterStart(ScannerContainer.java:398)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:128)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:57)
	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:51)
	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
	at jdk.proxy1/jdk.proxy1.$Proxy0.execute(Unknown Source)
	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:126)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:81)
	at org.sonarsource.scanner.cli.Main.main(Main.java:62)
Caused by: java.io.IOException: Bad pathname
	at java.base/java.io.WinNTFileSystem.canonicalize0(Native Method)
	at java.base/java.io.WinNTFileSystem.canonicalize(WinNTFileSystem.java:462)
	at java.base/java.io.File.getCanonicalPath(File.java:626)
	at java.base/java.io.File.getCanonicalFile(File.java:651)
	at org.sonar.api.batch.fs.internal.DefaultFileSystem.resolvePath(DefaultFileSystem.java:225)
	... 32 more
ERROR: 
The SonarScanner did not complete successfully

When I use sonar.cs.opencover.reportsPaths the same thing works fine.

Hey there.

This analysis parameter (for whatever reason) doesn’t accept glob patterns.

Can you tell me what tool you’re using to switch away from OpenCover that supports SonarQube generic coverage? I didn’t find one in our documentation on .NET Test Coverage.

Hi Colin,

I’m using Unity’s code coverage package. I was advised to SonarQube generic coverage because the OpenCover report has incorrect coverage for partial classes. The coverage is reported for the wrong file.

Would it be possible to add support for glob patterns in that parameter?

@Colin where should I file a bug report/feature request about this?

Hey there.

You’re already in the right place! But these things take time – and the right team has been notified of your feedback already.

Hi @Nezz ,

Thanks for taking the time to raise this point!

Before considering this feature request, we’re curious:

Why do you need wildcards? Is there an issue with passing a comma-delimited list?

We run our tests in parallel on several machines, and the test results are then gathered using the glob once all the test suites finish. The comma delimited list is not as convenient as the glob.

Sorry, I’m still trying to get a sense of how useful it would be.

Even if it is a bit more work to list all locations, it is still a one-time configuration, with the occasional adjustment. Or am I missing something in your setup?

Hi, also supporting this improvement.
Globbing support is already built-in for many properties, and it is just so convenient when relying on static sonar.properties file instead of dynamic parameters.
Not sure to understand why it is not already available for coverageReportPaths, but surely scanner dev team has everything ready in the code base :+1: