Comments (17)
Any chance this issue gets some attention from maintainers? At least some indication about whether this feature request makes sense or not.. ?
Ping @andrey-tyukin-sonarsource, @vilchik-elena ...
from sonarjs.
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}"
from sonarjs.
Also badly need this feature for js/ts
from sonarjs.
Is there any chance to see this issue resolved soon?
from sonarjs.
I'm still having this problem. I've tried both * and ** with no luck with sonar.javascript.lcov.reportPaths
Using
export SONAR_SCANNER_VERSION="5.0.1.3006"
And
"sonarqube-scanner": "^3.3.0
Error:
14:47:08 INFO: No LCOV files were found using /home/ec2-user/workspace/Client/some-workspace/test-results/coverage/*.lcov.info
14:47:08 WARN: No coverage information will be saved because all LCOV files cannot be found.
I archived the test-results/coverage
folder as part of the Jenkins job, and verified the path is correct and should have matched 4 files. Also, from the error, it does not sound like it is using the code that was in the fix for this issue.
What version needs to be used to obtain the fix?
from sonarjs.
+1
As regards SQ < 6.2: I suggest we simply pick the cheapest solution between support and non support of wild cards.
from sonarjs.
Bump. This would be very helpful!
from sonarjs.
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
from sonarjs.
Would still love this!
from sonarjs.
๐
Need support for wildcards for sonar.typescript.lcov.reportPaths
really desperate....
from sonarjs.
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 packages
folder name to the root folder of your projects should find the exact locations for you.
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.
The if
statement is where you could add any folders you would like it to skip.
This means that you can set SonarQube reportPaths
like:
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) ๐งก
from sonarjs.
There is implementation for wildcard support in sonarGo and SonarPython. We should migrate it to sonar-analyzer-commons
from sonarjs.
so Could we use wildcards to . sonar.jacoco.reportPaths now ?
from sonarjs.
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.
from sonarjs.
@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
from sonarjs.
Would love this too - and not only for SonarJS but not only for coverage report paths but others as well, like:
- sonar.javascript.lcov.reportPaths
- sonar.typescript.tslint.reportPaths
- sonar.testExecutionReportPaths (generic report)
As @vilchik-elena said, they all share a common logic located in sonar-analyzer-commons
(https://github.com/SonarSource/sonar-analyzer-commons/blob/master/commons/src/main/java/org/sonarsource/analyzer/commons/ExternalReportProvider.java#L35) - can't we simply adapt it to support ANT-style patterns for instance?
Would you consider a PR for this ?
from sonarjs.
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.
from sonarjs.
Related Issues (20)
- Do not count LOCs for CSS files indexed as test files
- Exclude assignment expressions to `require()` from copy-paste detection HOT 1
- javascript/S6654.html is missing `Of` in references to prototype getter/setter methods of Object
- Fix FP S6754 (`hook-use-state`): Ignore state variables without a setter
- Fix FP S2699 (`assertions-in-tests`): Add support for `supertest` HOT 1
- Fix FP S6747 (`no-unknown-property`): Don't raise for `css` attribute HOT 1
- Fix FP S6747 (`no-unknown-property`): Don't raise for allowed attributes HOT 1
- Fix FP S6747 (`no-unknown-property`): Don't raise issues from `eslint-plugin-react/no-unknown-property` when react is not used HOT 1
- Embedded Node.js runtime: detect the host architecture correctly in MacOS JRE Intel virtualization HOT 1
- Fix FP S6754 (`hook-use-state`): Add exception when using `useState` for components HOT 1
- Embedded Node.js: when `sonar.nodejs.forceHost` is set, do not deploy the runtime HOT 1
- Remove usage of deprecated logging APIs
- JS-18 S6819 False Positive when using SAP UI5 React components HOT 1
- Use 18.17.0 as minimum version for Node.JS
- Ignore runtime errors when saving cpd tokens
- Incorrect S6757 Error for Class Components HOT 8
- We should skip the whole file when we fail to save CPD token
- False positive of S4165 HOT 4
- dwadw
- Error: Cannot find module 'jsx-ast-utils' HOT 18
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sonarjs.