-
Notifications
You must be signed in to change notification settings - Fork 788
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
Add relative option to lcov format files. #771
base: master
Are you sure you want to change the base?
Conversation
Looking forward to seeing this released. It'll clean up the need to do post-processing on the generated lcov file. |
I have a real need for this as well. I hope to see it merged soon. |
Hi, is there any update as to when this is likely to be released, we're having issues with sonarqube and istanbul because of absolute vs relative paths ? |
As a workaround I'm using sed to modify the file after it's been generated. Something like this:
|
You are the man, that’s been driving me insane all week ☺ Any plans to implement a permanent solution ?
From: titocr <notifications@github.com>
Reply-To: gotwarlost/istanbul <reply@reply.github.com>
Date: Thursday, 7 September 2017 at 23:39
To: gotwarlost/istanbul <istanbul@noreply.github.com>
Cc: Tim Heap <Tim.Heap@bglgroup.co.uk>, Manual <manual@noreply.github.com>
Subject: [EXTERNAL] Re: [gotwarlost/istanbul] Add relative option to lcov format files. (#771)
As a workaround I'm using sed to modify the file after it's been generated. Something like this:
# convert absolute paths to relative before sonar runs
sed -i 's|SF:/part_of_path_i_want_to_go_away/|SF:|g' coverage/report-lcov/lcov.info
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<#771 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AGqbywr8S63WDYxEKC8o4coNUWWDekUCks5sgHCkgaJpZM4MPWw5>.
…________________________________
This message is intended for the stated addressee(s) only and may be confidential. Access to this email by anyone else is unauthorised. Any opinions expressed in this email do not necessarily reflect the opinions of BGL Group Limited and its subsidiaries . Any unauthorised disclosure, use or dissemination, either whole or in part is prohibited. If you are not the intended recipient of this message, please notify the sender immediately.
Please scan all attachments for viruses.
|
Glad to help. As for a permanent fix, as I understand it, it's sitting here with the commit @miguelrincon did. I'm just waiting on it like everyone else ;-) |
Yes I saw that post ☺
From: titocr <notifications@github.com>
Reply-To: gotwarlost/istanbul <reply@reply.github.com>
Date: Saturday, 9 September 2017 at 18:06
To: gotwarlost/istanbul <istanbul@noreply.github.com>
Cc: Tim Heap <Tim.Heap@bglgroup.co.uk>, Manual <manual@noreply.github.com>
Subject: [EXTERNAL] Re: [gotwarlost/istanbul] Add relative option to lcov format files. (#771)
Glad to help. As for a permanent fix, as I understand it, it's sitting here with the commit @miguelrincon<https://github.com/miguelrincon> did. I'm just waiting on it like everyone else ;-)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<#771 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AGqby8VRQnSiCvukEP8ZROXpyE5K9Rlrks5sgsWfgaJpZM4MPWw5>.
…________________________________
This message is intended for the stated addressee(s) only and may be confidential. Access to this email by anyone else is unauthorised. Any opinions expressed in this email do not necessarily reflect the opinions of BGL Group Limited and its subsidiaries . Any unauthorised disclosure, use or dissemination, either whole or in part is prohibited. If you are not the intended recipient of this message, please notify the sender immediately.
Please scan all attachments for viruses.
|
Hi, still struggling with getting this working on CI.
If I have a file called lcov.info which contains this line :
SF:deploy/app/shared/services/sharedServicesModule.js
And I simply want to remove the deploy/ part so it becomes SF:app/shared/services/sharedServicesModule.js
then this should work, right ?
sed -i 's|SF:deploy/|SF:|g'
From: titocr <notifications@github.com>
Reply-To: gotwarlost/istanbul <reply@reply.github.com>
Date: Saturday, 9 September 2017 at 18:06
To: gotwarlost/istanbul <istanbul@noreply.github.com>
Cc: Tim Heap <Tim.Heap@bglgroup.co.uk>, Manual <manual@noreply.github.com>
Subject: [EXTERNAL] Re: [gotwarlost/istanbul] Add relative option to lcov format files. (#771)
Glad to help. As for a permanent fix, as I understand it, it's sitting here with the commit @miguelrincon<https://github.com/miguelrincon> did. I'm just waiting on it like everyone else ;-)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<#771 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AGqby8VRQnSiCvukEP8ZROXpyE5K9Rlrks5sgsWfgaJpZM4MPWw5>.
…________________________________
This message is intended for the stated addressee(s) only and may be confidential. Access to this email by anyone else is unauthorised. Any opinions expressed in this email do not necessarily reflect the opinions of BGL Group Limited and its subsidiaries . Any unauthorised disclosure, use or dissemination, either whole or in part is prohibited. If you are not the intended recipient of this message, please notify the sender immediately.
Please scan all attachments for viruses.
|
Our CI is jenkins and this is the line I use (changed only the last part of the path). I had to try a couple different things before discovering what path was needed.
An altered line in lcov.info, before and after:
Hope that helps. |
Thanks I have this working now.
From: titocr <notifications@github.com>
Reply-To: gotwarlost/istanbul <reply@reply.github.com>
Date: Monday, 11 September 2017 at 15:59
To: gotwarlost/istanbul <istanbul@noreply.github.com>
Cc: Tim Heap <Tim.Heap@bglgroup.co.uk>, Manual <manual@noreply.github.com>
Subject: [EXTERNAL] Re: [gotwarlost/istanbul] Add relative option to lcov format files. (#771)
Our CI is jenkins and this is the line I use (changed only the last part of the path). I had to try a couple different things before discovering what path was needed.
sed -i 's|SF:/opt/jenkins/workspace/myProject/|SF:|g' coverage/report-lcov/lcov.info
An altered line in lcov.info, before and after:
SF:/opt/jenkins/workspace/myProject/src/app/config/app_config.js
SF:src/app/config/app_config.js
Hope that helps.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<#771 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AGqby67cPJIEaRtInSBNN3rwyys80LJ-ks5shUq9gaJpZM4MPWw5>.
…________________________________
This message is intended for the stated addressee(s) only and may be confidential. Access to this email by anyone else is unauthorised. Any opinions expressed in this email do not necessarily reflect the opinions of BGL Group Limited and its subsidiaries . Any unauthorised disclosure, use or dissemination, either whole or in part is prohibited. If you are not the intended recipient of this message, please notify the sender immediately.
Please scan all attachments for viruses.
|
Hi, does Istanbul run on windows for c sharp code , and if not are there any plans for it in the future ? looking at ways of surfacing code coverage with sonarqube for some of our projects.
From: titocr <notifications@github.com>
Reply-To: gotwarlost/istanbul <reply@reply.github.com>
Date: Monday, 11 September 2017 at 15:59
To: gotwarlost/istanbul <istanbul@noreply.github.com>
Cc: Tim Heap <Tim.Heap@bglgroup.co.uk>, Manual <manual@noreply.github.com>
Subject: [EXTERNAL] Re: [gotwarlost/istanbul] Add relative option to lcov format files. (#771)
Our CI is jenkins and this is the line I use (changed only the last part of the path). I had to try a couple different things before discovering what path was needed.
sed -i 's|SF:/opt/jenkins/workspace/myProject/|SF:|g' coverage/report-lcov/lcov.info
An altered line in lcov.info, before and after:
SF:/opt/jenkins/workspace/myProject/src/app/config/app_config.js
SF:src/app/config/app_config.js
Hope that helps.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<#771 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AGqby67cPJIEaRtInSBNN3rwyys80LJ-ks5shUq9gaJpZM4MPWw5>.
…________________________________
This message is intended for the stated addressee(s) only and may be confidential. Access to this email by anyone else is unauthorised. Any opinions expressed in this email do not necessarily reflect the opinions of BGL Group Limited and its subsidiaries . Any unauthorised disclosure, use or dissemination, either whole or in part is prohibited. If you are not the intended recipient of this message, please notify the sender immediately.
Please scan all attachments for viruses.
|
I would love to see this merged. Our build pipeline includes running tests on one docker container and using instanbul to report coverage in another machine using sonarqube. We really need this option. |
Would also like this change |
any idea if this is likely to happen any time soon ? |
Looks like this repository has been deprecated, nyc is the replacement for this tool, but it too, does not support relative paths. So I've solved this for myself like some others in this thread with |
In a Typescript Angular 6 project I needed to make the path to be that of the Docker image used for the sonar-scanner. Since the path could change in the build pipeline (BitBucker) I used the following sed expression:
where /root/src is the name of the mapped folder of the current folder in the Docker container that was started by the following command:
|
This is such a small change. What's the blocker? Lack of maintainers? |
Hey, it would be a very useful change, what is blocking ? |
I would love to see this merged too ! |
Anything new for this PR ? It would be really useful to have this option ! It's not that I don't like |
2 years and still not merged 🤦♂️ |
What's stopping this from being merged? I really need this feature. |
Someone really enjoys using sed and hacks... :( |
On Github (with actions), I successfully used Thank you @ozoli |
Allow sonar to access the bridge coverage. Apparently codehealth jobs invoke `--if-present test:unit`, not the complete `test` script, so redirect this script to bridge as well. See https://sonarcloud.io/documentation/analysis/coverage/#test-execution https://www.npmjs.com/package/jest-sonar-reporter In order to run coverage only for this codehealth job and to not have that overhead in the normal CI, an extra specialised script is added to the data-bridge package.json. The jest coverage creates absolute paths in lcov.info. However, the tests are run in a docker-container whereas the analysis is performed outside of it and therefore the paths don't match. Since an option to create relative paths in lcov.info is not yet available[0], this uses sed to manually make the paths relative. Also, it seems that collecting coverage is only really useful for unit tests and so the coverage related configuration has been moved there. This patch tries to use the multi module functionality of sonar in order to split up the sonar configuration. It seems promising so far, but whether it really works as intended can probably only be seen after it has been merged into master. [0]: gotwarlost/istanbul#771 [1]: https://docs.sonarqube.org/display/SONARQUBE51/Analyzing+with+SonarQube+Runner#AnalyzingwithSonarQubeRunner-Multi-moduleProject Change-Id: Ic2954e35c7c053eae1ba958751334dc23d2f3f3a
* Update Wikibase from branch 'master' to a00815c9502b58389714fa9f903504e00216606e - Merge "bridge: wire up with sonar" - bridge: wire up with sonar Allow sonar to access the bridge coverage. Apparently codehealth jobs invoke `--if-present test:unit`, not the complete `test` script, so redirect this script to bridge as well. See https://sonarcloud.io/documentation/analysis/coverage/#test-execution https://www.npmjs.com/package/jest-sonar-reporter In order to run coverage only for this codehealth job and to not have that overhead in the normal CI, an extra specialised script is added to the data-bridge package.json. The jest coverage creates absolute paths in lcov.info. However, the tests are run in a docker-container whereas the analysis is performed outside of it and therefore the paths don't match. Since an option to create relative paths in lcov.info is not yet available[0], this uses sed to manually make the paths relative. Also, it seems that collecting coverage is only really useful for unit tests and so the coverage related configuration has been moved there. This patch tries to use the multi module functionality of sonar in order to split up the sonar configuration. It seems promising so far, but whether it really works as intended can probably only be seen after it has been merged into master. [0]: gotwarlost/istanbul#771 [1]: https://docs.sonarqube.org/display/SONARQUBE51/Analyzing+with+SonarQube+Runner#AnalyzingwithSonarQubeRunner-Multi-moduleProject Change-Id: Ic2954e35c7c053eae1ba958751334dc23d2f3f3a
I've put a hack for this in our CI in 2017, it's still an issue now... |
I've added the |
I'd really like to have this 2-year old (and counting) much needed fix to be merged, also! |
When will this be merged, it's been more than 2 years ? |
3+ years and finally approved, Please merge it in |
I started to use |
Believe for the PR to work properly (at least in CLI mode), some additional changes are needed. I've include this PR in my fork istanbul-moos, which includes the fix for the CLI if anyone is interested. |
It seems like many people are interested in it and will never get the fix...
…On Wed, Jul 8, 2020 at 7:06 PM Moos ***@***.***> wrote:
Believe for the PR to work properly (at least in CLI mode), some
additional changes are needed. I've include this PR in my fork
istanbul-moos <https://github.com/moos/istanbul>, which includes the fix
for the CLI
<moos@5ae1f40>
if anyone is interested.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#771 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD6MLMHR57UFYXDMH66IIV3R2UCZ5ANCNFSM4DB5NQ4Q>
.
|
I don't know if I'm authorized to approve the commit but I did it 😅 |
@gotwarlost or someone else with Write Access would have to come click merge... |
Thanks for explanations @Isabello, I just figured out the Deprecation Notice in this repo's
So I suppose we can't expect anything from this pull request 😕 |
Wow it's hard to believe that it's been 2 years and this issue has not been resolved. I also run into exact issue |
@runlevel5 Like I said in post above, this repo is deprecated and, IMO, not maintained anymore. |
Indeed, I believe this issue has been resolved there in the active fork of istanbul as @flaval pointed out. @gotwarlost if you have the time could you archive your original version of istanbul, or at least add a giant banner that it's no longer maintained with a pointer to the current version? This repo still pops up in search results far more than it should. |
When using coverage with lcov files, reports are created using absolute paths.
There is a good reason to want to generate the report using relative paths. This is both for security reasons and when using an external service in another location such as SonarQube in long delivery pipelines.
This PR offers the option to create the reports with relative paths, this option is turned off by default.
Refers to #104