Skip to content

Commit e5eb9bd

Browse files
committed
chore: add CodeRabbit configuration for automated code reviews
- Add .coderabbit.yaml with .NET 8/ASP.NET Core optimizations - Configure path-based review instructions for layered architecture - Enable relevant tools (gitleaks, checkov, hadolint, semgrep, etc.) - Disable 30+ irrelevant language-specific tools for faster reviews - Add path filters to exclude bin/, obj/, logs/, and generated files - Configure C# coding standards and xUnit test patterns
1 parent 44d1775 commit e5eb9bd

File tree

1 file changed

+291
-0
lines changed

1 file changed

+291
-0
lines changed

.coderabbit.yaml

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

0 commit comments

Comments
 (0)