Is it possible to upload test execution and coverage data separately from running sonar-scanner analysis?

I’m migrating from Code Climate to SonarCloud, and in my continuous delivery pipeline (CircleCI), I’m currently running my code analysis job in parallel with my tests job (in separate containers).
I’d like to be able to keep that same structure, where I’d trigger code analysis via sonar-scanner in that code analysis job, then upload my coverage and test execution data separately after my test job is completed.
Is this possible, or does everything (scanning, eslint results, coverage, test results) have to be sent together?

1 Like

Hi,

No it’s not possible.
The coverage report must be run before sonar-scanner. And the coverage report must be passed as parameter when executing the scanner, it cannot be uploaded afterwards.

Best,

This would be a very useful feature. Analysis takes quite a lot of time and it would be great if code analysis could be run in parallel with tests (producing coverage report) and other checks (e.g bandit analysis).
And then when all that is done separately post the results to the server in one last step.

We agree that it would be useful to be able to create an analysis in multiple “steps”.
We plan to implement it at some point but we don’t have a short term plan yet.

Thanks @benoit. Obviously I agree with @stefanfoulis about this being a useful feature. As it stands right now, I’ll need to rearrange my CI pipeline to make it work correctly with outputs from my eslint jobs, etc.
Perhaps a solution would be to enable appending various artifacts (coverage, test execution data, eslint reports, etc.) to an analysis, keyed on a git SHA or something like that (so the parallel build jobs would be able to know the identifier in advance).
Code Climate’s CLI provides an upload command for just that.

Hi @benoit
Is there any news on this topic? Is this feature already available or planned?

Hello,
We don’t have any update on this topic, we still think it would be a good improvement but no short term plan yet.

Hello Benoit,

Please could you elaborate on what you mean by running the coverage report before Sonar scanner, and then pass it as a parameter when executing the scanner?

Kind regards

Hi @fongangd,

Please have a look into our documentation. If you still have any doubt, just tell us!

Regards,

Alexandre.

Hi,
sorry for bumping the topic. Are there any news regarding this feature? I wasn’t able to find anything.
Thanks

Hello @MeyerM ,

There aren’t any news yet. You can follow this feature on our roadmap for updates and provide your use-case as a feedback as well. It is not exactly the same feature as what you are asking for, but it could solve those problems as well.

1 Like

Hi,

Any news on the topic?

We’re still waiting for this feature, any updates? It’s preventing us from moving from Coveralls

Just to point out that the linked feature request is not quite what was proposed/asked in this thread.

Linked feature request talks about supporting coverage data using “Automatic analysis” mode while conversation in this thread revolves around the idea of treating code analysis and collecting coverage data as separate processes that together feed into the overall quality of the commit/PR.

A typical use case for treating 2 checks separately would be to speed up the CI feedback loop and optimize CI resource usage by failing early as soon as any of the 2 checks (code analysis or code coverage) fail.

In our particular use case, we’re dealing with a C++ code base that takes significant amount of time to build and run tests. We would like to get code quality scan first since it only requires raw source code as an input and not have to wait for the build + test steps to complete.

1 Like