-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy path.coderabbit.yaml
More file actions
307 lines (284 loc) · 8.34 KB
/
.coderabbit.yaml
File metadata and controls
307 lines (284 loc) · 8.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
# CodeRabbit Configuration
# Optimized for Python 3.13 / FastAPI RESTful API project
language: en-US
early_access: true
enable_free_tier: true
reviews:
profile: chill
request_changes_workflow: false
high_level_summary: true
high_level_summary_placeholder: "@coderabbitai summary"
review_status: true
commit_status: true
fail_commit_status: false
collapse_walkthrough: false
changed_files_summary: true
sequence_diagrams: true
estimate_code_review_effort: true
assess_linked_issues: true
related_issues: true
related_prs: true
suggested_labels: true
auto_apply_labels: false
suggested_reviewers: false
auto_assign_reviewers: false
in_progress_fortune: true
poem: false
abort_on_close: true
# Path-based review instructions for this Python/FastAPI project
path_instructions:
- path: "**/*.py"
instructions: |
- Follow PEP 8 style guide and Black formatting (88 char line length)
- Use type hints for function parameters and return values
- Follow async/await patterns for all I/O operations
- Use Google-style docstrings for modules, classes, and functions
- Verify imports follow proper grouping (stdlib → third-party → local)
- Check that SQLAlchemy 2.0+ style is used (select() not legacy Query)
- path: "routes/**/*.py"
instructions: |
- Routes should be thin - delegate to services
- Verify proper HTTP status codes and FastAPI response models
- Check that dependency injection is used (Depends(generate_async_session))
- Ensure Pydantic models are used for request/response validation
- Validate async route handlers (async def)
- Check for proper cache headers (X-Cache: HIT/MISS)
- path: "services/**/*.py"
instructions: |
- Services should contain business logic
- Verify async database operations via repositories/database layer
- Check cache invalidation on POST/PUT/DELETE operations
- Ensure proper error handling with try/except where needed
- Validate that Pydantic models are converted properly (model_dump())
- path: "databases/**/*.py"
instructions: |
- Verify AsyncSession usage with proper async context managers
- Check that async_session generator uses yield pattern
- Ensure SQLAlchemy engine is configured with aiosqlite
- Validate database initialization in lifespan handler
- path: "schemas/**/*.py"
instructions: |
- SQLAlchemy ORM schemas should use declarative base
- Check proper column types and constraints
- Verify table names are explicitly set
- Ensure relationships are defined if needed
- path: "models/**/*.py"
instructions: |
- Pydantic models should use Field for validation
- Verify camelCase aliasing with Config.alias_generator = to_camel
- Check that validation constraints match business rules
- Ensure models are separate from database schemas
- path: "tests/**/*.py"
instructions: |
- Tests should use pytest with fixtures from conftest.py
- Verify test naming follows given_when_then pattern
- Check that TestClient is used for endpoint testing
- Ensure test data uses stubs (e.g., player_stub.py)
- Tests should use async test functions where appropriate
- Validate coverage targets (80% minimum)
- path: "main.py"
instructions: |
- Verify FastAPI app initialization with proper settings
- Check lifespan handler for database initialization
- Ensure router registration is correct
- Validate CORS and middleware configuration
- path: "**/Dockerfile"
instructions: |
- Verify Python 3.13 base image (python:3.13-alpine)
- Check multi-stage builds for optimization
- Ensure non-root user is used for security
- Validate HEALTHCHECK instruction is present
- Check that requirements are installed in correct order
- path: "requirements*.txt"
instructions: |
- Verify pinned versions for reproducibility
- Check separation: requirements.txt (runtime), requirements-test.txt, requirements-lint.txt
- Ensure dependencies are up to date with security patches
- path: "pyproject.toml"
instructions: |
- Verify Black configuration (line-length = 88, target-version = py313)
- Check pytest configuration matches test execution
- Ensure tool configurations are consistent with CI
# Ignore patterns for this project
path_filters:
- "!**/__pycache__/**"
- "!**/.pytest_cache/**"
- "!**/htmlcov/**"
- "!**/*.pyc"
- "!**/.venv/**"
- "!**/venv/**"
- "!**/storage/**"
- "!**/*.db"
- "!**/*.db-shm"
- "!**/*.db-wal"
- "!**/assets/**"
- "!**/postman_collections/**"
auto_review:
enabled: true
auto_incremental_review: true
ignore_title_keywords:
- "WIP"
- "DO NOT REVIEW"
- "wip"
drafts: false
base_branches:
- master
- main
finishing_touches:
docstrings:
enabled: true
unit_tests:
enabled: true
pre_merge_checks:
docstrings:
mode: warning
threshold: 75
title:
mode: warning
requirements: |
- Use Conventional Commits format (feat:, fix:, chore:, docs:, test:, refactor:)
- Keep under 80 characters
- Be descriptive and specific
description:
mode: warning
issue_assessment:
mode: warning
tools:
# Relevant tools for Python projects
ruff:
enabled: true
flake8:
enabled: true
pylint:
enabled: true
gitleaks:
enabled: true
checkov:
enabled: true
hadolint:
enabled: true
yamllint:
enabled: true
actionlint:
enabled: true
semgrep:
enabled: true
markdownlint:
enabled: true
github-checks:
enabled: true
timeout_ms: 120000
dotenvLint:
enabled: true
checkmake:
enabled: true
osvScanner:
enabled: true
# Disable irrelevant tools for Python project
shellcheck:
enabled: false
biome:
enabled: false
swiftlint:
enabled: false
phpstan:
enabled: false
phpmd:
enabled: false
phpcs:
enabled: false
golangci-lint:
enabled: false
detekt:
enabled: false
eslint:
enabled: false
rubocop:
enabled: false
buf:
enabled: false
regal:
enabled: false
pmd:
enabled: false
clang:
enabled: false
cppcheck:
enabled: false
clippy:
enabled: false
sqlfluff:
enabled: false
prismaLint:
enabled: false
oxc:
enabled: false
shopifyThemeCheck:
enabled: false
luacheck:
enabled: false
brakeman:
enabled: false
htmlhint:
enabled: false
languagetool:
enabled: false
circleci:
enabled: false
fortitudeLint:
enabled: false
chat:
art: true
auto_reply: true
knowledge_base:
opt_out: false
web_search:
enabled: true
code_guidelines:
enabled: true
filePatterns:
- "**/*.py"
- "**/requirements*.txt"
- "**/pyproject.toml"
- "**/Dockerfile"
- "**/*.{yml,yaml}"
learnings:
scope: auto
issues:
scope: auto
pull_requests:
scope: auto
mcp:
usage: auto
code_generation:
docstrings:
language: en-US
path_instructions:
- path: "**/*.py"
instructions: |
- Use Google-style docstrings with Args, Returns, Raises sections
- Keep documentation concise and meaningful
- Include type information in docstrings when helpful
- Document async functions and their async behavior
unit_tests:
path_instructions:
- path: "tests/**/*.py"
instructions: |
- Use pytest framework with async support (pytest-asyncio)
- Follow given_when_then or arrange_act_assert patterns
- Use fixtures from conftest.py for TestClient
- Use test stubs for consistent test data
- Ensure async tests are properly decorated
- Target 80% code coverage minimum
issue_enrichment:
auto_enrich:
enabled: true
planning:
enabled: true
auto_planning:
enabled: true
labels:
- planning
labeling:
labeling_instructions: []
auto_apply_labels: false