@wwkit/harness 1.0.32 → 1.0.33
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/LICENSE +21 -21
- package/README.md +128 -128
- package/agents/scrum.md +186 -180
- package/agents/sprint.md +121 -118
- package/bin/index.js +226 -226
- package/commands/fix.md +87 -87
- package/commands/git-sync.md +217 -217
- package/commands/net-port.md +364 -364
- package/commands/pytest.md +10 -10
- package/commands/resume.md +104 -104
- package/commands/tl.md +11 -11
- package/package.json +3 -3
- package/plugin.js +19 -19
- package/readme/development.md +39 -39
- package/readme/publish.md +41 -41
- package/readme/testing.md +44 -44
- package/scripts/postinstall.js +58 -58
- package/skills/better-skill/SKILL.md +124 -124
- package/skills/blame-skill/SKILL.md +201 -201
- package/skills/extract/SKILL.md +119 -119
- package/skills/extract/references/build-xpath.js +30 -30
- package/skills/extract/references/clean-html.js +90 -90
- package/skills/extract/references/detail.md +54 -54
- package/skills/extract/references/detail.schema.json5 +48 -48
- package/skills/extract/references/extract-detail.js +71 -71
- package/skills/extract/references/extract-regex.js +81 -81
- package/skills/extract/references/extract-sample.js +48 -48
- package/skills/extract/references/list-rule-gen.md +109 -109
- package/skills/extract/references/list.md +134 -134
- package/skills/extract/references/list.schema.json5 +33 -33
- package/skills/extract/references/navi.md +44 -44
- package/skills/extract/references/navi.schema.json5 +23 -23
- package/skills/extract/references/text.md +40 -40
- package/skills/extract/references/text.schema.json5 +21 -21
- package/skills/extract/references/to-text.js +20 -20
- package/skills/extract/references/validate-schema.js +39 -39
- package/skills/jstest/SKILL.md +561 -561
- package/skills/jstest/references/case-create.md +327 -327
- package/skills/jstest/references/case-fix.md +273 -273
- package/skills/jstest/references/config.md +148 -148
- package/skills/jstest/references/coverage-analyze.md +247 -247
- package/skills/jstest/references/env-ensure.md +210 -210
- package/skills/jstest/references/execute.md +168 -168
- package/skills/jstest/references/sample.md +166 -166
- package/skills/jstest/references/scoring-rules.md +75 -75
- package/skills/jstest/references/src/jstest-sample/Calculator.js +80 -80
- package/skills/jstest/references/src/jstest-sample/ConfigManager.js +72 -72
- package/skills/jstest/references/src/jstest-sample/FileProcessor.js +57 -57
- package/skills/jstest/references/src/jstest-sample/OrderService.js +98 -98
- package/skills/jstest/references/src/jstest-sample/TokenGenerator.js +60 -60
- package/skills/jstest/references/src/jstest-sample/UserService.js +56 -56
- package/skills/jstest/references/src/jstest-sample/index.js +6 -6
- package/skills/jstest/references/suitability-check.md +232 -232
- package/skills/jstest/references/test-standards.md +288 -288
- package/skills/lint/SKILL.md +440 -440
- package/skills/lint/references/ai-fix.md +137 -137
- package/skills/lint/references/config-setup.md +102 -102
- package/skills/lint/references/config.md +65 -65
- package/skills/lint/references/detect-language.js +65 -65
- package/skills/lint/references/env-ensure.md +88 -88
- package/skills/lint/references/language-detect.md +75 -75
- package/skills/lint/references/languages/js.md +110 -110
- package/skills/lint/references/languages/py.md +89 -89
- package/skills/lint/references/rules-analyze.md +125 -125
- package/skills/lint/references/suitability-check.md +81 -81
- package/skills/lint/references/tool-fix.md +90 -90
- package/skills/new-skill/SKILL.md +227 -227
- package/skills/new-skill/references/template.md +53 -53
- package/skills/new-skill/references/workflow-patterns.md +104 -104
- package/skills/pytest/SKILL.md +555 -555
- package/skills/pytest/references/case-create.md +324 -324
- package/skills/pytest/references/case-fix.md +271 -271
- package/skills/pytest/references/config.md +145 -145
- package/skills/pytest/references/coverage-analyze.md +223 -223
- package/skills/pytest/references/env-ensure.md +195 -195
- package/skills/pytest/references/execute.md +152 -152
- package/skills/pytest/references/sample.md +159 -159
- package/skills/pytest/references/scoring-rules.md +57 -57
- package/skills/pytest/references/src/pytest-sample/Calculator.py +67 -67
- package/skills/pytest/references/src/pytest-sample/ConfigManager.py +68 -68
- package/skills/pytest/references/src/pytest-sample/FileProcessor.py +53 -53
- package/skills/pytest/references/src/pytest-sample/OrderService.py +82 -82
- package/skills/pytest/references/src/pytest-sample/TokenGenerator.py +50 -50
- package/skills/pytest/references/src/pytest-sample/UserService.py +45 -45
- package/skills/pytest/references/suitability-check.md +220 -220
- package/skills/pytest/references/test-standards.md +244 -244
- package/skills/query/SKILL.md +71 -71
- package/skills/read-docs/SKILL.md +134 -134
- package/skills/read-docs/references/opencode/agents/cases.md +206 -206
- package/skills/read-docs/references/opencode/agents/design-pattern.md +47 -47
- package/skills/read-docs/references/opencode/agents/detail.md +191 -191
- package/skills/read-docs/references/opencode/agents/examples.md +100 -100
- package/skills/read-docs/references/opencode/agents/index.md +309 -309
- package/skills/read-docs/references/opencode/agents/parallel-dispatch.md +149 -149
- package/skills/read-docs/references/opencode/agents/subagent-internals.md +217 -217
- package/skills/read-docs/references/opencode/agents/workflow.md +161 -161
- package/skills/read-docs/references/opencode/cli/commands/acp.md +31 -31
- package/skills/read-docs/references/opencode/cli/commands/agent.md +16 -16
- package/skills/read-docs/references/opencode/cli/commands/attach.md +20 -20
- package/skills/read-docs/references/opencode/cli/commands/mcp.md +37 -37
- package/skills/read-docs/references/opencode/cli/commands/others.md +48 -48
- package/skills/read-docs/references/opencode/cli/commands/plugin.md +12 -12
- package/skills/read-docs/references/opencode/cli/commands/provider.md +43 -43
- package/skills/read-docs/references/opencode/cli/commands/run.md +81 -81
- package/skills/read-docs/references/opencode/cli/commands/serve.md +84 -84
- package/skills/read-docs/references/opencode/cli/commands/session.md +37 -37
- package/skills/read-docs/references/opencode/cli/commands/web.md +14 -14
- package/skills/read-docs/references/opencode/cli/env.md +38 -38
- package/skills/read-docs/references/opencode/cli/index.md +18 -18
- package/skills/read-docs/references/opencode/cli/tui.md +35 -35
- package/skills/read-docs/references/opencode/commands/examples.md +42 -42
- package/skills/read-docs/references/opencode/commands/index.md +185 -185
- package/skills/read-docs/references/opencode/config/provider.md +151 -151
- package/skills/read-docs/references/opencode/formatter/index.md +70 -70
- package/skills/read-docs/references/opencode/guide/config.md +419 -419
- package/skills/read-docs/references/opencode/guide/formatters.md +70 -70
- package/skills/read-docs/references/opencode/guide/index.md +37 -37
- package/skills/read-docs/references/opencode/guide/providers.md +31 -31
- package/skills/read-docs/references/opencode/guide/rules.md +63 -63
- package/skills/read-docs/references/opencode/plugins/examples.md +75 -75
- package/skills/read-docs/references/opencode/plugins/index.md +188 -188
- package/skills/read-docs/references/opencode/reference/index.md +118 -118
- package/skills/read-docs/references/opencode/rule/index.md +77 -77
- package/skills/read-docs/references/opencode/skills/detail.md +113 -113
- package/skills/read-docs/references/opencode/skills/examples.md +141 -141
- package/skills/read-docs/references/opencode/skills/index.md +126 -126
- package/skills/read-docs/references/opencode/skills/workflow.md +146 -146
- package/skills/read-docs/references/opencode/tests/agent.md +9 -9
- package/skills/read-docs/references/opencode/tests/config.md +59 -59
- package/skills/read-docs/references/opencode/tests/file.md +11 -11
- package/skills/read-docs/references/opencode/tests/serve.md +17 -17
- package/skills/read-docs/references/opencode/tests/session.md +30 -30
- package/skills/read-docs/references/opencode/tests/web.md +16 -16
- package/skills/read-docs/references/opencode/tools/arguments.md +305 -305
- package/skills/read-docs/references/opencode/tools/context.md +17 -17
- package/skills/read-docs/references/opencode/tools/custom.md +110 -110
- package/skills/read-docs/references/opencode/tools/detail.md +104 -104
- package/skills/read-docs/references/opencode/tools/examples.md +71 -71
- package/skills/read-docs/references/opencode/tools/index.md +56 -56
- package/skills/read-docs/references/opencode/tools/lsp.md +25 -25
- package/skills/read-docs/references/opencode/tools/mcp.md +132 -132
- package/skills/read-docs/references/opencode/train/README.md +134 -134
- package/skills/read-docs/references/opencode/train/agent-basic.md +771 -771
- package/skills/read-docs/references/opencode/train/command-basic.md +667 -667
- package/skills/read-docs/references/opencode/train/config-basic.md +508 -508
- package/skills/read-docs/references/opencode/train/index.md +163 -163
- package/skills/read-docs/references/opencode/train/practice.md +872 -872
- package/skills/read-docs/references/opencode/train/skill-basic.md +607 -607
- package/skills/read-docs/references/opencode/tui/commands/config.md +31 -31
- package/skills/read-docs/references/opencode/tui/commands/editor.md +46 -46
- package/skills/read-docs/references/opencode/tui/commands/index.md +124 -124
- package/skills/read-docs/references/opencode/tui/commands/init.md +4 -4
- package/skills/read-docs/references/opencode/tui/index.md +26 -26
- package/skills/read-docs/references/superpowers/bootstrap.md +107 -107
- package/skills/read-docs/references/superpowers/comparison.md +77 -77
- package/skills/read-docs/references/superpowers/context.md +71 -71
- package/skills/read-docs/references/superpowers/index.md +58 -58
- package/skills/read-docs/references/superpowers/parallel.md +49 -49
- package/skills/read-docs/references/superpowers/sdd.md +183 -183
- package/skills/read-docs/references/superpowers/skills.md +68 -68
- package/skills/read-docs/references/superpowers/workflow.md +83 -83
- package/skills/revise/SKILL.md +121 -121
- package/skills/revise/references/article.md +36 -36
- package/skills/revise/references/article.schema.json5 +40 -40
- package/skills/revise/references/gallery.md +34 -34
- package/skills/revise/references/gallery.schema.json5 +40 -40
- package/skills/revise/references/question.md +32 -32
- package/skills/revise/references/question.schema.json5 +31 -31
- package/skills/revise/references/status.md +31 -31
- package/skills/revise/references/status.schema.json5 +27 -27
- package/skills/revise/references/validate-schema.js +39 -39
- package/src/config.js +29 -29
- package/src/config.json5 +19 -19
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
# JS/TS ESLint 规则清单
|
|
2
|
-
|
|
3
|
-
## 工具信息
|
|
4
|
-
|
|
5
|
-
| 项 | 值 |
|
|
6
|
-
|---|---|
|
|
7
|
-
| 工具 | ESLint |
|
|
8
|
-
| 安装 | `npm install -D eslint` |
|
|
9
|
-
| TS 扩展 | `npm install -D @typescript-eslint/parser @typescript-eslint/eslint-plugin` |
|
|
10
|
-
| 配置文件 | `eslint.config.js`(flat config,ESLint 9+) |
|
|
11
|
-
| 检查命令 | `npx eslint {target_dir} --format json` |
|
|
12
|
-
| 修复命令 | `npx eslint {target_dir} --fix` |
|
|
13
|
-
| 输出格式 | JSON 数组,每元素含 `filePath` + `messages[]` |
|
|
14
|
-
|
|
15
|
-
## ESLint JSON 输出解析
|
|
16
|
-
|
|
17
|
-
```json
|
|
18
|
-
[
|
|
19
|
-
{
|
|
20
|
-
"filePath": "/abs/path/to/file.js",
|
|
21
|
-
"messages": [
|
|
22
|
-
{
|
|
23
|
-
"ruleId": "no-unused-vars",
|
|
24
|
-
"severity": 2,
|
|
25
|
-
"message": "'x' is defined but never used",
|
|
26
|
-
"line": 10,
|
|
27
|
-
"column": 5,
|
|
28
|
-
"fix": { "range": [100, 110], "text": "" }
|
|
29
|
-
}
|
|
30
|
-
]
|
|
31
|
-
}
|
|
32
|
-
]
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
- `severity`: 1 = warning, 2 = error
|
|
36
|
-
- `fix` 存在 = 可自动修复(`fixable = true`)
|
|
37
|
-
|
|
38
|
-
## 规则清单
|
|
39
|
-
|
|
40
|
-
> 初始启用标记 ✓ 的规则在配置生成时写入 config 文件;✗ 的规则仅记录在清单中,后续可逐步放开。
|
|
41
|
-
|
|
42
|
-
### Possible Errors
|
|
43
|
-
|
|
44
|
-
| 规则 | 描述 | 默认级别 | 初始启用 | 可 fix |
|
|
45
|
-
|------|------|---------|---------|--------|
|
|
46
|
-
| no-unused-vars | 禁止未使用的变量 | error | ✓ | ✗ |
|
|
47
|
-
| no-undef | 禁止未定义的变量 | error | ✓ | ✗ |
|
|
48
|
-
| no-cond-assign | 禁止条件表达式中赋值 | error | ✗ | ✓ |
|
|
49
|
-
| no-debugger | 禁止 debugger 语句 | error | ✓ | ✗ |
|
|
50
|
-
| no-dupe-keys | 禁止对象字面量重复键 | error | ✗ | ✓ |
|
|
51
|
-
| no-dupe-args | 禁止函数参数重复 | error | ✗ | ✓ |
|
|
52
|
-
| no-empty | 禁止空语句块 | error | ✓ | ✓ |
|
|
53
|
-
| no-extra-semi | 禁止多余分号 | error | ✗ | ✓ |
|
|
54
|
-
| no-irregular-whitespace | 禁止不规则的空白字符 | error | ✗ | ✗ |
|
|
55
|
-
| no-unreachable | 禁止 return 后的不可达代码 | error | ✗ | ✓ |
|
|
56
|
-
|
|
57
|
-
### Best Practices
|
|
58
|
-
|
|
59
|
-
| 规则 | 描述 | 默认级别 | 初始启用 | 可 fix |
|
|
60
|
-
|------|------|---------|---------|--------|
|
|
61
|
-
| no-console | 禁止 console | warn | ✗ | ✓ |
|
|
62
|
-
| no-constant-condition | 禁止常量条件表达式 | error | ✗ | ✗ |
|
|
63
|
-
| no-dupe-else-if | 禁止重复的 else if | error | ✗ | ✓ |
|
|
64
|
-
| no-empty-pattern | 禁止空解构模式 | error | ✗ | ✓ |
|
|
65
|
-
| no-ex-assign | 禁止 catch 中重新赋值异常 | error | ✗ | ✓ |
|
|
66
|
-
| no-fallthrough | 禁止 switch 穿透 | error | ✗ | ✗ |
|
|
67
|
-
| no-redeclare | 禁止重复声明 | error | ✗ | ✓ |
|
|
68
|
-
| no-useless-return | 禁止无用的 return | error | ✗ | ✓ |
|
|
69
|
-
| eqeqeq | 要求严格相等 === | error | ✗ | ✓ |
|
|
70
|
-
| prefer-const | 优先使用 const | error | ✗ | ✓ |
|
|
71
|
-
|
|
72
|
-
### Stylistic Issues
|
|
73
|
-
|
|
74
|
-
| 规则 | 描述 | 默认级别 | 初始启用 | 可 fix |
|
|
75
|
-
|------|------|---------|---------|--------|
|
|
76
|
-
| semi | 分号一致性 | warn | ✗ | ✓ |
|
|
77
|
-
| quotes | 引号一致性 | warn | ✗ | ✓ |
|
|
78
|
-
| indent | 缩进一致性 | warn | ✗ | ✓ |
|
|
79
|
-
| no-trailing-spaces | 禁止行尾空格 | warn | ✗ | ✓ |
|
|
80
|
-
| eol-last | 文件末尾换行 | warn | ✗ | ✓ |
|
|
81
|
-
| no-multiple-empty-lines | 禁止多个空行 | warn | ✗ | ✓ |
|
|
82
|
-
|
|
83
|
-
### ES6+
|
|
84
|
-
|
|
85
|
-
| 规则 | 描述 | 默认级别 | 初始启用 | 可 fix |
|
|
86
|
-
|------|------|---------|---------|--------|
|
|
87
|
-
| no-const-assign | 禁止修改 const | error | ✗ | ✗ |
|
|
88
|
-
| no-dupe-class-members | 禁止重复类成员 | error | ✗ | ✓ |
|
|
89
|
-
| no-var | 禁止 var | error | ✗ | ✓ |
|
|
90
|
-
| prefer-arrow-callback | 优先箭头函数回调 | warn | ✗ | ✓ |
|
|
91
|
-
|
|
92
|
-
## 配置文件模板(eslint.config.js)
|
|
93
|
-
|
|
94
|
-
```javascript
|
|
95
|
-
import js from '@eslint/js';
|
|
96
|
-
|
|
97
|
-
export default [
|
|
98
|
-
js.configs.recommended,
|
|
99
|
-
{
|
|
100
|
-
rules: {
|
|
101
|
-
'no-unused-vars': 'error',
|
|
102
|
-
'no-undef': 'error',
|
|
103
|
-
'no-debugger': 'error',
|
|
104
|
-
'no-empty': 'error',
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
];
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
> 仅写入初始启用 ✓ 的规则。用户已有配置文件时只追加缺失规则,不覆盖。
|
|
1
|
+
# JS/TS ESLint 规则清单
|
|
2
|
+
|
|
3
|
+
## 工具信息
|
|
4
|
+
|
|
5
|
+
| 项 | 值 |
|
|
6
|
+
|---|---|
|
|
7
|
+
| 工具 | ESLint |
|
|
8
|
+
| 安装 | `npm install -D eslint` |
|
|
9
|
+
| TS 扩展 | `npm install -D @typescript-eslint/parser @typescript-eslint/eslint-plugin` |
|
|
10
|
+
| 配置文件 | `eslint.config.js`(flat config,ESLint 9+) |
|
|
11
|
+
| 检查命令 | `npx eslint {target_dir} --format json` |
|
|
12
|
+
| 修复命令 | `npx eslint {target_dir} --fix` |
|
|
13
|
+
| 输出格式 | JSON 数组,每元素含 `filePath` + `messages[]` |
|
|
14
|
+
|
|
15
|
+
## ESLint JSON 输出解析
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
[
|
|
19
|
+
{
|
|
20
|
+
"filePath": "/abs/path/to/file.js",
|
|
21
|
+
"messages": [
|
|
22
|
+
{
|
|
23
|
+
"ruleId": "no-unused-vars",
|
|
24
|
+
"severity": 2,
|
|
25
|
+
"message": "'x' is defined but never used",
|
|
26
|
+
"line": 10,
|
|
27
|
+
"column": 5,
|
|
28
|
+
"fix": { "range": [100, 110], "text": "" }
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
- `severity`: 1 = warning, 2 = error
|
|
36
|
+
- `fix` 存在 = 可自动修复(`fixable = true`)
|
|
37
|
+
|
|
38
|
+
## 规则清单
|
|
39
|
+
|
|
40
|
+
> 初始启用标记 ✓ 的规则在配置生成时写入 config 文件;✗ 的规则仅记录在清单中,后续可逐步放开。
|
|
41
|
+
|
|
42
|
+
### Possible Errors
|
|
43
|
+
|
|
44
|
+
| 规则 | 描述 | 默认级别 | 初始启用 | 可 fix |
|
|
45
|
+
|------|------|---------|---------|--------|
|
|
46
|
+
| no-unused-vars | 禁止未使用的变量 | error | ✓ | ✗ |
|
|
47
|
+
| no-undef | 禁止未定义的变量 | error | ✓ | ✗ |
|
|
48
|
+
| no-cond-assign | 禁止条件表达式中赋值 | error | ✗ | ✓ |
|
|
49
|
+
| no-debugger | 禁止 debugger 语句 | error | ✓ | ✗ |
|
|
50
|
+
| no-dupe-keys | 禁止对象字面量重复键 | error | ✗ | ✓ |
|
|
51
|
+
| no-dupe-args | 禁止函数参数重复 | error | ✗ | ✓ |
|
|
52
|
+
| no-empty | 禁止空语句块 | error | ✓ | ✓ |
|
|
53
|
+
| no-extra-semi | 禁止多余分号 | error | ✗ | ✓ |
|
|
54
|
+
| no-irregular-whitespace | 禁止不规则的空白字符 | error | ✗ | ✗ |
|
|
55
|
+
| no-unreachable | 禁止 return 后的不可达代码 | error | ✗ | ✓ |
|
|
56
|
+
|
|
57
|
+
### Best Practices
|
|
58
|
+
|
|
59
|
+
| 规则 | 描述 | 默认级别 | 初始启用 | 可 fix |
|
|
60
|
+
|------|------|---------|---------|--------|
|
|
61
|
+
| no-console | 禁止 console | warn | ✗ | ✓ |
|
|
62
|
+
| no-constant-condition | 禁止常量条件表达式 | error | ✗ | ✗ |
|
|
63
|
+
| no-dupe-else-if | 禁止重复的 else if | error | ✗ | ✓ |
|
|
64
|
+
| no-empty-pattern | 禁止空解构模式 | error | ✗ | ✓ |
|
|
65
|
+
| no-ex-assign | 禁止 catch 中重新赋值异常 | error | ✗ | ✓ |
|
|
66
|
+
| no-fallthrough | 禁止 switch 穿透 | error | ✗ | ✗ |
|
|
67
|
+
| no-redeclare | 禁止重复声明 | error | ✗ | ✓ |
|
|
68
|
+
| no-useless-return | 禁止无用的 return | error | ✗ | ✓ |
|
|
69
|
+
| eqeqeq | 要求严格相等 === | error | ✗ | ✓ |
|
|
70
|
+
| prefer-const | 优先使用 const | error | ✗ | ✓ |
|
|
71
|
+
|
|
72
|
+
### Stylistic Issues
|
|
73
|
+
|
|
74
|
+
| 规则 | 描述 | 默认级别 | 初始启用 | 可 fix |
|
|
75
|
+
|------|------|---------|---------|--------|
|
|
76
|
+
| semi | 分号一致性 | warn | ✗ | ✓ |
|
|
77
|
+
| quotes | 引号一致性 | warn | ✗ | ✓ |
|
|
78
|
+
| indent | 缩进一致性 | warn | ✗ | ✓ |
|
|
79
|
+
| no-trailing-spaces | 禁止行尾空格 | warn | ✗ | ✓ |
|
|
80
|
+
| eol-last | 文件末尾换行 | warn | ✗ | ✓ |
|
|
81
|
+
| no-multiple-empty-lines | 禁止多个空行 | warn | ✗ | ✓ |
|
|
82
|
+
|
|
83
|
+
### ES6+
|
|
84
|
+
|
|
85
|
+
| 规则 | 描述 | 默认级别 | 初始启用 | 可 fix |
|
|
86
|
+
|------|------|---------|---------|--------|
|
|
87
|
+
| no-const-assign | 禁止修改 const | error | ✗ | ✗ |
|
|
88
|
+
| no-dupe-class-members | 禁止重复类成员 | error | ✗ | ✓ |
|
|
89
|
+
| no-var | 禁止 var | error | ✗ | ✓ |
|
|
90
|
+
| prefer-arrow-callback | 优先箭头函数回调 | warn | ✗ | ✓ |
|
|
91
|
+
|
|
92
|
+
## 配置文件模板(eslint.config.js)
|
|
93
|
+
|
|
94
|
+
```javascript
|
|
95
|
+
import js from '@eslint/js';
|
|
96
|
+
|
|
97
|
+
export default [
|
|
98
|
+
js.configs.recommended,
|
|
99
|
+
{
|
|
100
|
+
rules: {
|
|
101
|
+
'no-unused-vars': 'error',
|
|
102
|
+
'no-undef': 'error',
|
|
103
|
+
'no-debugger': 'error',
|
|
104
|
+
'no-empty': 'error',
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
];
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
> 仅写入初始启用 ✓ 的规则。用户已有配置文件时只追加缺失规则,不覆盖。
|
|
@@ -1,89 +1,89 @@
|
|
|
1
|
-
# Python Ruff 规则清单
|
|
2
|
-
|
|
3
|
-
## 工具信息
|
|
4
|
-
|
|
5
|
-
| 项 | 值 |
|
|
6
|
-
|---|---|
|
|
7
|
-
| 工具 | Ruff |
|
|
8
|
-
| 安装 | `pip install ruff` 或 `uv add --dev ruff` |
|
|
9
|
-
| 配置文件 | `ruff.toml` |
|
|
10
|
-
| 检查命令 | `ruff check {target_dir} --output-format json` |
|
|
11
|
-
| 修复命令 | `ruff check {target_dir} --fix` |
|
|
12
|
-
| 输出格式 | JSON 数组,每元素含 code/message/filename/location |
|
|
13
|
-
|
|
14
|
-
## Ruff JSON 输出解析
|
|
15
|
-
|
|
16
|
-
```json
|
|
17
|
-
[
|
|
18
|
-
{
|
|
19
|
-
"code": "F401",
|
|
20
|
-
"message": "'os' imported but unused",
|
|
21
|
-
"filename": "/abs/path/to/file.py",
|
|
22
|
-
"location": [10, 1],
|
|
23
|
-
"end_location": [10, 10],
|
|
24
|
-
"fix": null
|
|
25
|
-
}
|
|
26
|
-
]
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
- `fix` 非 null = 可自动修复(`fixable = true`)
|
|
30
|
-
- severity 映射:F 前缀 = error,E 前缀 = error,W 前缀 = warning,UP 前缀 = warning
|
|
31
|
-
|
|
32
|
-
## 规则清单
|
|
33
|
-
|
|
34
|
-
> 初始启用标记 ✓ 的规则在配置生成时写入 config 文件;✗ 的规则仅记录在清单中,后续可逐步放开。
|
|
35
|
-
|
|
36
|
-
### Pyflakes (F)
|
|
37
|
-
|
|
38
|
-
| 规则 | 描述 | 默认级别 | 初始启用 | 可 fix |
|
|
39
|
-
|------|------|---------|---------|--------|
|
|
40
|
-
| F401 | 未使用的 import | error | ✓ | ✓ |
|
|
41
|
-
| F811 | 重定义未使用的名称 | error | ✓ | ✓ |
|
|
42
|
-
| F841 | 未使用的局部变量 | error | ✓ | ✓ |
|
|
43
|
-
| F501 | f-string 无占位符 | error | ✗ | ✓ |
|
|
44
|
-
| F541 | f-string 无占位符 | error | ✗ | ✓ |
|
|
45
|
-
| F601 | 字典字面量重复键 | error | ✗ | ✓ |
|
|
46
|
-
| F621 | 参数列表解包重复 | error | ✗ | ✗ |
|
|
47
|
-
| F622 | 星号后重复参数 | error | ✗ | ✗ |
|
|
48
|
-
| F633 | 非法 __future__ import | error | ✗ | ✗ |
|
|
49
|
-
| F701 | break 在循环外 | error | ✗ | ✗ |
|
|
50
|
-
| F821 | 未定义名称 | error | ✗ | ✗ |
|
|
51
|
-
| F822 | __all__ 中未定义名称 | error | ✗ | ✗ |
|
|
52
|
-
|
|
53
|
-
### Pycodestyle (E/W)
|
|
54
|
-
|
|
55
|
-
| 规则 | 描述 | 默认级别 | 初始启用 | 可 fix |
|
|
56
|
-
|------|------|---------|---------|--------|
|
|
57
|
-
| E711 | 比较使用 None 应为 is None | error | ✓ | ✓ |
|
|
58
|
-
| E712 | 比较使用 True/False 应为 is | error | ✗ | ✓ |
|
|
59
|
-
| E713 | not in 应替代 not ... in | error | ✗ | ✓ |
|
|
60
|
-
| E714 | is not 应替代 not ... is | error | ✗ | ✓ |
|
|
61
|
-
| E501 | 行过长(默认 88 字符) | warn | ✗ | ✗ |
|
|
62
|
-
| E302 | 预期 2 个空行 | warn | ✗ | ✓ |
|
|
63
|
-
| E303 | 函数间空行过多 | warn | ✗ | ✓ |
|
|
64
|
-
| E305 | 函数/类后 2 个空行 | warn | ✗ | ✓ |
|
|
65
|
-
| W291 | 行尾空格 | warn | ✗ | ✓ |
|
|
66
|
-
| W292 | 文件末尾无换行 | warn | ✗ | ✓ |
|
|
67
|
-
| W293 | 空行有空白字符 | warn | ✗ | ✓ |
|
|
68
|
-
|
|
69
|
-
### Pyupgrade (UP)
|
|
70
|
-
|
|
71
|
-
| 规则 | 描述 | 默认级别 | 初始启用 | 可 fix |
|
|
72
|
-
|------|------|---------|---------|--------|
|
|
73
|
-
| UP001 | 过时的 __future__ import | warn | ✗ | ✓ |
|
|
74
|
-
| UP010 | 过时的 __future__ union types | warn | ✗ | ✓ |
|
|
75
|
-
| UP011 | 不必要的 lru_cache 括号 | warn | ✗ | ✓ |
|
|
76
|
-
| UP015 | 不必要的 open 模式 | warn | ✗ | ✓ |
|
|
77
|
-
|
|
78
|
-
## 配置文件模板(ruff.toml)
|
|
79
|
-
|
|
80
|
-
```toml
|
|
81
|
-
[lint]
|
|
82
|
-
# 初始启用规则
|
|
83
|
-
select = ["F401", "F811", "F841", "E711"]
|
|
84
|
-
|
|
85
|
-
[lint.fix]
|
|
86
|
-
unsafe-fixes = false
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
> 仅写入初始启用 ✓ 的规则。用户已有配置文件时只追加缺失规则,不覆盖。
|
|
1
|
+
# Python Ruff 规则清单
|
|
2
|
+
|
|
3
|
+
## 工具信息
|
|
4
|
+
|
|
5
|
+
| 项 | 值 |
|
|
6
|
+
|---|---|
|
|
7
|
+
| 工具 | Ruff |
|
|
8
|
+
| 安装 | `pip install ruff` 或 `uv add --dev ruff` |
|
|
9
|
+
| 配置文件 | `ruff.toml` |
|
|
10
|
+
| 检查命令 | `ruff check {target_dir} --output-format json` |
|
|
11
|
+
| 修复命令 | `ruff check {target_dir} --fix` |
|
|
12
|
+
| 输出格式 | JSON 数组,每元素含 code/message/filename/location |
|
|
13
|
+
|
|
14
|
+
## Ruff JSON 输出解析
|
|
15
|
+
|
|
16
|
+
```json
|
|
17
|
+
[
|
|
18
|
+
{
|
|
19
|
+
"code": "F401",
|
|
20
|
+
"message": "'os' imported but unused",
|
|
21
|
+
"filename": "/abs/path/to/file.py",
|
|
22
|
+
"location": [10, 1],
|
|
23
|
+
"end_location": [10, 10],
|
|
24
|
+
"fix": null
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
- `fix` 非 null = 可自动修复(`fixable = true`)
|
|
30
|
+
- severity 映射:F 前缀 = error,E 前缀 = error,W 前缀 = warning,UP 前缀 = warning
|
|
31
|
+
|
|
32
|
+
## 规则清单
|
|
33
|
+
|
|
34
|
+
> 初始启用标记 ✓ 的规则在配置生成时写入 config 文件;✗ 的规则仅记录在清单中,后续可逐步放开。
|
|
35
|
+
|
|
36
|
+
### Pyflakes (F)
|
|
37
|
+
|
|
38
|
+
| 规则 | 描述 | 默认级别 | 初始启用 | 可 fix |
|
|
39
|
+
|------|------|---------|---------|--------|
|
|
40
|
+
| F401 | 未使用的 import | error | ✓ | ✓ |
|
|
41
|
+
| F811 | 重定义未使用的名称 | error | ✓ | ✓ |
|
|
42
|
+
| F841 | 未使用的局部变量 | error | ✓ | ✓ |
|
|
43
|
+
| F501 | f-string 无占位符 | error | ✗ | ✓ |
|
|
44
|
+
| F541 | f-string 无占位符 | error | ✗ | ✓ |
|
|
45
|
+
| F601 | 字典字面量重复键 | error | ✗ | ✓ |
|
|
46
|
+
| F621 | 参数列表解包重复 | error | ✗ | ✗ |
|
|
47
|
+
| F622 | 星号后重复参数 | error | ✗ | ✗ |
|
|
48
|
+
| F633 | 非法 __future__ import | error | ✗ | ✗ |
|
|
49
|
+
| F701 | break 在循环外 | error | ✗ | ✗ |
|
|
50
|
+
| F821 | 未定义名称 | error | ✗ | ✗ |
|
|
51
|
+
| F822 | __all__ 中未定义名称 | error | ✗ | ✗ |
|
|
52
|
+
|
|
53
|
+
### Pycodestyle (E/W)
|
|
54
|
+
|
|
55
|
+
| 规则 | 描述 | 默认级别 | 初始启用 | 可 fix |
|
|
56
|
+
|------|------|---------|---------|--------|
|
|
57
|
+
| E711 | 比较使用 None 应为 is None | error | ✓ | ✓ |
|
|
58
|
+
| E712 | 比较使用 True/False 应为 is | error | ✗ | ✓ |
|
|
59
|
+
| E713 | not in 应替代 not ... in | error | ✗ | ✓ |
|
|
60
|
+
| E714 | is not 应替代 not ... is | error | ✗ | ✓ |
|
|
61
|
+
| E501 | 行过长(默认 88 字符) | warn | ✗ | ✗ |
|
|
62
|
+
| E302 | 预期 2 个空行 | warn | ✗ | ✓ |
|
|
63
|
+
| E303 | 函数间空行过多 | warn | ✗ | ✓ |
|
|
64
|
+
| E305 | 函数/类后 2 个空行 | warn | ✗ | ✓ |
|
|
65
|
+
| W291 | 行尾空格 | warn | ✗ | ✓ |
|
|
66
|
+
| W292 | 文件末尾无换行 | warn | ✗ | ✓ |
|
|
67
|
+
| W293 | 空行有空白字符 | warn | ✗ | ✓ |
|
|
68
|
+
|
|
69
|
+
### Pyupgrade (UP)
|
|
70
|
+
|
|
71
|
+
| 规则 | 描述 | 默认级别 | 初始启用 | 可 fix |
|
|
72
|
+
|------|------|---------|---------|--------|
|
|
73
|
+
| UP001 | 过时的 __future__ import | warn | ✗ | ✓ |
|
|
74
|
+
| UP010 | 过时的 __future__ union types | warn | ✗ | ✓ |
|
|
75
|
+
| UP011 | 不必要的 lru_cache 括号 | warn | ✗ | ✓ |
|
|
76
|
+
| UP015 | 不必要的 open 模式 | warn | ✗ | ✓ |
|
|
77
|
+
|
|
78
|
+
## 配置文件模板(ruff.toml)
|
|
79
|
+
|
|
80
|
+
```toml
|
|
81
|
+
[lint]
|
|
82
|
+
# 初始启用规则
|
|
83
|
+
select = ["F401", "F811", "F841", "E711"]
|
|
84
|
+
|
|
85
|
+
[lint.fix]
|
|
86
|
+
unsafe-fixes = false
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
> 仅写入初始启用 ✓ 的规则。用户已有配置文件时只追加缺失规则,不覆盖。
|
|
@@ -1,126 +1,126 @@
|
|
|
1
|
-
> **原 skill**: `lint-rules-analyze`(已合并入 lint)
|
|
2
|
-
> **适用**: lint agent 的规则分析阶段,用于基线检查和轮尾独立验证。
|
|
3
|
-
> **不适用**: 修复违规(Step 7 / references/tool-fix.md、Step 8 / references/ai-fix.md)、非 lint 场景的代码分析。
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Lint 规则分析
|
|
8
|
-
|
|
9
|
-
## 工作流模式
|
|
10
|
-
|
|
11
|
-
顺序执行,4 个阶段。
|
|
12
|
-
|
|
13
|
-
## 输入
|
|
14
|
-
|
|
15
|
-
| 参数 | 必填 | 类型 | 说明 |
|
|
16
|
-
|------|------|------|------|
|
|
17
|
-
| target_dir | 是 | string | 检查目标目录路径 |
|
|
18
|
-
| root_dir | 是 | string | 工程根目录路径 |
|
|
19
|
-
| primary_language | 是 | string | 主语言(`jsts` 或 `python`) |
|
|
20
|
-
| config_file_path | 是 | string | lint 配置文件路径 |
|
|
21
|
-
|
|
22
|
-
## 输出
|
|
23
|
-
|
|
24
|
-
- `violation_count`:违规总数
|
|
25
|
-
- `violations`:违规列表,每条含 `{ file, line, column, rule, severity, message, fixable }`
|
|
26
|
-
- `score`:评分(100 或 0)
|
|
27
|
-
|
|
28
|
-
## 阶段一:执行 linter
|
|
29
|
-
|
|
30
|
-
按主语言执行 linter,输出 JSON 格式:
|
|
31
|
-
|
|
32
|
-
| 主语言 | 命令 |
|
|
33
|
-
|--------|------|
|
|
34
|
-
| jsts | `cd {root_dir} && npx eslint {target_dir} --format json` |
|
|
35
|
-
| python | `cd {root_dir} && ruff check {target_dir} --output-format json` |
|
|
36
|
-
|
|
37
|
-
## 阶段二:解析 JSON 输出
|
|
38
|
-
|
|
39
|
-
### ESLint JSON 解析
|
|
40
|
-
|
|
41
|
-
ESLint 输出 JSON 数组,每元素含 `filePath` 和 `messages[]`:
|
|
42
|
-
|
|
43
|
-
```
|
|
44
|
-
对每条 message 提取:
|
|
45
|
-
- file: filePath(转为相对 root_dir 的相对路径)
|
|
46
|
-
- line: message.line
|
|
47
|
-
- column: message.column
|
|
48
|
-
- rule: message.ruleId
|
|
49
|
-
- severity: message.severity === 2 ? 'error' : 'warning'
|
|
50
|
-
- message: message.message
|
|
51
|
-
- fixable: message.fix != null
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
### Ruff JSON 解析
|
|
55
|
-
|
|
56
|
-
Ruff 输出 JSON 数组,每元素含 `code`、`filename`、`location`:
|
|
57
|
-
|
|
58
|
-
```
|
|
59
|
-
对每条 violation 提取:
|
|
60
|
-
- file: filename(转为相对 root_dir 的相对路径)
|
|
61
|
-
- line: location[0]
|
|
62
|
-
- column: location[1]
|
|
63
|
-
- rule: code
|
|
64
|
-
- severity: code.startsWith('F') || code.startsWith('E') ? 'error' : 'warning'
|
|
65
|
-
- message: message
|
|
66
|
-
- fixable: fix != null
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
## 阶段三:评分计算
|
|
70
|
-
|
|
71
|
-
| 条件 | score |
|
|
72
|
-
|------|-------|
|
|
73
|
-
| violation_count = 0 | 100 |
|
|
74
|
-
| violation_count > 0 | 0 |
|
|
75
|
-
|
|
76
|
-
## 阶段四:输出报告
|
|
77
|
-
|
|
78
|
-
输出违规清单和评分。
|
|
79
|
-
|
|
80
|
-
```
|
|
81
|
-
## Lint 检查结果
|
|
82
|
-
|
|
83
|
-
- 违规总数: X
|
|
84
|
-
- 评分: 100|0
|
|
85
|
-
- error 数: X
|
|
86
|
-
- warning 数: X
|
|
87
|
-
- 可修复数: X
|
|
88
|
-
|
|
89
|
-
### 违规明细
|
|
90
|
-
| # | 文件 | 行号 | 规则 | 严重级别 | 描述 | 可修复 |
|
|
91
|
-
|---|------|------|------|---------|------|--------|
|
|
92
|
-
| 1 | src/foo.js | 10 | no-unused-vars | error | 'x' is defined but never used | ✗ |
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
## 决策
|
|
96
|
-
|
|
97
|
-
| 条件 | 动作 |
|
|
98
|
-
|------|------|
|
|
99
|
-
| violation_count = 0 | score=100,agent 判断达标 |
|
|
100
|
-
| violation_count > 0 | score=0,agent 判断需修复 |
|
|
101
|
-
|
|
102
|
-
## 失败处理
|
|
103
|
-
|
|
104
|
-
| 场景 | 处理方式 |
|
|
105
|
-
|------|---------|
|
|
106
|
-
| linter 未安装 | 报错"linter 不可用,请先运行环境检查" |
|
|
107
|
-
| linter exit code 1(有违规) | 正常行为,解析 JSON 输出违规清单 |
|
|
108
|
-
| linter exit code 2(配置错误) | 报错"linter 配置错误" |
|
|
109
|
-
| linter 执行超时 | 报错"检查超时" |
|
|
110
|
-
| JSON 解析失败 | 报错"linter 输出解析失败" |
|
|
111
|
-
| target_dir 不存在 | 报错"检查目录不存在" |
|
|
112
|
-
| 无违规(exit code 0) | 输出 violation_count=0, score=100 |
|
|
113
|
-
|
|
114
|
-
## 一定要做
|
|
115
|
-
|
|
116
|
-
1. 使用 JSON 格式输出,便于解析
|
|
117
|
-
2. 将文件路径转为相对 root_dir 的相对路径
|
|
118
|
-
3. 统一 violations 数据结构(file/line/column/rule/severity/message/fixable)
|
|
119
|
-
4. 二元制评分:0 违规=100,1+违规=0
|
|
120
|
-
|
|
121
|
-
## 一定不要做
|
|
122
|
-
|
|
123
|
-
1. 不要修复任何违规(只检查)
|
|
124
|
-
2. 不要修改源码文件
|
|
125
|
-
3. 不要省略 warning 级别的违规
|
|
1
|
+
> **原 skill**: `lint-rules-analyze`(已合并入 lint)
|
|
2
|
+
> **适用**: lint agent 的规则分析阶段,用于基线检查和轮尾独立验证。
|
|
3
|
+
> **不适用**: 修复违规(Step 7 / references/tool-fix.md、Step 8 / references/ai-fix.md)、非 lint 场景的代码分析。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Lint 规则分析
|
|
8
|
+
|
|
9
|
+
## 工作流模式
|
|
10
|
+
|
|
11
|
+
顺序执行,4 个阶段。
|
|
12
|
+
|
|
13
|
+
## 输入
|
|
14
|
+
|
|
15
|
+
| 参数 | 必填 | 类型 | 说明 |
|
|
16
|
+
|------|------|------|------|
|
|
17
|
+
| target_dir | 是 | string | 检查目标目录路径 |
|
|
18
|
+
| root_dir | 是 | string | 工程根目录路径 |
|
|
19
|
+
| primary_language | 是 | string | 主语言(`jsts` 或 `python`) |
|
|
20
|
+
| config_file_path | 是 | string | lint 配置文件路径 |
|
|
21
|
+
|
|
22
|
+
## 输出
|
|
23
|
+
|
|
24
|
+
- `violation_count`:违规总数
|
|
25
|
+
- `violations`:违规列表,每条含 `{ file, line, column, rule, severity, message, fixable }`
|
|
26
|
+
- `score`:评分(100 或 0)
|
|
27
|
+
|
|
28
|
+
## 阶段一:执行 linter
|
|
29
|
+
|
|
30
|
+
按主语言执行 linter,输出 JSON 格式:
|
|
31
|
+
|
|
32
|
+
| 主语言 | 命令 |
|
|
33
|
+
|--------|------|
|
|
34
|
+
| jsts | `cd {root_dir} && npx eslint {target_dir} --format json` |
|
|
35
|
+
| python | `cd {root_dir} && ruff check {target_dir} --output-format json` |
|
|
36
|
+
|
|
37
|
+
## 阶段二:解析 JSON 输出
|
|
38
|
+
|
|
39
|
+
### ESLint JSON 解析
|
|
40
|
+
|
|
41
|
+
ESLint 输出 JSON 数组,每元素含 `filePath` 和 `messages[]`:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
对每条 message 提取:
|
|
45
|
+
- file: filePath(转为相对 root_dir 的相对路径)
|
|
46
|
+
- line: message.line
|
|
47
|
+
- column: message.column
|
|
48
|
+
- rule: message.ruleId
|
|
49
|
+
- severity: message.severity === 2 ? 'error' : 'warning'
|
|
50
|
+
- message: message.message
|
|
51
|
+
- fixable: message.fix != null
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Ruff JSON 解析
|
|
55
|
+
|
|
56
|
+
Ruff 输出 JSON 数组,每元素含 `code`、`filename`、`location`:
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
对每条 violation 提取:
|
|
60
|
+
- file: filename(转为相对 root_dir 的相对路径)
|
|
61
|
+
- line: location[0]
|
|
62
|
+
- column: location[1]
|
|
63
|
+
- rule: code
|
|
64
|
+
- severity: code.startsWith('F') || code.startsWith('E') ? 'error' : 'warning'
|
|
65
|
+
- message: message
|
|
66
|
+
- fixable: fix != null
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## 阶段三:评分计算
|
|
70
|
+
|
|
71
|
+
| 条件 | score |
|
|
72
|
+
|------|-------|
|
|
73
|
+
| violation_count = 0 | 100 |
|
|
74
|
+
| violation_count > 0 | 0 |
|
|
75
|
+
|
|
76
|
+
## 阶段四:输出报告
|
|
77
|
+
|
|
78
|
+
输出违规清单和评分。
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
## Lint 检查结果
|
|
82
|
+
|
|
83
|
+
- 违规总数: X
|
|
84
|
+
- 评分: 100|0
|
|
85
|
+
- error 数: X
|
|
86
|
+
- warning 数: X
|
|
87
|
+
- 可修复数: X
|
|
88
|
+
|
|
89
|
+
### 违规明细
|
|
90
|
+
| # | 文件 | 行号 | 规则 | 严重级别 | 描述 | 可修复 |
|
|
91
|
+
|---|------|------|------|---------|------|--------|
|
|
92
|
+
| 1 | src/foo.js | 10 | no-unused-vars | error | 'x' is defined but never used | ✗ |
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## 决策
|
|
96
|
+
|
|
97
|
+
| 条件 | 动作 |
|
|
98
|
+
|------|------|
|
|
99
|
+
| violation_count = 0 | score=100,agent 判断达标 |
|
|
100
|
+
| violation_count > 0 | score=0,agent 判断需修复 |
|
|
101
|
+
|
|
102
|
+
## 失败处理
|
|
103
|
+
|
|
104
|
+
| 场景 | 处理方式 |
|
|
105
|
+
|------|---------|
|
|
106
|
+
| linter 未安装 | 报错"linter 不可用,请先运行环境检查" |
|
|
107
|
+
| linter exit code 1(有违规) | 正常行为,解析 JSON 输出违规清单 |
|
|
108
|
+
| linter exit code 2(配置错误) | 报错"linter 配置错误" |
|
|
109
|
+
| linter 执行超时 | 报错"检查超时" |
|
|
110
|
+
| JSON 解析失败 | 报错"linter 输出解析失败" |
|
|
111
|
+
| target_dir 不存在 | 报错"检查目录不存在" |
|
|
112
|
+
| 无违规(exit code 0) | 输出 violation_count=0, score=100 |
|
|
113
|
+
|
|
114
|
+
## 一定要做
|
|
115
|
+
|
|
116
|
+
1. 使用 JSON 格式输出,便于解析
|
|
117
|
+
2. 将文件路径转为相对 root_dir 的相对路径
|
|
118
|
+
3. 统一 violations 数据结构(file/line/column/rule/severity/message/fixable)
|
|
119
|
+
4. 二元制评分:0 违规=100,1+违规=0
|
|
120
|
+
|
|
121
|
+
## 一定不要做
|
|
122
|
+
|
|
123
|
+
1. 不要修复任何违规(只检查)
|
|
124
|
+
2. 不要修改源码文件
|
|
125
|
+
3. 不要省略 warning 级别的违规
|
|
126
126
|
4. 不要执行网络请求
|