@the-bearded-bear/claude-craft 8.8.1 → 8.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Dev/i18n/de/Angular/commands/check-compliance.md +218 -168
- package/Dev/i18n/de/Common/agents/refactoring-specialist.md +146 -69
- package/Dev/i18n/de/Common/commands/add-technology.md +166 -68
- package/Dev/i18n/de/Common/commands/setup-ci.md +216 -33
- package/Dev/i18n/de/Laravel/commands/check-compliance.md +223 -115
- package/Dev/i18n/de/Python/checklists/new-feature.md +319 -44
- package/Dev/i18n/de/React/rules/02-architecture.md +483 -322
- package/Dev/i18n/de/React/rules/03-coding-standards.md +584 -368
- package/Dev/i18n/de/Symfony/commands/check-compliance.md +186 -114
- package/Dev/i18n/de/Symfony/rules/07-testing-symfony.md +679 -10
- package/Dev/i18n/de/UIUX/commands/a11y-component.md +284 -26
- package/Dev/i18n/de/UIUX/commands/design-tokens.md +199 -35
- package/Dev/i18n/de/UIUX/commands/user-flow.md +179 -16
- package/Dev/i18n/de/VueJS/commands/check-compliance.md +227 -102
- package/Dev/i18n/es/Angular/commands/check-compliance.md +217 -167
- package/Dev/i18n/es/Common/commands/add-technology.md +158 -60
- package/Dev/i18n/es/Laravel/commands/check-compliance.md +223 -115
- package/Dev/i18n/es/React/commands/check-testing.md +263 -169
- package/Dev/i18n/es/ReactNative/commands/check-testing.md +256 -198
- package/Dev/i18n/es/Symfony/commands/check-compliance.md +189 -117
- package/Dev/i18n/es/Symfony/commands/check-testing.md +301 -102
- package/Dev/i18n/es/Symfony/commands/migration-plan.md +267 -34
- package/Dev/i18n/es/UIUX/commands/a11y-component.md +274 -16
- package/Dev/i18n/es/UIUX/commands/design-tokens.md +186 -22
- package/Dev/i18n/es/UIUX/commands/user-flow.md +173 -10
- package/Dev/i18n/es/VueJS/commands/check-compliance.md +227 -102
- package/Dev/i18n/fr/Angular/commands/check-compliance.md +217 -167
- package/Dev/i18n/fr/Common/commands/ralph-run.md +138 -60
- package/Dev/i18n/fr/Laravel/commands/check-compliance.md +223 -115
- package/Dev/i18n/fr/React/commands/check-architecture.md +370 -53
- package/Dev/i18n/fr/React/commands/check-code-quality.md +454 -64
- package/Dev/i18n/fr/React/commands/check-testing.md +476 -102
- package/Dev/i18n/fr/Symfony/commands/check-compliance.md +188 -116
- package/Dev/i18n/fr/VueJS/commands/check-compliance.md +227 -102
- package/Dev/i18n/pt/Angular/commands/check-compliance.md +225 -175
- package/Dev/i18n/pt/Common/agents/ralph-conductor.md +211 -30
- package/Dev/i18n/pt/Common/commands/add-technology.md +149 -51
- package/Dev/i18n/pt/Common/commands/ralph-run.md +239 -35
- package/Dev/i18n/pt/Flutter/commands/analyze-performance.md +331 -46
- package/Dev/i18n/pt/Flutter/commands/check-compliance.md +234 -29
- package/Dev/i18n/pt/Flutter/commands/generate-feature.md +526 -51
- package/Dev/i18n/pt/Flutter/commands/generate-widget.md +515 -27
- package/Dev/i18n/pt/Flutter/commands/golden-update.md +322 -46
- package/Dev/i18n/pt/Flutter/commands/localization-check.md +278 -37
- package/Dev/i18n/pt/Laravel/commands/check-compliance.md +212 -104
- package/Dev/i18n/pt/React/commands/accessibility-check.md +151 -42
- package/Dev/i18n/pt/React/commands/bundle-analyze.md +300 -25
- package/Dev/i18n/pt/React/commands/check-architecture.md +369 -34
- package/Dev/i18n/pt/React/commands/check-code-quality.md +440 -34
- package/Dev/i18n/pt/React/commands/check-compliance.md +232 -62
- package/Dev/i18n/pt/React/commands/check-security.md +370 -31
- package/Dev/i18n/pt/React/commands/check-testing.md +473 -43
- package/Dev/i18n/pt/React/commands/generate-component.md +454 -19
- package/Dev/i18n/pt/React/commands/generate-hook.md +425 -24
- package/Dev/i18n/pt/React/commands/storybook-story.md +520 -35
- package/Dev/i18n/pt/ReactNative/commands/app-size.md +358 -387
- package/Dev/i18n/pt/ReactNative/commands/check-code-quality.md +246 -75
- package/Dev/i18n/pt/ReactNative/commands/check-compliance.md +191 -85
- package/Dev/i18n/pt/ReactNative/commands/check-security.md +363 -115
- package/Dev/i18n/pt/ReactNative/commands/check-testing.md +269 -79
- package/Dev/i18n/pt/ReactNative/commands/generate-screen.md +491 -324
- package/Dev/i18n/pt/ReactNative/commands/native-module.md +539 -82
- package/Dev/i18n/pt/ReactNative/commands/store-prepare.md +429 -185
- package/Dev/i18n/pt/ReactNative/rules/02-architecture.md +1084 -31
- package/Dev/i18n/pt/Symfony/commands/check-compliance.md +195 -123
- package/Dev/i18n/pt/UIUX/commands/a11y-audit.md +208 -24
- package/Dev/i18n/pt/UIUX/commands/a11y-component.md +281 -23
- package/Dev/i18n/pt/UIUX/commands/design-tokens.md +197 -33
- package/Dev/i18n/pt/UIUX/commands/user-flow.md +183 -20
- package/Dev/i18n/pt/VueJS/commands/check-compliance.md +228 -103
- package/Dev/i18n/pt/Workflow/commands/analyze.md +147 -146
- package/Dev/i18n/pt/Workflow/commands/design.md +205 -204
- package/Dev/i18n/pt/Workflow/commands/implement.md +184 -184
- package/Project/i18n/de/Sprint/commands/dev.md +339 -86
- package/Project/i18n/es/Sprint/commands/dev.md +342 -91
- package/Project/i18n/pt/Sprint/commands/dev.md +343 -92
- package/bundles/cursor/.cursorrules +1 -1
- package/bundles/windsurf/.windsurfrules +1 -1
- package/package.json +1 -1
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
---
|
|
2
|
-
description:
|
|
2
|
+
description: Verificação de Qualidade de Código
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
#
|
|
5
|
+
# Verificação de Qualidade de Código
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Realize uma análise abrangente da qualidade de código da aplicação React.
|
|
8
8
|
|
|
9
9
|
## O Que Este Comando Faz
|
|
10
10
|
|
|
11
|
-
1. **
|
|
11
|
+
1. **Análise de Qualidade**
|
|
12
12
|
- Executar linting (ESLint)
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
|
|
19
|
-
2. **
|
|
20
|
-
- Complexidade
|
|
21
|
-
-
|
|
13
|
+
- Verificação de tipos (TypeScript)
|
|
14
|
+
- Formatação de código (Prettier)
|
|
15
|
+
- Análise de complexidade
|
|
16
|
+
- Detecção de code smells
|
|
17
|
+
- Verificação de cobertura de testes
|
|
18
|
+
|
|
19
|
+
2. **Métricas Medidas**
|
|
20
|
+
- Complexidade ciclomática
|
|
21
|
+
- Duplicação de código
|
|
22
22
|
- Cobertura de testes
|
|
23
|
-
-
|
|
24
|
-
-
|
|
23
|
+
- Dívida técnica
|
|
24
|
+
- Índice de manutenibilidade
|
|
25
25
|
|
|
26
|
-
3. **
|
|
27
|
-
-
|
|
26
|
+
3. **Relatório Gerado**
|
|
27
|
+
- Pontuação de qualidade
|
|
28
28
|
- Problemas por severidade
|
|
29
|
-
-
|
|
30
|
-
-
|
|
29
|
+
- Recomendações de refatoração
|
|
30
|
+
- Tendências ao longo do tempo
|
|
31
31
|
|
|
32
32
|
## Como Usar
|
|
33
33
|
|
|
34
34
|
```bash
|
|
35
|
-
#
|
|
35
|
+
# Verificação completa de qualidade
|
|
36
36
|
npm run quality
|
|
37
37
|
|
|
38
|
-
#
|
|
38
|
+
# Verificações individuais
|
|
39
39
|
npm run lint
|
|
40
40
|
npm run type-check
|
|
41
41
|
npm run format:check
|
|
@@ -44,21 +44,427 @@ npm run test:coverage
|
|
|
44
44
|
|
|
45
45
|
## Modo Plano
|
|
46
46
|
|
|
47
|
-
> O modo plano é ativado automaticamente quando o escopo abrange vários módulos ou
|
|
47
|
+
> O modo plano é ativado automaticamente quando o escopo abrange vários módulos ou exige investigação transversal.
|
|
48
|
+
|
|
49
|
+
## Verificações de Qualidade
|
|
50
|
+
|
|
51
|
+
### 1. Linting (ESLint)
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Verificar erros
|
|
55
|
+
npm run lint
|
|
56
|
+
|
|
57
|
+
# Corrigir erros automaticamente
|
|
58
|
+
npm run lint:fix
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Configuração**:
|
|
62
|
+
```json
|
|
63
|
+
// .eslintrc.json
|
|
64
|
+
{
|
|
65
|
+
"extends": [
|
|
66
|
+
"eslint:recommended",
|
|
67
|
+
"plugin:@typescript-eslint/recommended",
|
|
68
|
+
"plugin:react/recommended",
|
|
69
|
+
"plugin:react-hooks/recommended"
|
|
70
|
+
],
|
|
71
|
+
"rules": {
|
|
72
|
+
"no-console": "warn",
|
|
73
|
+
"no-debugger": "error",
|
|
74
|
+
"@typescript-eslint/no-explicit-any": "error",
|
|
75
|
+
"react-hooks/rules-of-hooks": "error",
|
|
76
|
+
"react-hooks/exhaustive-deps": "warn"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 2. Verificação de Tipos (TypeScript)
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# Verificar tipos
|
|
85
|
+
npm run type-check
|
|
86
|
+
|
|
87
|
+
# Modo observação
|
|
88
|
+
npm run type-check:watch
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**Problemas Comuns**:
|
|
92
|
+
```typescript
|
|
93
|
+
// ❌ Ruim - Tipo any
|
|
94
|
+
const data: any = fetchData();
|
|
95
|
+
|
|
96
|
+
// ✅ Bom - Tipos adequados
|
|
97
|
+
interface User {
|
|
98
|
+
id: string;
|
|
99
|
+
name: string;
|
|
100
|
+
}
|
|
101
|
+
const data: User = fetchData();
|
|
102
|
+
|
|
103
|
+
// ❌ Ruim - any implícito
|
|
104
|
+
const handleClick = (event) => {};
|
|
105
|
+
|
|
106
|
+
// ✅ Bom - Tipos explícitos
|
|
107
|
+
const handleClick = (event: React.MouseEvent) => {};
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### 3. Formatação de Código (Prettier)
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
# Verificar formatação
|
|
114
|
+
npm run format:check
|
|
115
|
+
|
|
116
|
+
# Formatar todos os arquivos
|
|
117
|
+
npm run format
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
**Configuração**:
|
|
121
|
+
```json
|
|
122
|
+
// .prettierrc
|
|
123
|
+
{
|
|
124
|
+
"semi": true,
|
|
125
|
+
"trailingComma": "all",
|
|
126
|
+
"singleQuote": true,
|
|
127
|
+
"printWidth": 100,
|
|
128
|
+
"tabWidth": 2
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### 4. Análise de Complexidade
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
// ❌ Ruim - Alta complexidade (10+)
|
|
136
|
+
function processUser(user, options) {
|
|
137
|
+
if (user.isActive) {
|
|
138
|
+
if (user.role === 'admin') {
|
|
139
|
+
if (options.includeStats) {
|
|
140
|
+
if (user.lastLogin) {
|
|
141
|
+
// ... lógica aninhada
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
// Complexidade: 15
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// ✅ Bom - Baixa complexidade
|
|
150
|
+
function processUser(user, options) {
|
|
151
|
+
if (!user.isActive) return null;
|
|
152
|
+
if (user.role !== 'admin') return formatBasicUser(user);
|
|
153
|
+
if (!options.includeStats) return formatAdminUser(user);
|
|
154
|
+
return formatAdminUserWithStats(user);
|
|
155
|
+
// Complexidade: 4
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### 5. Duplicação de Código
|
|
160
|
+
|
|
161
|
+
```typescript
|
|
162
|
+
// ❌ Ruim - Código duplicado
|
|
163
|
+
export const UserList = () => {
|
|
164
|
+
const [users, setUsers] = useState([]);
|
|
165
|
+
const [loading, setLoading] = useState(false);
|
|
166
|
+
|
|
167
|
+
useEffect(() => {
|
|
168
|
+
setLoading(true);
|
|
169
|
+
fetch('/api/users')
|
|
170
|
+
.then(res => res.json())
|
|
171
|
+
.then(setUsers)
|
|
172
|
+
.finally(() => setLoading(false));
|
|
173
|
+
}, []);
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
export const ProductList = () => {
|
|
177
|
+
const [products, setProducts] = useState([]);
|
|
178
|
+
const [loading, setLoading] = useState(false);
|
|
179
|
+
|
|
180
|
+
useEffect(() => {
|
|
181
|
+
setLoading(true);
|
|
182
|
+
fetch('/api/products')
|
|
183
|
+
.then(res => res.json())
|
|
184
|
+
.then(setProducts)
|
|
185
|
+
.finally(() => setLoading(false));
|
|
186
|
+
}, []);
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
// ✅ Bom - Hook reutilizável
|
|
190
|
+
export const useFetch = <T>(url: string) => {
|
|
191
|
+
const [data, setData] = useState<T[]>([]);
|
|
192
|
+
const [loading, setLoading] = useState(false);
|
|
193
|
+
|
|
194
|
+
useEffect(() => {
|
|
195
|
+
setLoading(true);
|
|
196
|
+
fetch(url)
|
|
197
|
+
.then(res => res.json())
|
|
198
|
+
.then(setData)
|
|
199
|
+
.finally(() => setLoading(false));
|
|
200
|
+
}, [url]);
|
|
201
|
+
|
|
202
|
+
return { data, loading };
|
|
203
|
+
};
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## Métricas de Qualidade de Código
|
|
207
|
+
|
|
208
|
+
### Complexidade Ciclomática
|
|
209
|
+
|
|
210
|
+
**Meta**: < 10 por função
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
# Instalar verificador de complexidade
|
|
214
|
+
npm install -D eslint-plugin-complexity
|
|
215
|
+
|
|
216
|
+
# Adicionar à configuração do ESLint
|
|
217
|
+
{
|
|
218
|
+
"rules": {
|
|
219
|
+
"complexity": ["error", 10]
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### Cobertura de Testes
|
|
225
|
+
|
|
226
|
+
**Metas**:
|
|
227
|
+
- Linhas: > 80%
|
|
228
|
+
- Funções: > 80%
|
|
229
|
+
- Branches: > 75%
|
|
230
|
+
- Declarações: > 80%
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
# Gerar relatório de cobertura
|
|
234
|
+
npm run test:coverage
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
```json
|
|
238
|
+
// vitest.config.ts
|
|
239
|
+
export default defineConfig({
|
|
240
|
+
test: {
|
|
241
|
+
coverage: {
|
|
242
|
+
provider: 'v8',
|
|
243
|
+
reporter: ['text', 'json', 'html'],
|
|
244
|
+
lines: 80,
|
|
245
|
+
functions: 80,
|
|
246
|
+
branches: 75,
|
|
247
|
+
statements: 80
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### Duplicação de Código
|
|
254
|
+
|
|
255
|
+
**Meta**: < 3% de duplicação
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
# Instalar jscpd
|
|
259
|
+
npm install -D jscpd
|
|
260
|
+
|
|
261
|
+
# Executar verificação de duplicação
|
|
262
|
+
npx jscpd src/
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
## Portões de Qualidade
|
|
266
|
+
|
|
267
|
+
### Verificações de Pré-Commit
|
|
268
|
+
|
|
269
|
+
```json
|
|
270
|
+
// package.json
|
|
271
|
+
{
|
|
272
|
+
"lint-staged": {
|
|
273
|
+
"*.{ts,tsx}": [
|
|
274
|
+
"eslint --fix",
|
|
275
|
+
"prettier --write",
|
|
276
|
+
"vitest related --run --passWithNoTests"
|
|
277
|
+
]
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### Portões de Qualidade no CI/CD
|
|
283
|
+
|
|
284
|
+
```yaml
|
|
285
|
+
# .github/workflows/quality.yml
|
|
286
|
+
name: Quality Check
|
|
48
287
|
|
|
49
|
-
|
|
288
|
+
on: [pull_request]
|
|
289
|
+
|
|
290
|
+
jobs:
|
|
291
|
+
quality:
|
|
292
|
+
runs-on: ubuntu-latest
|
|
293
|
+
steps:
|
|
294
|
+
- uses: actions/checkout@v3
|
|
295
|
+
- uses: actions/setup-node@v3
|
|
296
|
+
|
|
297
|
+
- name: Instalar dependências
|
|
298
|
+
run: npm ci
|
|
299
|
+
|
|
300
|
+
- name: Lint
|
|
301
|
+
run: npm run lint
|
|
302
|
+
|
|
303
|
+
- name: Verificação de tipos
|
|
304
|
+
run: npm run type-check
|
|
305
|
+
|
|
306
|
+
- name: Verificação de formatação
|
|
307
|
+
run: npm run format:check
|
|
308
|
+
|
|
309
|
+
- name: Testes com cobertura
|
|
310
|
+
run: npm run test:coverage
|
|
311
|
+
|
|
312
|
+
- name: Verificar cobertura
|
|
313
|
+
uses: codecov/codecov-action@v3
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
## Code Smells
|
|
317
|
+
|
|
318
|
+
### 1. Listas de Parâmetros Longas
|
|
319
|
+
|
|
320
|
+
```typescript
|
|
321
|
+
// ❌ Ruim - Muitos parâmetros
|
|
322
|
+
function createUser(
|
|
323
|
+
name: string,
|
|
324
|
+
email: string,
|
|
325
|
+
age: number,
|
|
326
|
+
address: string,
|
|
327
|
+
phone: string,
|
|
328
|
+
role: string
|
|
329
|
+
) {}
|
|
330
|
+
|
|
331
|
+
// ✅ Bom - Usar parâmetro de objeto
|
|
332
|
+
interface CreateUserParams {
|
|
333
|
+
name: string;
|
|
334
|
+
email: string;
|
|
335
|
+
age: number;
|
|
336
|
+
address: string;
|
|
337
|
+
phone: string;
|
|
338
|
+
role: string;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
function createUser(params: CreateUserParams) {}
|
|
342
|
+
```
|
|
50
343
|
|
|
51
|
-
|
|
52
|
-
- **Cobertura de Testes**: > 80%
|
|
53
|
-
- **Duplicacao de Codigo**: < 3%
|
|
344
|
+
### 2. Funções Muito Longas
|
|
54
345
|
|
|
55
|
-
|
|
346
|
+
```typescript
|
|
347
|
+
// ❌ Ruim - Função muito longa (100+ linhas)
|
|
348
|
+
function handleSubmit() {
|
|
349
|
+
// ... 100 linhas de código
|
|
350
|
+
}
|
|
56
351
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
352
|
+
// ✅ Bom - Dividir em funções menores
|
|
353
|
+
function handleSubmit() {
|
|
354
|
+
validateForm();
|
|
355
|
+
processData();
|
|
356
|
+
submitToAPI();
|
|
357
|
+
}
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
### 3. Números Mágicos
|
|
361
|
+
|
|
362
|
+
```typescript
|
|
363
|
+
// ❌ Ruim - Números mágicos
|
|
364
|
+
if (user.age > 18 && cart.total > 100) {}
|
|
365
|
+
|
|
366
|
+
// ✅ Bom - Constantes nomeadas
|
|
367
|
+
const ADULT_AGE = 18;
|
|
368
|
+
const FREE_SHIPPING_THRESHOLD = 100;
|
|
369
|
+
|
|
370
|
+
if (user.age > ADULT_AGE && cart.total > FREE_SHIPPING_THRESHOLD) {}
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
### 4. Aninhamento Profundo
|
|
374
|
+
|
|
375
|
+
```typescript
|
|
376
|
+
// ❌ Ruim - Aninhamento profundo
|
|
377
|
+
if (user) {
|
|
378
|
+
if (user.isActive) {
|
|
379
|
+
if (user.role === 'admin') {
|
|
380
|
+
if (hasPermission) {
|
|
381
|
+
// ...
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
// ✅ Bom - Guard clauses (cláusulas de guarda)
|
|
388
|
+
if (!user) return;
|
|
389
|
+
if (!user.isActive) return;
|
|
390
|
+
if (user.role !== 'admin') return;
|
|
391
|
+
if (!hasPermission) return;
|
|
392
|
+
// ...
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
## Integração com SonarQube
|
|
396
|
+
|
|
397
|
+
```bash
|
|
398
|
+
# Instalar o SonarScanner
|
|
399
|
+
npm install -D sonarqube-scanner
|
|
400
|
+
|
|
401
|
+
# Executar análise
|
|
402
|
+
npx sonar-scanner \
|
|
403
|
+
-Dsonar.projectKey=my-project \
|
|
404
|
+
-Dsonar.sources=src \
|
|
405
|
+
-Dsonar.host.url=http://localhost:9000 \
|
|
406
|
+
-Dsonar.login=your-token
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
## Melhoria Contínua
|
|
410
|
+
|
|
411
|
+
### Acompanhar Métricas ao Longo do Tempo
|
|
412
|
+
|
|
413
|
+
```json
|
|
414
|
+
// .qualityrc
|
|
415
|
+
{
|
|
416
|
+
"metrics": {
|
|
417
|
+
"complexity": {
|
|
418
|
+
"current": 8,
|
|
419
|
+
"target": 10,
|
|
420
|
+
"trend": "improving"
|
|
421
|
+
},
|
|
422
|
+
"coverage": {
|
|
423
|
+
"current": 85,
|
|
424
|
+
"target": 80,
|
|
425
|
+
"trend": "stable"
|
|
426
|
+
},
|
|
427
|
+
"duplication": {
|
|
428
|
+
"current": 2,
|
|
429
|
+
"target": 3,
|
|
430
|
+
"trend": "improving"
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
### Dashboard de Qualidade
|
|
437
|
+
|
|
438
|
+
Crie um dashboard para visualizar:
|
|
439
|
+
- Tendências de cobertura de código
|
|
440
|
+
- Tendências de complexidade
|
|
441
|
+
- Número de problemas por severidade
|
|
442
|
+
- Estimativa da dívida técnica
|
|
443
|
+
|
|
444
|
+
## Ferramentas
|
|
445
|
+
|
|
446
|
+
- **ESLint**: Análise estática de código
|
|
447
|
+
- **TypeScript**: Verificação de tipos
|
|
448
|
+
- **Prettier**: Formatação de código
|
|
449
|
+
- **Vitest**: Cobertura de testes
|
|
450
|
+
- **SonarQube**: Plataforma de qualidade de código
|
|
451
|
+
- **jscpd**: Detecção de duplicação
|
|
452
|
+
- **Lighthouse**: Auditoria de desempenho
|
|
453
|
+
|
|
454
|
+
## Melhores Práticas
|
|
455
|
+
|
|
456
|
+
1. **Executar verificações localmente** antes de fazer push
|
|
457
|
+
2. **Automatizar no CI/CD** para impor padrões
|
|
458
|
+
3. **Definir portões de qualidade** que devem ser aprovados
|
|
459
|
+
4. **Monitorar tendências** ao longo do tempo
|
|
460
|
+
5. **Refatorar regularmente** para reduzir a dívida técnica
|
|
461
|
+
6. **Documentar padrões** para a equipe
|
|
462
|
+
7. **Revisar métricas** nas reuniões de equipe
|
|
64
463
|
8. **Celebrar melhorias**
|
|
464
|
+
|
|
465
|
+
## Recursos
|
|
466
|
+
|
|
467
|
+
- [Regras do ESLint](https://eslint.org/docs/rules/)
|
|
468
|
+
- [Manual do TypeScript](https://www.typescriptlang.org/docs/handbook/intro.html)
|
|
469
|
+
- [Princípios de Código Limpo](https://github.com/ryanmcdermott/clean-code-javascript)
|
|
470
|
+
- [Refactoring Guru](https://refactoring.guru/)
|