xd009642 / tarpaulin

A code coverage tool for Rust projects
https://crates.io/crates/cargo-tarpaulin
Apache License 2.0
2.5k stars 180 forks source link

Issue: Incompatibility between `cargo-tarpaulin` Cobertura XML Version and SonarCloud #1383

Closed Akmot9 closed 1 year ago

Akmot9 commented 1 year ago

Issue: Incompatibility between cargo-tarpaulin Cobertura XML Version and SonarCloud

Description

When using cargo-tarpaulin to generate Cobertura XML reports, the generated XML specifies version 1.9. SonarCloud expects the Cobertura XML to be of version 1, causing an error and failing the CI/CD process.

Error Message

The following error is thrown by SonarCloud:

ERROR: Caused by: Unknown report version: 1.9. This parser only handles version 1.

Steps to Reproduce

  1. Generate Cobertura XML report with cargo-tarpaulin --out Cobertura.
  2. Use the generated XML report as part of SonarCloud analysis.
  3. SonarCloud fails to parse the Cobertura XML report and throws the above error.

Expected Behavior

SonarCloud should be able to successfully parse the Cobertura XML report generated by cargo-tarpaulin.

Possible Solutions

  1. Add an option to cargo-tarpaulin to specify the Cobertura XML version when generating the report.
  2. Change the default version to 1 to make it compatible with SonarCloud.

Environment

Additional Context

Being able to integrate cargo-tarpaulin seamlessly with SonarCloud is crucial for CI/CD pipelines and ensuring code quality.

xd009642 commented 1 year ago

So from checking the cobertura docs, they only started following semver since version 2.0. This means versions 1.0 and 1.9 may not be compatible in any meaningful way and it may not still work with sonarcloud. If you could find a way to patch the version yourself and report it does work I'll look into adding an override (it may just be an env var instead of adding a flag etc).

I'd also suggest raising an issue with sonarcloud as this seems to be more of an issue on their end than mine - and avoiding hacky overrides to get around poor tooling would be preferable. :man_shrugging:

Akmot9 commented 1 year ago

Thank you I'll keep you posted on how it goes. And I'll send a link to the issue I will summit to sonar.

Akmot9 commented 1 year ago

https://community.sonarsource.com/t/rust-plugin-for-sonarcloud/61940 Unfortunately, SonarCloud still does not support plugins or Rustlang. I used Codecove.io then and it woaked : https://github.com/marketplace/actions/rust-tarpaulin