Skip to content

Exclude GCC implicit exception branches from coverage report - #170

Merged
fernandotonon merged 1 commit into
masterfrom
fix/exclude-gcc-exception-branches
Mar 4, 2026
Merged

Exclude GCC implicit exception branches from coverage report#170
fernandotonon merged 1 commit into
masterfrom
fix/exclude-gcc-exception-branches

Conversation

@fernandotonon

@fernandotonon fernandotonon commented Mar 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add --exclude-throw-branches and --exclude-unreachable-branches flags to the gcovr command in CI
  • GCC's --coverage generates 2 branches for every function call (normal return vs exception thrown), causing SonarCloud to report "1 of 2 conditions" on simple calls like writeObjects() that have no actual branching logic
  • These gcovr flags filter out compiler-generated exception/unreachable branches, so condition coverage reflects real logic branches only

Test plan

  • CI builds and runs tests successfully
  • SonarCloud condition coverage no longer shows partial coverage on plain function calls

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Updated continuous integration workflow configuration to refine code coverage reporting.

GCC's --coverage flag generates 2 branches for every function call
(normal return vs exception thrown), causing gcov to report "1 of 2
conditions" on simple calls like writeObjects(). Adding gcovr's
--exclude-throw-branches and --exclude-unreachable-branches filters
these compiler-generated branches from the SonarCloud coverage report.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Mar 4, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 696f9244-12af-440c-b77c-d5401a4786de

📥 Commits

Reviewing files that changed from the base of the PR and between 1bfb7ec and ac6bef5.

📒 Files selected for processing (1)
  • .github/workflows/deploy.yml

📝 Walkthrough

Walkthrough

The GitHub Actions deploy workflow is updated to add two exclusion filters (--exclude-throw-branches and --exclude-unreachable-branches) to the gcovr coverage reporting command in the Linux coverage generation step. This refines the coverage metrics by filtering specific branch types.

Changes

Cohort / File(s) Summary
GitHub Actions Workflow Configuration
.github/workflows/deploy.yml
Added two gcovr exclusion flags (--exclude-throw-branches, --exclude-unreachable-branches) to narrow coverage report scope for SonarQube analysis.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 Branches trimmed and branches cleared,
Unreachable paths disappeared,
Coverage metrics sharp and clean,
The finest scopes we've ever seen!
With throw-branches cast away,
Our reports are bright today!

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/exclude-gcc-exception-branches

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Comment @coderabbitai help to get the list of available commands and usage tips.

@fernandotonon
fernandotonon merged commit f67ebd8 into master Mar 4, 2026
10 of 11 checks passed
@fernandotonon
fernandotonon deleted the fix/exclude-gcc-exception-branches branch March 4, 2026 13:25
@sonarqubecloud

sonarqubecloud Bot commented Mar 4, 2026

Copy link
Copy Markdown

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