Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .coderabbit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,28 @@ reviews:
- Ensure error messages are descriptive
- Verify validators are registered in DI container

- path: "src/**/Mappings/**/*.cs"
instructions: |
- Profiles should inherit from AutoMapper Profile
- Verify CreateMap<Source, Destination>() calls cover all DTOs in use
- Check reverse mappings are defined where bidirectional mapping is needed
- Ensure profiles are registered via AddAutoMapper() in the DI setup
- Flag any manual property mappings that could be replaced by convention

- path: "src/**/Middlewares/**/*.cs"
instructions: |
- Middleware must implement InvokeAsync(HttpContext context) signature
- Verify _next(context) is called unless the middleware intentionally short-circuits
- Ensure exceptions are not swallowed — rethrow or translate to Problem Details
- Middleware should be stateless; dependencies requiring request scope belong in services

- path: "src/**/Extensions/**/*.cs"
instructions: |
- Extension methods should target IServiceCollection and return IServiceCollection
- Each method should encapsulate a single registration concern
- Verify service lifetimes (Singleton/Scoped/Transient) match the dependency's usage
- Follow the Add{Feature} naming convention (e.g. AddPlayerServices, AddRateLimiting)

- path: "test/**/*.cs"
instructions: |
- Tests should use xUnit, Moq, and FluentAssertions
Expand Down
95 changes: 95 additions & 0 deletions .sonarcloud.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# =============================================================================
# SonarCloud Automatic Analysis configuration
# https://docs.sonarsource.com/sonarqube-cloud/advanced-setup/automatic-analysis/
#
# SonarCloud's automatic analysis (GitHub App, no CI workflow) reads THIS file.
# Wildcard patterns are NOT supported here, so all exclusion paths must be
# listed explicitly.
# =============================================================================

sonar.sources=src/
sonar.tests=test/
sonar.sourceEncoding=UTF-8

# =============================================================================
# Global exclusions
# =============================================================================

sonar.exclusions=\
src/Dotnet.Samples.AspNetCore.WebApi/Migrations/20250414191223_InitialCreate.cs,\
src/Dotnet.Samples.AspNetCore.WebApi/Migrations/20250414191223_InitialCreate.Designer.cs,\
src/Dotnet.Samples.AspNetCore.WebApi/Migrations/20250414195445_SeedStarting11.cs,\
src/Dotnet.Samples.AspNetCore.WebApi/Migrations/20250414195445_SeedStarting11.Designer.cs,\
src/Dotnet.Samples.AspNetCore.WebApi/Migrations/20251221220614_SeedSubstitutes.cs,\
src/Dotnet.Samples.AspNetCore.WebApi/Migrations/20251221220614_SeedSubstitutes.Designer.cs,\
src/Dotnet.Samples.AspNetCore.WebApi/Migrations/20260329000000_NormalizePlayerDataset.cs,\
src/Dotnet.Samples.AspNetCore.WebApi/Migrations/20260329000000_NormalizePlayerDataset.Designer.cs,\
src/Dotnet.Samples.AspNetCore.WebApi/Migrations/PlayerDbContextModelSnapshot.cs

# =============================================================================
# Coverage exclusions
# Test files and generated/infrastructure code should not count against
# production code coverage metrics.
# =============================================================================

sonar.coverage.exclusions=\
test/Dotnet.Samples.AspNetCore.WebApi.Tests/Unit/PlayerControllerTests.cs,\
test/Dotnet.Samples.AspNetCore.WebApi.Tests/Unit/PlayerServiceTests.cs,\
test/Dotnet.Samples.AspNetCore.WebApi.Tests/Unit/PlayerValidatorTests.cs,\
test/Dotnet.Samples.AspNetCore.WebApi.Tests/Utilities/DatabaseFakes.cs,\
test/Dotnet.Samples.AspNetCore.WebApi.Tests/Utilities/PlayerFakes.cs,\
test/Dotnet.Samples.AspNetCore.WebApi.Tests/Utilities/PlayerMocks.cs,\
test/Dotnet.Samples.AspNetCore.WebApi.Tests/Utilities/PlayerStubs.cs,\
test/Dotnet.Samples.AspNetCore.WebApi.Tests/Usings.cs,\
src/Dotnet.Samples.AspNetCore.WebApi/Migrations/20250414191223_InitialCreate.cs,\
src/Dotnet.Samples.AspNetCore.WebApi/Migrations/20250414191223_InitialCreate.Designer.cs,\
src/Dotnet.Samples.AspNetCore.WebApi/Migrations/20250414195445_SeedStarting11.cs,\
src/Dotnet.Samples.AspNetCore.WebApi/Migrations/20250414195445_SeedStarting11.Designer.cs,\
src/Dotnet.Samples.AspNetCore.WebApi/Migrations/20251221220614_SeedSubstitutes.cs,\
src/Dotnet.Samples.AspNetCore.WebApi/Migrations/20251221220614_SeedSubstitutes.Designer.cs,\
src/Dotnet.Samples.AspNetCore.WebApi/Migrations/20260329000000_NormalizePlayerDataset.cs,\
src/Dotnet.Samples.AspNetCore.WebApi/Migrations/20260329000000_NormalizePlayerDataset.Designer.cs,\
src/Dotnet.Samples.AspNetCore.WebApi/Migrations/PlayerDbContextModelSnapshot.cs,\
src/Dotnet.Samples.AspNetCore.WebApi/Data/PlayerDbContext.cs,\
src/Dotnet.Samples.AspNetCore.WebApi/Program.cs

