Skip to content

Commit 690e8f6

Browse files
nanotaboadaclaude
andcommitted
chore(ci): harden SonarCloud exclusions and CodeRabbit paths (#435)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 14efe16 commit 690e8f6

2 files changed

Lines changed: 41 additions & 2 deletions

File tree

.coderabbit.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,28 @@ reviews:
7777
- Ensure error messages are descriptive
7878
- Verify validators are registered in DI container
7979
80+
- path: "src/**/Mappings/**/*.cs"
81+
instructions: |
82+
- Profiles should inherit from AutoMapper Profile
83+
- Verify CreateMap<Source, Destination>() calls cover all DTOs in use
84+
- Check reverse mappings are defined where bidirectional mapping is needed
85+
- Ensure profiles are registered via AddAutoMapper() in the DI setup
86+
- Flag any manual property mappings that could be replaced by convention
87+
88+
- path: "src/**/Middlewares/**/*.cs"
89+
instructions: |
90+
- Middleware must implement InvokeAsync(HttpContext context) signature
91+
- Verify _next(context) is called unless the middleware intentionally short-circuits
92+
- Ensure exceptions are not swallowed — rethrow or translate to Problem Details
93+
- Middleware should be stateless; dependencies requiring request scope belong in services
94+
95+
- path: "src/**/Extensions/**/*.cs"
96+
instructions: |
97+
- Extension methods should target IServiceCollection and return IServiceCollection
98+
- Each method should encapsulate a single registration concern
99+
- Verify service lifetimes (Singleton/Scoped/Transient) match the dependency's usage
100+
- Follow the Add{Feature} naming convention (e.g. AddPlayerServices, AddRateLimiting)
101+
80102
- path: "test/**/*.cs"
81103
instructions: |
82104
- Tests should use xUnit, Moq, and FluentAssertions

sonar-project.properties

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ sonar.test.inclusions=test/**/*.cs
2828
sonar.exclusions=\
2929
**/obj/**,\
3030
**/bin/**,\
31-
**/Migrations/**
31+
**/Migrations/**,\
32+
**/*.Designer.cs
3233

3334
# =============================================================================
3435
# Coverage exclusions
@@ -39,23 +40,39 @@ sonar.exclusions=\
3940
sonar.coverage.exclusions=\
4041
test/**/*.cs,\
4142
**/Migrations/**,\
42-
**/Data/PlayerDbContext.cs
43+
**/Data/PlayerDbContext.cs,\
44+
**/Program.cs
4345

4446
# =============================================================================
4547
# Duplicate code (CPD) exclusions
4648
# NOTE: // NOSONAR suppresses rule-based issues (bugs, code smells, security
4749
# hotspots) but has no effect on CPD metrics. Files must be listed here to be
4850
# excluded from duplicate code detection.
4951
#
52+
# **/Migrations/** — EF Core migration files are intentionally repetitive
53+
# (sequential InsertData/UpdateData/Sql calls); must be listed explicitly
54+
# here even though already present in sonar.exclusions, as CPD is evaluated
55+
# independently of the global exclusion list.
56+
#
57+
# **/Data/PlayerDbContext.cs — scaffolded EF Core infrastructure; excluded
58+
# from coverage metrics above for the same reason.
59+
#
5060
# test/**/*.cs — Fakes, Mocks, and Stubs are intentionally repetitive by
5161
# design; similarity between arrange/act/assert blocks across tests is
5262
# expected and harmless.
5363
#
64+
# **/Utilities/PlayerData.cs — parallel WithId/without-Id method pairs
65+
# (MakeStarting11/MakeStarting11WithId, GetSubstitutes/GetSubstitutesWithId)
66+
# mirror each other by design; duplication is structural, not accidental.
67+
#
5468
# **/Validators/PlayerRequestModelValidator.cs — the "Create" and "Update"
5569
# rule sets share common rules by design; the duplication is intentional to
5670
# keep each operation's validation self-contained and readable.
5771
# =============================================================================
5872

5973
sonar.cpd.exclusions=\
74+
**/Migrations/**,\
75+
**/Data/PlayerDbContext.cs,\
6076
test/**/*.cs,\
77+
**/Utilities/PlayerData.cs,\
6178
**/Validators/PlayerRequestModelValidator.cs

0 commit comments

Comments
 (0)