Skip to content

Commit 836d1fa

Browse files
authored
Merge pull request #327 from nanotaboada/feature/coderabbit-yaml
chore: add CodeRabbit configuration for automated code reviews
2 parents 44d1775 + d9977c5 commit 836d1fa

File tree

2 files changed

+300
-1
lines changed

2 files changed

+300
-1
lines changed

.coderabbit.yaml

Lines changed: 296 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,296 @@
1+
# CodeRabbit Configuration
2+
# Optimized for .NET 8 / ASP.NET Core Web API project
3+
4+
language: en-US
5+
early_access: true
6+
enable_free_tier: true
7+
8+
reviews:
9+
profile: chill
10+
request_changes_workflow: false
11+
high_level_summary: true
12+
high_level_summary_placeholder: "@coderabbitai summary"
13+
review_status: true
14+
commit_status: true
15+
fail_commit_status: false
16+
collapse_walkthrough: false
17+
changed_files_summary: true
18+
sequence_diagrams: true
19+
estimate_code_review_effort: true
20+
assess_linked_issues: true
21+
related_issues: true
22+
related_prs: true
23+
suggested_labels: true
24+
auto_apply_labels: false
25+
suggested_reviewers: false
26+
auto_assign_reviewers: false
27+
in_progress_fortune: true
28+
poem: false
29+
abort_on_close: true
30+
31+
# Path-based review instructions for this .NET project
32+
path_instructions:
33+
- path: "**/*.cs"
34+
instructions: |
35+
- Follow C# naming conventions: PascalCase for classes/methods/properties, camelCase for local variables
36+
- Ensure nullable reference types are handled properly
37+
- Verify async/await patterns are used consistently
38+
- Check for proper dependency injection usage
39+
- Validate that var is used appropriately for obvious types
40+
- Ensure ILogger<T> is used for logging, not Console.WriteLine
41+
- Code should follow CSharpier formatting standards
42+
43+
- path: "src/**/Controllers/**/*.cs"
44+
instructions: |
45+
- Controllers should be thin - delegate to services
46+
- Verify proper HTTP status codes (200, 201, 400, 404, 409, 500)
47+
- Check that [ApiController] and route attributes are present
48+
- Ensure validation happens before processing
49+
- Confirm async controller actions return appropriate Result types
50+
51+
- path: "src/**/Services/**/*.cs"
52+
instructions: |
53+
- Services should contain business logic and orchestration
54+
- Verify proper use of IMemoryCache for read operations
55+
- Check that AutoMapper is used for object transformations
56+
- Ensure structured logging with ILogger<T>
57+
- Validate cache invalidation on data modifications
58+
59+
- path: "src/**/Repositories/**/*.cs"
60+
instructions: |
61+
- Repositories should abstract data access
62+
- Verify AsNoTracking() is used for read-only queries
63+
- Check that all database operations are async
64+
- Ensure proper null handling for not-found scenarios
65+
- Validate LINQ queries for performance
66+
67+
- path: "src/**/Models/**/*.cs"
68+
instructions: |
69+
- Models should be clean POCOs
70+
- Check for proper use of nullable reference types
71+
- Verify navigation properties are virtual (if using lazy loading)
72+
- Ensure DTOs are separate from domain entities
73+
74+
- path: "src/**/Validators/**/*.cs"
75+
instructions: |
76+
- Validators should use FluentValidation
77+
- Check validation rules are for data structure, not business logic
78+
- Ensure error messages are descriptive
79+
- Verify validators are registered in DI container
80+
81+
- path: "test/**/*.cs"
82+
instructions: |
83+
- Tests should use xUnit, Moq, and FluentAssertions
84+
- Verify test naming follows Given_When_Then pattern
85+
- Check that mocks are properly configured
86+
- Ensure async tests use Task return type
87+
- Validate test data uses faker patterns
88+
- Tests should use [Fact] and [Theory] attributes with [Trait("Category", "Unit")]
89+
90+
- path: "**/Dockerfile"
91+
instructions: |
92+
- Verify multi-stage builds are used
93+
- Check that .NET 8 SDK and runtime versions match
94+
- Ensure non-root user is used for security
95+
- Validate HEALTHCHECK instruction is present
96+
97+
- path: "**/appsettings*.json"
98+
instructions: |
99+
- Verify no sensitive data is committed
100+
- Check configuration structure matches usage in code
101+
- Ensure Development and Production configs are appropriate
102+
103+
- path: "**/*.csproj"
104+
instructions: |
105+
- Verify .NET 8 (net8.0) target framework
106+
- Check that nullable reference types are enabled
107+
- Ensure package versions are up to date
108+
- Validate that ImplicitUsings is enabled
109+
110+
# Ignore patterns for this project
111+
path_filters:
112+
- "!**/bin/**"
113+
- "!**/obj/**"
114+
- "!**/logs/**"
115+
- "!**/storage/**"
116+
- "!**/*.db"
117+
- "!**/*.db-shm"
118+
- "!**/*.db-wal"
119+
- "!**/packages.lock.json"
120+
- "!**/Migrations/**"
121+
- "!**/*.Designer.cs"
122+
- "!**/ModelSnapshot.cs"
123+
124+
auto_review:
125+
enabled: true
126+
auto_incremental_review: true
127+
ignore_title_keywords:
128+
- "WIP"
129+
- "DO NOT REVIEW"
130+
- "wip"
131+
drafts: false
132+
base_branches:
133+
- master
134+
- main
135+
136+
finishing_touches:
137+
docstrings:
138+
enabled: true
139+
unit_tests:
140+
enabled: true
141+
142+
pre_merge_checks:
143+
docstrings:
144+
mode: warning
145+
threshold: 75
146+
title:
147+
mode: warning
148+
requirements: |
149+
- Use Conventional Commits format (feat:, fix:, chore:, docs:, test:, refactor:)
150+
- Keep under 80 characters
151+
- Be descriptive and specific
152+
description:
153+
mode: warning
154+
issue_assessment:
155+
mode: warning
156+
157+
tools:
158+
# Relevant tools for .NET/C# projects
159+
gitleaks:
160+
enabled: true
161+
checkov:
162+
enabled: true
163+
hadolint:
164+
enabled: true
165+
yamllint:
166+
enabled: true
167+
actionlint:
168+
enabled: true
169+
semgrep:
170+
enabled: true
171+
markdownlint:
172+
enabled: true
173+
github-checks:
174+
enabled: true
175+
timeout_ms: 120000
176+
dotenvLint:
177+
enabled: true
178+
checkmake:
179+
enabled: true
180+
osvScanner:
181+
enabled: true
182+
183+
# Disable irrelevant tools for this .NET project
184+
shellcheck:
185+
enabled: false
186+
ruff:
187+
enabled: false
188+
biome:
189+
enabled: false
190+
swiftlint:
191+
enabled: false
192+
phpstan:
193+
enabled: false
194+
phpmd:
195+
enabled: false
196+
phpcs:
197+
enabled: false
198+
golangci-lint:
199+
enabled: false
200+
detekt:
201+
enabled: false
202+
eslint:
203+
enabled: false
204+
flake8:
205+
enabled: false
206+
rubocop:
207+
enabled: false
208+
buf:
209+
enabled: false
210+
regal:
211+
enabled: false
212+
pmd:
213+
enabled: false
214+
clang:
215+
enabled: false
216+
cppcheck:
217+
enabled: false
218+
clippy:
219+
enabled: false
220+
sqlfluff:
221+
enabled: false
222+
prismaLint:
223+
enabled: false
224+
pylint:
225+
enabled: false
226+
oxc:
227+
enabled: false
228+
shopifyThemeCheck:
229+
enabled: false
230+
luacheck:
231+
enabled: false
232+
brakeman:
233+
enabled: false
234+
htmlhint:
235+
enabled: false
236+
languagetool:
237+
enabled: false
238+
circleci:
239+
enabled: false
240+
241+
chat:
242+
art: true
243+
auto_reply: true
244+
245+
knowledge_base:
246+
opt_out: false
247+
web_search:
248+
enabled: true
249+
code_guidelines:
250+
enabled: true
251+
filePatterns:
252+
- "**/*.cs"
253+
- "**/*.csproj"
254+
- "**/Dockerfile"
255+
- "**/*.{yml,yaml}"
256+
- "**/appsettings*.json"
257+
- "src/**/*.json"
258+
learnings:
259+
scope: auto
260+
issues:
261+
scope: auto
262+
pull_requests:
263+
scope: auto
264+
mcp:
265+
usage: auto
266+
267+
code_generation:
268+
docstrings:
269+
language: en-US
270+
path_instructions:
271+
- path: "**/*.cs"
272+
instructions: |
273+
- Use XML documentation comments (///) for public APIs
274+
- Include <summary>, <param>, and <returns> tags
275+
- Keep documentation concise and meaningful
276+
- Don't state the obvious - add value
277+
unit_tests:
278+
path_instructions:
279+
- path: "test/**/*.cs"
280+
instructions: |
281+
- Use xUnit framework with [Fact] and [Theory] attributes
282+
- Follow Given_When_Then naming pattern for test methods
283+
- Use [Trait("Category", "Unit")] attribute for all unit tests
284+
- Use Moq for mocking dependencies
285+
- Use FluentAssertions for readable assertions
286+
- Ensure async tests return Task
287+
- Structure tests with Arrange, Act, Assert comments
288+
289+
issue_enrichment:
290+
auto_enrich:
291+
enabled: true
292+
planning:
293+
enabled: true
294+
labeling:
295+
auto_apply_labels: false
296+
labeling_instructions: []

.github/copilot-instructions.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,13 @@ This project follows a **layered architecture** with clear separation of concern
7777

7878
## 🧪 Testing
7979

80-
- Use **xUnit**
80+
- Use **xUnit** with `[Fact]` and `[Theory]` attributes
8181
- Use **Moq** for mocking
8282
- Prefer testing **service logic** and **controller behavior**
8383
- Place unit tests under `test/` following structure already present (e.g., `Unit/PlayerServiceTests.cs`)
84+
- **Test Naming**: Follow `Given_When_Then` pattern (e.g., `GivenCreateAsync_WhenRepositoryAddAsync_ThenAddsPlayerToRepositoryAndRemovesCache`)
85+
- **Test Structure**: Use Arrange, Act, Assert comments to organize test code
86+
- **Test Attributes**: Add `[Trait("Category", "Unit")]` to all unit tests
8487
- **Test Data**: Use faker patterns for consistent test data generation
8588
- **Assertions**: FluentAssertions for readable test assertions
8689

0 commit comments

Comments
 (0)