Skip to content

feat: Exclude generated attributes from code coverage#81

Merged
ChristianSauer merged 2 commits intocodecentric:masterfrom
skarllot-forking:master
Nov 4, 2025
Merged

feat: Exclude generated attributes from code coverage#81
ChristianSauer merged 2 commits intocodecentric:masterfrom
skarllot-forking:master

Conversation

@skarllot
Copy link
Copy Markdown
Contributor

What’s changed

Two internal attribute types in RegisterAttributesExtensions.cs are now marked as generated code and excluded from code-coverage analysis.

  • GeneratedCode attribute signals to tools that these types are auto-generated.
  • ExcludeFromCodeCoverage ensures coverage reports (e.g. Coverlet, Visual Studio) skip these classes.

Why

Coverage tools can skew metrics by including boilerplate attribute definitions that aren’t hand-written or relevant to business logic. By marking them as generated and excluding them, we:

  • Keep overall coverage percentages meaningful
  • Avoid noise when tracking real coverage gaps
  • Follow best practices for generated code hygiene

How to verify

  1. Run your coverage suite (e.g. dotnet test /p:CollectCoverage=true).
  2. Observe that neither of the two attribute classes appears in the coverage report.
  3. Confirm no other tests or behavior have regressed.

@ChristianSauer ChristianSauer merged commit 1012dbc into codecentric:master Nov 4, 2025
3 checks passed
@ChristianSauer
Copy link
Copy Markdown
Collaborator

Merged, thanks!

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.

2 participants