-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.coderabbit.yaml
More file actions
245 lines (205 loc) · 6.87 KB
/
.coderabbit.yaml
File metadata and controls
245 lines (205 loc) · 6.87 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
---
# yaml-language-server: $schema=https://docs.coderabbit.ai/schema/schema.v2.json
# CodeRabbit Configuration
# StringManipulation PHP 8.3+ Library
# Enforces strict quality standards: PHPStan MAX, SOLID principles, PER-CS2.0
# Language and Tone
language: en-ZA
early_access: true
tone_instructions: >-
Expert PHP reviewer proficient in PER Coding Style 2.0, SOLID, and FOOP.
Advise on immutable data, pure functions, and functional composition.
Provide concise, actionable feedback.
# Review configuration
reviews:
# Review profile and behaviour
profile: "assertive"
request_changes_workflow: true
high_level_summary: true
high_level_summary_placeholder: "@coderabbitai summary"
poem: false
review_status: true
commit_status: true
fail_commit_status: false
collapse_walkthrough: true
# Walkthrough features
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: true
auto_assign_reviewers: false
# Path filters (exclude generated files, vendor, etc.)
path_filters:
- "!vendor/**"
- "!reports/**"
- "!node_modules/**"
- "!*.lock"
- "src/**"
- "tests/**"
# Path-specific instructions
path_instructions:
- path: "**/*.php"
instructions: |
Review PHP code for adherence to PER Coding Style 2.0 guidelines.
Ensure proper namespace usage, code organisation, and separation
of concerns. Verify that SOLID principles are followed and
encourage FOOP techniques—such as immutable data, pure functions,
and functional composition—to improve maintainability,
testability, and performance.
Specific checks:
- Strict typing: `declare(strict_types=1);` is required
- Explicit type declarations for all parameters and return types
- Final classes with static methods where appropriate
- Comprehensive docblocks with @param, @return, and @example tags
- No methods exceeding 100 lines (PHPMD rule)
- PHP 8.3+ features and patterns
- Proper error handling and null safety
- path: "tests/**/*.php"
instructions: |
Review test code for:
- TDD compliance (tests should be clear and comprehensive)
- PHPUnit best practices
- 100% coverage for critical paths, 90%+ for standard code
- Fast execution (unit tests <100ms, integration <5s)
- Independent, deterministic tests
- Descriptive test names and clear assertions
- Proper mocking and test isolation
# Automatic review settings
auto_review:
enabled: true
auto_incremental_review: true
ignore_title_keywords:
- "WIP"
- "DO NOT MERGE"
- "DRAFT"
drafts: false
base_branches:
- "main"
- "develop"
- "feat/.*"
- "fix/.*"
- "refactor/.*"
# Finishing touches
finishing_touches:
docstrings:
enabled: true
unit_tests:
enabled: true
# Pre-merge checks
pre_merge_checks:
docstrings:
mode: "error"
threshold: 80
title:
mode: "warning"
requirements: "Follow conventional commits format: type(scope): description. Types: feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert|security|deps|config|release"
description:
mode: "warning"
issue_assessment:
mode: "warning"
custom_checks:
- mode: "error"
name: "Strict Type Declarations"
instructions: "All PHP files in src/ must begin with `declare(strict_types=1);` after the opening PHP tag and before the namespace declaration."
- mode: "error"
name: "No Debugging Functions"
instructions: "Production code (src/ directory) must not contain debugging functions: var_dump(), var_export(), print_r(), dd(), or dump()."
- mode: "warning"
name: "Test Coverage"
instructions: "New code must have corresponding PHPUnit tests. Critical features require 100% line coverage; standard features require 90% coverage."
- mode: "warning"
name: "Performance Complexity"
instructions: "Algorithms should avoid O(n²) or worse time complexity. Document Big O time complexity for non-trivial algorithms."
- mode: "warning"
name: "Security Best Practices"
instructions: "Validate all user input. Use parameterised statements for SQL queries. Never hardcode secrets, credentials, or API keys."
# Tools configuration
tools:
# GitHub Checks - MAX TIMEOUT (15 minutes)
github-checks:
enabled: true
timeout_ms: 900000
# PHP Tools
phpstan:
enabled: true
level: "max"
phpmd:
enabled: true
phpcs:
enabled: true
# Security and quality tools
gitleaks:
enabled: true
actionlint:
enabled: true
semgrep:
enabled: true
# Documentation and style
languagetool:
enabled: true
level: "default"
enabled_only: false
# Disable non-PHP tools to reduce noise
shellcheck:
enabled: false
ruff:
enabled: false
eslint:
enabled: false
yamllint:
enabled: true
# Chat configuration
chat:
auto_reply: true
art: true
# Knowledge base
knowledge_base:
opt_out: false
web_search:
enabled: true
code_guidelines:
enabled: true
filePatterns:
- "**/CLAUDE.md"
- "**/.cursorrules"
- ".github/copilot-instructions.md"
- "docs/coding-standards.md"
learnings:
scope: "auto"
issues:
scope: "local"
pull_requests:
scope: "local"
# Code Generation Configuration
code_generation:
# Docstring Generation
docstrings:
language: en-ZA
path_instructions:
- path: "src/**/*.php"
instructions: |
Focus on explaining business behaviour and functionality, not obvious implementation.
Use South African English spelling (organisation, optimisation, analyse, behaviour).
Include @param and @return tags with proper types.
Add @throws for exceptions.
Add @example tags demonstrating usage.
Reference related documentation with @see tags.
Follow PER Coding Style 2.0 conventions.
# Unit Test Generation
unit_tests:
path_instructions:
- path: "src/**/*.php"
instructions: |
Generate PHPUnit tests following TDD principles:
- Test names must describe behaviour: test_methodName_condition_expectedBehaviour
- Each test must follow the AAA pattern (Arrange-Act-Assert)
- Include unit tests for all public methods, edge cases, and error conditions
- Tests must be independent and deterministic
- Target fast execution (<100ms for unit tests)
- Use data providers with #[DataProvider] for testing multiple scenarios
- Focus on critical functionality and edge cases