GitTools / GitTools/GitVersion
Import .NET test coverage into SonarCloud analysis
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 3.1k
- Forks
- 659
- Avg merge
- 13h 15m
- Merged PRs (30d)
- 51
Description
Problem
GitVersion already generates test coverage, but the repository's coverage publishing path targets Codecov. We should evaluate importing the same test run's coverage into SonarCloud so coverage information is available alongside its code analysis.
Generating coverage and uploading it to Codecov does not establish that SonarCloud has imported it. Before implementing anything, inspect the live SonarCloud project settings and analysis logs to identify whether coverage is already supplied outside this repository configuration.
Existing implementation
Source reviewed on 15 September 2026:
- UnitTest.cs generates Cobertura reports using Coverlet and excludes test assemblies and GitVersion.Testing.
- The unit-test workflow uploads test results and coverage to Codecov.
- PublishCoverage.cs also targets Codecov.
- Upstream PR #4871 introduced coverage generation and publication.
These are revision-pinned observations, not verification of the live SonarCloud dashboard.
Proposed scope
- Identify the SonarCloud analysis entry point, scanner mode, analyzed projects, and revision used for analysis.
- Verify whether coverage is currently imported and identify the actual gap.
- Select a supported C# coverage format and ingestion configuration. Preserve Cobertura for existing consumers; prefer producing an additional supported report from the same test execution over running the tests again.
- Make reports available at the correct point in the analysis lifecycle, with paths resolving to analyzed source files.
- Define which operating system/framework run supplies coverage, avoiding accidental duplicate aggregation across the matrix.
- Verify the result on an identifiable upstream commit and document how to diagnose missing reports.
Acceptance criteria
- Current analysis mode and existing coverage ingestion are documented.
- A supported C# report format and source-path mapping are verified.
- SonarCloud displays imported coverage for the exact analyzed revision; evidence includes scanner logs and the resulting analysis.
- Test/generated-code exclusions are intentional and consistent with analysis scope.
- Existing Codecov coverage and test-result uploads still work.
- Missing or malformed reports are visible rather than silently treated as successful ingestion.
- Fork PR behavior is documented without requiring secrets to be exposed to untrusted runs.
Open questions
- Does the project use automatic analysis or a CI scanner configuration?
- Can the existing Coverlet MTP integration produce all required formats in one run?
- Is initial support limited to main-branch analysis, or can the existing PR analysis path consume coverage too?
Replacing Codecov, changing coverage thresholds, and expanding test coverage are separate decisions.
References
Original issue
Moved from arturcic/GitVersion#808. GitHub does not support a direct transfer between these repository owners.
Triage — 16 September 2026
- Area: CI coverage and SonarCloud analysis.
- Milestone: 7.0.x; optional improvement, non-blocking for the v7.0 release.
- Classification: build.
- Next step: inspect the live SonarCloud analysis mode and ingestion logs, then select a supported C# report path and verify coverage on the exact analyzed revision.
- Release scope: preserve Codecov and reuse the existing test execution where supported. Do not change quality-gate thresholds as part of initial ingestion work.
- Tracking: direct sub-issue of GitTools/GitVersion#5137. Can proceed independently of the MTP reporting pilot.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting the live SonarCloud project settings and analysis logs to identify the analysis entry point, scanner mode, revision, and existing coverage ingestion. Then trace build/build/Tasks/Test/UnitTest.cs, build/build/Tasks/Test/PublishCoverage.cs, and .github/workflows/_unit_tests.yml to select and expose a supported C# report without disrupting Codecov. Done means coverage is visible for an identifiable analyzed commit, with logs, exclusions, fork behavior, and diagnostics documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, github-actions
- Domain
- ci-cd, testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100