SonarTsPlugin icon indicating copy to clipboard operation
SonarTsPlugin copied to clipboard

Support for multiple coverage reports

Open afterbangx opened this issue 7 years ago • 6 comments

I've been using this plugin for awhile now and it's been serving our purposes well. However, I now have a solution that just recently added an LCOV report in another project. I'd rather not have to merge them if possible. Does the sonar.ts.coverage.lcovReportPath property support multiple coverage reports? The SonarJS plugin supports multiple coverage reports by sending a comma separated list of LCOV reports. Does this one do the same?

If not, I wouldn't mind taking a stab at implementing this. I haven't practiced my Java skills in awhile but I'm confident I could figure it out. Would this be a fairly simple feature to add or do you think it would be a lot of work?

Example: /d:sonar.ts.coverage.lcovReportPath="MyProj.WebApp\coverage\lcov.info,MyOtherProj.WebApp\coverage\lcov.info"

afterbangx avatar May 10 '17 18:05 afterbangx

Won't happen on its own at the minute I don't think (though given that I lifted the parser code at least from the SonarJS plugin I'm not sure how I missed that as a feature...) - never tried!

Will happily accept a PR if you reckon you can get it working, I think it's probably a pretty straightforward patch around here to split the incoming path on commas and send a proper array of LCOV File objects here - trick would be to support the possibility that the path actually has a comma in it (unlikely, but I've seen weirder things with this project...).

Maybe a fallback approach - if you can't find a file with the full path you've been given, and there are any commas in it then try splitting by comma and iterating? Have a play!

Pablissimo avatar May 11 '17 08:05 Pablissimo

What about changing the delimiter to something that isn't allowed in file names like a | or something? Just trying to think of an easier way than trying to account for paths with commas in them.

Is it possible to pass an array through the command line? I've never tried it. Could add an additional property to support multiple coverage reports. Something like /d:sonar.ts.coverage.lcovReportPaths=["singe/path/lcov.info","single/path/with,comma/lcov.info"]

afterbangx avatar May 11 '17 18:05 afterbangx

I don't know about that actually, to be honest I'd maybe start with just splitting by comma so that the behaviour matches the SonarJS one and then we can see if we want to expand that (after a bit more thought I reckon if it works well enough for them we'll probably be fine)

Pablissimo avatar May 12 '17 11:05 Pablissimo

Did this PR fix this issue? I still can not get it to work!

mohyeid avatar Dec 13 '18 21:12 mohyeid

I seem to remember that it did work for me at the time. I am no longer using this plugin though as I've moved on to a different company that is not using SonarQube. I can't say if it is still working.

amilbeck avatar Dec 13 '18 22:12 amilbeck

@amilbeck Thanks for confirming. Do you recall if the delimiter was comma? Or something else? Also does it stay sonar.ts.coverage.lcovReportPath or sonar.ts.coverage.lcovReportPaths? or maybe a new one? I tried all above possibilities and did not work.

mohyeid avatar Dec 14 '18 02:12 mohyeid