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
16 changes: 10 additions & 6 deletions .coderabbit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# https://docs.coderabbit.ai/getting-started/configure-coderabbit

# CodeRabbit Configuration
# Optimized for .NET 8 / ASP.NET Core Web API project
# Optimized for .NET 10 / ASP.NET Core Web API project

language: en-US
early_access: true
Expand Down Expand Up @@ -80,16 +80,18 @@ reviews:
- path: "test/**/*.cs"
instructions: |
- Tests should use xUnit, Moq, and FluentAssertions
- Verify test naming follows Given_When_Then pattern
- Verify test naming follows the two-pattern convention (exactly 3 underscore-delimited segments):
- Controller tests: {HttpMethod}_{Resource}_{Condition}_Returns{Outcome} (e.g. Get_Players_Existing_ReturnsPlayers)
- Service/Validator tests: {MethodName}_{StateUnderTest}_{ExpectedBehavior} (e.g. RetrieveAsync_CacheMiss_QueriesRepositoryAndCachesResult)
- Check that mocks are properly configured
- Ensure async tests use Task return type
- Validate test data uses faker patterns
- Validate test data uses PlayerFakes factory methods from test/Utilities/
- Tests should use [Fact] and [Theory] attributes with [Trait("Category", "Unit")]

- path: "**/Dockerfile"
instructions: |
- Verify multi-stage builds are used
- Check that .NET 8 SDK and runtime versions match
- Check that .NET 10 SDK and runtime versions match
- Ensure non-root user is used for security
- Validate HEALTHCHECK instruction is present

Expand All @@ -101,7 +103,7 @@ reviews:

- path: "**/*.csproj"
instructions: |
- Verify .NET 8 (net8.0) target framework
- Verify .NET 10 (net10.0) target framework
- Check that nullable reference types are enabled
- Ensure package versions are up to date
- Validate that ImplicitUsings is enabled
Expand Down Expand Up @@ -345,7 +347,9 @@ code_generation:
- path: "test/**/*.cs"
instructions: |
- Use xUnit framework with [Fact] and [Theory] attributes
- Follow Given_When_Then naming pattern for test methods
- Follow the two-pattern naming convention (exactly 3 underscore-delimited segments):
- Controller tests: {HttpMethod}_{Resource}_{Condition}_Returns{Outcome}
- Service/Validator tests: {MethodName}_{StateUnderTest}_{ExpectedBehavior}
- Use [Trait("Category", "Unit")] attribute for all unit tests
- Use Moq for mocking dependencies
- Use FluentAssertions for readable assertions
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ logs/
bin/
obj/
TestResults/
.claude/settings.local.json
12 changes: 7 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,16 @@ This project uses famous football stadiums (A-Z) that hosted FIFA World Cup matc

### Added

- Add SonarCloud configuration via `sonar-project.properties` with CPD exclusions for test files and `PlayerRequestModelValidator` (#426)
- Add bug report issue template (`.github/ISSUE_TEMPLATE/bug_report.md`) (#426)

### Changed

### Deprecated

### Removed
- Bump `codecov/codecov-action` from 5.5.2 to 5.5.3 (#423)

### Fixed

### Security
- Scope `BeUniqueSquadNumber` validator to `"Create"` rule set to prevent false rejection of valid `PUT` requests (#424)

---

Expand Down Expand Up @@ -195,6 +196,7 @@ The CD workflow automatically:

---

[unreleased]: https://github.com/nanotaboada/Dotnet.Samples.AspNetCore.WebApi/compare/v1.1.0-bernabeu...HEAD
[unreleased]: https://github.com/nanotaboada/Dotnet.Samples.AspNetCore.WebApi/compare/v2.0.0-centenario...HEAD
[2.0.0 - centenario]: https://github.com/nanotaboada/Dotnet.Samples.AspNetCore.WebApi/compare/v1.1.0-bernabeu...v2.0.0-centenario
[1.1.0 - bernabeu]: https://github.com/nanotaboada/Dotnet.Samples.AspNetCore.WebApi/compare/v1.0.0-azteca...v1.1.0-bernabeu
[1.0.0 - azteca]: https://github.com/nanotaboada/Dotnet.Samples.AspNetCore.WebApi/releases/tag/v1.0.0-azteca
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
[![codecov](https://codecov.io/gh/nanotaboada/Dotnet.Samples.AspNetCore.WebApi/graph/badge.svg?token=hgJc1rStJ9)](https://codecov.io/gh/nanotaboada/Dotnet.Samples.AspNetCore.WebApi)
[![CodeFactor](https://www.codefactor.io/repository/github/nanotaboada/Dotnet.Samples.AspNetCore.WebApi/badge)](https://www.codefactor.io/repository/github/nanotaboada/Dotnet.Samples.AspNetCore.WebApi)
[![License: MIT](https://img.shields.io/badge/License-MIT-3DA639.svg)](https://opensource.org/licenses/MIT)
![Dependabot](https://img.shields.io/badge/Dependabot-contributing-025E8C?logo=dependabot&logoColor=white&labelColor=181818)
![GitHub Copilot](https://img.shields.io/badge/GitHub_Copilot-contributing-8662C5?logo=githubcopilot&logoColor=white&labelColor=181818)
![Claude](https://img.shields.io/badge/Claude-Sonnet_4.6-D97757?logo=claude&logoColor=white&labelColor=181818)
![CodeRabbit Pull Request Reviews](https://img.shields.io/coderabbit/prs/github/nanotaboada/Dotnet.Samples.AspNetCore.WebApi?utm_source=oss&utm_medium=github&utm_campaign=nanotaboada%2FDotnet.Samples.AspNetCore.WebApi&link=https%3A%2F%2Fcoderabbit.ai&label=CodeRabbit+Reviews&labelColor=181818)
Expand Down Expand Up @@ -82,15 +83,23 @@ src/Dotnet.Samples.AspNetCore.WebApi/
├── Validators/ # FluentValidation rules
│ └── PlayerRequestModelValidator.cs
├── Configurations/ # Swagger, rate limiting config
├── Enums/ # Domain enumerations (e.g. Position)
├── Extensions/ # Service registration extensions
├── Middlewares/ # Custom ASP.NET Core middleware
├── Utilities/ # Helper classes
├── Migrations/ # EF Core migrations
└── storage/ # Pre-seeded SQLite database

test/Dotnet.Samples.AspNetCore.WebApi.Tests/
└── Unit/ # Unit tests with xUnit
├── PlayerControllerTests.cs
└── PlayerServiceTests.cs
├── Unit/ # Unit tests with xUnit
│ ├── PlayerControllerTests.cs
│ ├── PlayerServiceTests.cs
│ └── PlayerValidatorTests.cs
└── Utilities/ # Shared test helpers
├── DatabaseFakes.cs
├── PlayerFakes.cs
├── PlayerMocks.cs
└── PlayerStubs.cs
```

## Architecture
Expand Down Expand Up @@ -421,6 +430,7 @@ STORAGE_PATH=/storage/players-sqlite3.db
| `dotnet build` | Build the solution |
| `dotnet test` | Run all tests |
| `dotnet test --collect:"XPlat Code Coverage"` | Run tests with coverage report |
| `dotnet csharpier .` | Format source code |
| `dotnet ef migrations add <Name>` | Create a new migration |
| `dotnet ef database update` | Apply migrations |
| `./scripts/run-migrations-and-copy-database.sh` | Regenerate database with seed data |
Expand Down
Loading