# =============================================================================
# Duplicate code (CPD) exclusions
# Automatic analysis does not support wildcard patterns, so each file is
# listed explicitly.
#
# Migrations — EF Core migration files are intentionally repetitive
# (sequential InsertData/UpdateData/Sql calls).
#
# PlayerDbContext.cs — scaffolded EF Core infrastructure.
#
# PlayerData.cs — parallel WithId/without-Id method pairs mirror each other
# by design; duplication is structural, not accidental.
#
# PlayerRequestModelValidator.cs — the "Create" and "Update" rule sets share
# common rules by design; duplication is intentional.
#
# Test files — Fakes, Mocks, and Stubs are intentionally repetitive by design.
# =============================================================================

sonar.cpd.exclusions=\
src/Dotnet.Samples.AspNetCore.WebApi/Migrations/20250414191223_InitialCreate.cs,\
src/Dotnet.Samples.AspNetCore.WebApi/Migrations/20250414191223_InitialCreate.Designer.cs,\
src/Dotnet.Samples.AspNetCore.WebApi/Migrations/20250414195445_SeedStarting11.cs,\
src/Dotnet.Samples.AspNetCore.WebApi/Migrations/20250414195445_SeedStarting11.Designer.cs,\
src/Dotnet.Samples.AspNetCore.WebApi/Migrations/20251221220614_SeedSubstitutes.cs,\
src/Dotnet.Samples.AspNetCore.WebApi/Migrations/20251221220614_SeedSubstitutes.Designer.cs,\
src/Dotnet.Samples.AspNetCore.WebApi/Migrations/20260329000000_NormalizePlayerDataset.cs,\
src/Dotnet.Samples.AspNetCore.WebApi/Migrations/20260329000000_NormalizePlayerDataset.Designer.cs,\
src/Dotnet.Samples.AspNetCore.WebApi/Migrations/PlayerDbContextModelSnapshot.cs,\
src/Dotnet.Samples.AspNetCore.WebApi/Data/PlayerDbContext.cs,\
src/Dotnet.Samples.AspNetCore.WebApi/Utilities/PlayerData.cs,\
src/Dotnet.Samples.AspNetCore.WebApi/Validators/PlayerRequestModelValidator.cs,\
test/Dotnet.Samples.AspNetCore.WebApi.Tests/Unit/PlayerControllerTests.cs,\
test/Dotnet.Samples.AspNetCore.WebApi.Tests/Unit/PlayerServiceTests.cs,\
test/Dotnet.Samples.AspNetCore.WebApi.Tests/Unit/PlayerValidatorTests.cs,\
test/Dotnet.Samples.AspNetCore.WebApi.Tests/Utilities/DatabaseFakes.cs,\
test/Dotnet.Samples.AspNetCore.WebApi.Tests/Utilities/PlayerFakes.cs,\
test/Dotnet.Samples.AspNetCore.WebApi.Tests/Utilities/PlayerMocks.cs,\
test/Dotnet.Samples.AspNetCore.WebApi.Tests/Utilities/PlayerStubs.cs,\
test/Dotnet.Samples.AspNetCore.WebApi.Tests/Usings.cs
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ This project uses famous football stadiums (A-Z) that hosted FIFA World Cup matc

### Changed

- Normalize player dataset: add Lo Celso (squad 27), correct Fernández/Mac Allister/Messi team data, replace random UUIDs with deterministic UUID v5 values (#435)
- Align CRUD test fixtures: Lo Celso (squad 27) for Create and Delete, Messi (squad 10) for Retrieve, Damián Martínez (squad 23) for Update (#435)
- Bump `codecov/codecov-action` from 5.5.2 to 5.5.3 (#423)

### Fixed
Expand Down
61 changes: 0 additions & 61 deletions sonar-project.properties

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading