-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support wildcards for coverage report paths #578
Comments
+1 |
I use something like { type: 'lcov', dir: 'test/reports/unit/coverage/lcov/', subdir: function(browser) {
// keep a consistent browser name across different OS & browser versions
return browser.toLowerCase().split(/[ /-]/)[0];
}
} to generate a version neutral path. Found at https://github.com/karma-runner/karma-coverage/blob/master/docs/configuration.md |
There is implementation for wildcard support in sonarGo and SonarPython. We should migrate it to sonar-analyzer-commons |
so Could we use wildcards to . sonar.jacoco.reportPaths now ? |
Is there any chance to see this issue resolved soon? |
Would still love this! |
sonar.jacoco.reportPaths and sonar.jacoco.classes .. this does not seem to support wildcards .. is this correct? If so, until this is supported this feels brittle. every time a codebase changes, this forces maintenance of configuration to capture reports and classes. please consider this feature. thanks. |
👍 |
@Rai-Rai since last release (SonarTS 2.0 and SonarJS 6.0) there is single logic and property to load coverage for TS and JS: sonar.javascript.lcov.reportPaths |
Would love this too - and not only for SonarJS but not only for coverage report paths but others as well, like:
As @vilchik-elena said, they all share a common logic located in Would you consider a PR for this ? |
Any chance this issue gets some attention from maintainers? At least some indication about whether this feature request makes sense or not.. ? |
Also badly need this feature for js/ts |
Bump. This would be very helpful! |
Bumping this as well--- currently in a situation where we need to support multiple lcov reports so having it be a capability of Sonar itself would be amazing. |
Note: I am aware that this is now closed and merged in the new version, but for those who cannot upgrade Hi guys, could I suggest using a quick bash script before your SonarQube runs that would identify the file/folder locations for you as a workaround? Putting the below path and updating the Code: - bash: |
for entry in packages/*/
do
if [ "$entry" == "packages/common/" ] ; then
continue;
fi
testPaths=${testPaths}${entry}test-report.xml,
coveragePaths=${coveragePaths}${entry}coverage/lcov.info,
done
testPaths=${testPaths%,}
coveragePaths=${coveragePaths%,}
echo "Test and coverage reports paths found: "
echo "Test reports: $testPaths"
echo "Coverage reports: $coveragePaths"
echo "Setting pipeline variables..."
echo "##vso[task.setvariable variable=TESTPATHS]$testPaths"
echo "##vso[task.setvariable variable=COVERAGEPATHS]$coveragePaths"
displayName: Getting report paths for SonarQube The above task would iterate over the folders and add the files found within the temporary Azure Pipelines variables. This means that you can set SonarQube sonar.testExecutionReportPaths=$(TESTPATHS)
sonar.javascript.lcov.reportPaths=$(COVERAGEPATHS) Let me know if you have found it useful and if it worked for you (in the case where you can't upgrade your SonarQube instance) 🧡 |
This workaround works well too #!/bin/sh
coverage=$(find -type f -name '*coverage.lcov' -printf "%p,")
testResults=$(find -type f -name '*test-result.xml' -printf "%p,")
mvn sonar:sonar \
-Dsonar.projectKey=my.project.key.from.sonarqube \
-Dsonar.host.url=http://mysonarqubeserver.com:9000 \
-Dsonar.login=kd94kaek94ad9duiope67fbn89vbnnn89dw \
-Dsonar.sources="." \
-Dsonar.tests="." \
-Dsonar.test.inclusions="**/*.spec.ts" \
-Dsonar.javascript.lcov.reportPaths="${coverage}" \
-Dsonar.testExecutionReportPaths="${testResults}" |
I'm still having this problem. I've tried both * and ** with no luck with Using
And
Error:
I archived the What version needs to be used to obtain the fix? |
Currently property for coverage LCOV report paths doesn't accept paths with wildcards. This might be very useful when path is not stable (e.g. see question on SOF).
Property name: sonar.javascript.lcov.reportPaths
We should decide whether this feature should be implemented for old properties (still supported for SQ < 6.2):
Example:
"sonar.javascript.lcov.reportPaths=reports/*" would match
reports/report1.lcov
reports/report2.lcov
"sonar.javascript.lcov.reportPaths=**/report.lcov" would match
reports1/report.lcov
reports2/report.lcov
The text was updated successfully, but these errors were encountered: