Skip to content

fix code coverage test#4938

Open
tpurschke wants to merge 1 commit into
CactuseSecurity:developfrom
tpurschke:fix/sonar-new-code-coverage
Open

fix code coverage test#4938
tpurschke wants to merge 1 commit into
CactuseSecurity:developfrom
tpurschke:fix/sonar-new-code-coverage

Conversation

@tpurschke

@tpurschke tpurschke commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Root cause

The develop/main analysis workflow sonarcloud.yml only built the solution and never ran tests or imported coverage reports — unlike sonarcloud-pr.yml. Without an imported report, Sonar counts every executable new line as uncovered, which is why all 13 files showed exactly 0.0% (and the PRs that introduced this code passed their gates fine, because the PR workflow does collect coverage).

Changes

  • sonarcloud.yml — brought in line with the PR workflow: Python 3.11 setup, dotnet-coverage tool, pinned Python deps, dotnet test under dotnet-coverage collect, pytest under coverage run, and the two sonar.cs.vscoveragexml.reportsPaths / sonar.python.coverage.reportPaths scanner parameters.
  • PeriodicTaskRunnerTest.cs — three new tests (double Start(), double Dispose(), Start() after dispose) closing the only real coverable gaps I found.

Verification

I ran both suites locally with coverage and cross-referenced every new line since v9.2.0 (the new-code baseline). Python: 400 tests pass, all new lines in all 6 flagged files already covered. C#: 2721 tests pass, all new lines covered except two spots that stay uncovered deliberately — NotificationEmailLayoutHelper.cs:68 (PDF branch needs a real Chrome; the suite already skips browser-dependent tests) and PeriodicTaskRunner.cs:88-89 (a race guard that can't be hit deterministically). That leaves new-code coverage around 97%, well above the gate.

@tpurschke tpurschke marked this pull request as ready for review July 12, 2026 20:33
@tpurschke tpurschke self-assigned this Jul 12, 2026
@tpurschke tpurschke requested a review from Y4nnikH July 12, 2026 20:35
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
1 New issue
C Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

💡 Need a hand with PR review? Try Gitar by Sonar!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant