|
1 | 1 | # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json |
2 | | -# CodeRabbit Configuration - Nikolas de Hor projects |
3 | | -# Template universal: cobre stacks variadas (Next.js, React, FastAPI, Python CLI, MCP servers, Flutter, Static, Shell) |
| 2 | +# Template React/Vite/TS + Supabase |
4 | 3 |
|
5 | 4 | language: "pt-BR" |
6 | | -tone_instructions: "Seja profissional, construtivo e focado em qualidade. Comentários em português do Brasil. Sem em dashes (— ou –), usar hífens (-) ou vírgulas. Nome do autor: Nikolas de Hor. Goiânia sempre com acento." |
| 5 | +tone_instructions: "Assertivo. Bugs, segurança e performance. pt-BR, hífens, sem em-dashes." |
| 6 | +# 68 chars |
| 7 | + |
7 | 8 | early_access: false |
8 | 9 |
|
9 | 10 | reviews: |
| 11 | + profile: "assertive" |
| 12 | + request_changes_workflow: true |
| 13 | + high_level_summary: true |
| 14 | + review_status: true |
| 15 | + poem: false |
| 16 | + sequence_diagrams: true |
| 17 | + estimate_code_review_effort: true |
| 18 | + |
10 | 19 | auto_review: |
11 | 20 | enabled: true |
| 21 | + drafts: false |
12 | 22 | base_branches: |
13 | 23 | - main |
14 | | - drafts: false |
15 | | - auto_incremental_review: false |
16 | | - |
17 | | - request_changes_workflow: false |
18 | | - high_level_summary: true |
19 | | - poem: false |
20 | | - review_status: true |
21 | | - collapse_walkthrough: false |
22 | 24 |
|
23 | 25 | path_instructions: |
24 | | - - path: "**/*.{ts,tsx,js,jsx}" |
25 | | - instructions: | |
26 | | - TypeScript/JavaScript geral. Verificar: |
27 | | - - Tipos estritos quando possível (evitar any sem justificativa). |
28 | | - - Async/await sem unhandled promise rejection. |
29 | | - - Imports organizados (sem ciclos). |
30 | | - - Sem console.log esquecido em produção. |
31 | | - - Sem credenciais hardcoded ou tokens. |
32 | | - - process.env validado (não usar undefined silenciosamente). |
33 | | -
|
34 | | - - path: "**/*.{py}" |
35 | | - instructions: | |
36 | | - Python geral. Verificar: |
37 | | - - PEP 8 e type hints quando aplicável. |
38 | | - - try/except específico (não capturar Exception nu). |
39 | | - - Sem credenciais hardcoded. |
40 | | - - os.environ validado. |
41 | | - - SQL queries parametrizadas (nunca f-string em SQL). |
42 | | - - Subprocess sem shell=True com input não confiável. |
43 | | -
|
44 | | - - path: "**/*.{dart}" |
45 | | - instructions: | |
46 | | - Dart/Flutter geral. Verificar: |
47 | | - - null safety estrito. |
48 | | - - StatelessWidget preferido quando não há state. |
49 | | - - Async/await com error handling. |
50 | | - - BuildContext não usado após dispose. |
51 | | - - Sem chaves hardcoded. |
52 | | -
|
53 | | - - path: "**/auth/**" |
54 | | - instructions: | |
55 | | - Auth crítico. Verificar: |
56 | | - - Secrets sempre via env vars. |
57 | | - - Tokens com expiração apropriada. |
58 | | - - bcrypt rounds >= 10 (idealmente 12). |
59 | | - - Endpoints não vazam existência de usuário. |
60 | | - - Rate limit em login/signup/forgot-password. |
61 | | - - Logout limpa estado completamente (localStorage, cookies, refresh token). |
62 | | -
|
63 | | - - path: "**/api/**" |
64 | | - instructions: | |
65 | | - API endpoints. Verificar: |
66 | | - - Validação de entrada via schema (Zod, Pydantic, class-validator). |
67 | | - - Rate limiting onde aplicável. |
68 | | - - Mensagens de erro não vazam stack trace em produção. |
69 | | - - Status codes corretos (401 vs 403, 400 vs 422). |
70 | | - - CORS configurado de forma restritiva. |
71 | | -
|
72 | | - - path: "**/middleware*" |
73 | | - instructions: | |
74 | | - Middleware. Verificar: |
75 | | - - Matcher cobre todas rotas pretendidas. |
76 | | - - Não bloqueia rotas públicas por engano. |
77 | | - - Headers de segurança aplicados (CSP, X-Frame-Options, etc). |
78 | | -
|
79 | | - - path: "**/migrations/**" |
80 | | - instructions: | |
81 | | - Database migrations. Verificar: |
82 | | - - Não destrutivas sem backup (DROP TABLE, DROP COLUMN). |
83 | | - - Rollback documentado. |
84 | | - - Mudança de tipo de coluna tem migração de dados. |
85 | | - - FK com índice no lado FK. |
86 | | -
|
87 | | - - path: "**/schema.{prisma,sql}" |
88 | | - instructions: | |
89 | | - Schema database. Verificar: |
90 | | - - Índices em colunas frequentemente filtradas. |
91 | | - - Unique constraints onde aplicável. |
92 | | - - Relations com onDelete coerente. |
93 | | - - Tipos apropriados (não usar String pra ID quando UUID/Int fazem sentido). |
94 | | -
|
95 | | - - path: "**/Dockerfile*" |
96 | | - instructions: | |
97 | | - Dockerfile. Verificar: |
98 | | - - Multi-stage quando build é separado de runtime. |
99 | | - - User não-root no runtime. |
100 | | - - HEALTHCHECK configurado. |
101 | | - - Sem segredos hardcoded. |
102 | | - - Versão da base image fixada (não latest). |
103 | | - - .dockerignore presente pra reduzir contexto. |
104 | | -
|
105 | | - - path: "**/.github/workflows/**" |
106 | | - instructions: | |
107 | | - GitHub Actions. Verificar: |
108 | | - - Secrets via ${{ secrets.* }}, nunca hardcoded. |
109 | | - - Concurrency group pra evitar runs duplicados. |
110 | | - - Permissions explicitas (preferir least privilege). |
111 | | - - actions/checkout@vX com versão fixa ou SHA. |
112 | | - - Cache strategy não vaza dependências privadas. |
113 | | -
|
114 | | - - path: "**/*.env.example" |
| 26 | + - path: "src/**/*.{ts,tsx,js,jsx}" |
115 | 27 | instructions: | |
116 | | - Env example. Verificar: |
117 | | - - APENAS placeholders, nunca valores reais. |
118 | | - - Sem project-refs reais (Supabase, Firebase, etc). |
119 | | - - Documentação clara de onde obter cada chave. |
120 | | - - Variáveis NEXT_PUBLIC_* / VITE_* / REACT_APP_* só pra valores PÚBLICOS. |
121 | | -
|
122 | | - - path: "**/package.json" |
| 28 | + TypeScript/React. Verificar: |
| 29 | + - Sem uso de `any` sem justificativa. |
| 30 | + - Hooks usados corretamente (dependências em useEffect, cleanup em subscriptions). |
| 31 | + - Props com tipos explícitos, sem PropTypes implícitos. |
| 32 | + - Não renderizar dados não sanitizados via dangerouslySetInnerHTML. |
| 33 | + - Estados de erro e loading tratados explicitamente (não só happy path). |
| 34 | +
|
| 35 | + - path: "src/services/**" |
123 | 36 | instructions: | |
124 | | - package.json. Verificar: |
125 | | - - Sem dependências desnecessárias (sugerir devDeps quando aplicável). |
126 | | - - Scripts não expõem secrets. |
127 | | - - Sem versões "latest" (preferir SemVer explícito). |
| 37 | + Camada de serviço. Verificar: |
| 38 | + - Chamadas de API com tratamento de erro explícito. |
| 39 | + - Tokens/credenciais nunca logados ou expostos em respostas de erro. |
| 40 | + - Retry com backoff em endpoints críticos. |
128 | 41 |
|
129 | | - - path: "**/requirements*.txt" |
| 42 | + - path: "supabase/**" |
130 | 43 | instructions: | |
131 | | - Python requirements. Verificar: |
132 | | - - Versões pinadas (==X.Y.Z), não open-ended. |
133 | | - - Sem pacotes obsoletos com CVEs conhecidos. |
| 44 | + Supabase: RLS habilitado em todas as tabelas com dados de usuário, policies com |
| 45 | + user_id = auth.uid(), migrations idempotentes, índices em colunas de filtro. |
| 46 | + Nunca chamar supabase.auth.admin sem verificação de papel admin. |
134 | 47 |
|
135 | | - - path: "**/pubspec.yaml" |
| 48 | + - path: ".github/workflows/**" |
136 | 49 | instructions: | |
137 | | - Flutter pubspec. Verificar: |
138 | | - - Versões SDK e Flutter especificadas. |
139 | | - - Dependências sem ^ aberto demais. |
140 | | - - Sem assets bloated. |
| 50 | + CI/CD: secrets via secrets.*, nunca hardcoded. Permissions mínimas. Actions |
| 51 | + pinadas por SHA quando possível. Concurrency control pra evitar runs duplicados. |
141 | 52 |
|
142 | | - - path: "**/*.md" |
| 53 | + - path: "**/.env.example" |
143 | 54 | instructions: | |
144 | | - Documentação. Verificar: |
145 | | - - Linguagem clara em pt-BR ou en consistente no arquivo. |
146 | | - - Exemplos de código funcionam (sintaxe correta). |
147 | | - - Links não quebrados (relative ou absolute consistentes). |
148 | | - - Sem em dashes (usar hífens). |
149 | | - - "Goiânia" sempre com acento se mencionada. |
| 55 | + Apenas placeholders, NUNCA valores reais. Sem project-refs reais do Supabase. |
150 | 56 |
|
151 | 57 | path_filters: |
152 | | - # Build artifacts |
153 | 58 | - "!**/node_modules/**" |
154 | 59 | - "!**/dist/**" |
155 | 60 | - "!**/build/**" |
156 | | - - "!**/.next/**" |
157 | | - - "!**/.nuxt/**" |
158 | | - - "!**/.svelte-kit/**" |
159 | | - - "!**/.output/**" |
160 | | - - "!**/.cache/**" |
161 | | - - "!**/coverage/**" |
162 | | - # Lockfiles |
163 | | - - "!**/package-lock.json" |
164 | | - - "!**/yarn.lock" |
165 | | - - "!**/pnpm-lock.yaml" |
166 | | - - "!**/poetry.lock" |
167 | | - - "!**/Pipfile.lock" |
168 | | - - "!**/Cargo.lock" |
169 | | - - "!**/composer.lock" |
170 | | - # Minified |
171 | 61 | - "!**/*.min.js" |
172 | 62 | - "!**/*.min.css" |
173 | | - - "!**/*.bundle.*" |
174 | | - - "!**/*.generated.*" |
175 | | - # Snapshots/cache |
| 63 | + - "!**/*.lock" |
| 64 | + - "!**/package-lock.json" |
| 65 | + - "!**/pnpm-lock.yaml" |
176 | 66 | - "!**/*.snap" |
177 | | - - "!**/__pycache__/**" |
178 | | - - "!**/.pytest_cache/**" |
179 | | - - "!**/.mypy_cache/**" |
180 | | - - "!**/.ruff_cache/**" |
181 | | - # DB/local |
182 | | - - "!**/*.db" |
183 | | - - "!**/*.sqlite" |
184 | | - - "!**/*.sqlite3" |
185 | | - # Env files (sempre proteger) |
186 | | - - "!**/.env" |
187 | | - - "!**/.env.local" |
188 | | - - "!**/.env.production" |
189 | | - - "!**/.env.development" |
190 | | - # Binários |
191 | 67 | - "!**/*.png" |
192 | 68 | - "!**/*.jpg" |
193 | 69 | - "!**/*.jpeg" |
194 | 70 | - "!**/*.gif" |
195 | 71 | - "!**/*.ico" |
196 | 72 | - "!**/*.svg" |
197 | 73 | - "!**/*.webp" |
198 | | - - "!**/*.avif" |
199 | 74 | - "!**/*.woff" |
200 | 75 | - "!**/*.woff2" |
201 | 76 | - "!**/*.ttf" |
202 | | - - "!**/*.eot" |
203 | 77 | - "!**/*.pdf" |
204 | | - - "!**/*.zip" |
205 | | - - "!**/*.tar.gz" |
206 | | - # Mobile builds |
207 | | - - "!**/android/build/**" |
208 | | - - "!**/ios/Pods/**" |
209 | | - - "!**/*.ipa" |
210 | | - - "!**/*.apk" |
211 | | - - "!**/*.aab" |
212 | | - # Próprio config |
213 | 78 | - "!.coderabbit.yaml" |
214 | 79 |
|
| 80 | + tools: |
| 81 | + gitleaks: |
| 82 | + enabled: true |
| 83 | + semgrep: |
| 84 | + enabled: true |
| 85 | + presidio: |
| 86 | + enabled: true |
| 87 | + |
| 88 | +knowledge_base: |
| 89 | + web_search: |
| 90 | + enabled: true |
| 91 | + code_guidelines: |
| 92 | + enabled: true |
| 93 | + filePatterns: |
| 94 | + - ".github/copilot-instructions.md" |
| 95 | + - "AGENTS.md" |
| 96 | + learnings: |
| 97 | + scope: "local" |
| 98 | + |
215 | 99 | chat: |
216 | 100 | auto_reply: true |
0 commit comments