Loading...
Loading...
Compare original and translation side by side
--fix--staged--lang python--no-patterns--fix--staged--lang python--no-patterns--fix--fix| Language | Marker Files | Tools |
|---|---|---|
| Python | pyproject.toml, requirements.txt | ruff, mypy, bandit |
| Go | go.mod | gofmt, golangci-lint, go vet |
| JavaScript | package.json | eslint, biome |
| TypeScript | tsconfig.json | tsc, eslint, biome |
| Rust | Cargo.toml | clippy, cargo fmt |
| Ruby | Gemfile | rubocop |
| Java | pom.xml, build.gradle | PMD |
| Shell | *.sh, *.bash | shellcheck |
| YAML | *.yml, *.yaml | yamllint |
| Markdown | *.md | markdownlint |
| 语言 | 标记文件 | 工具 |
|---|---|---|
| Python | pyproject.toml, requirements.txt | ruff, mypy, bandit |
| Go | go.mod | gofmt, golangci-lint, go vet |
| JavaScript | package.json | eslint, biome |
| TypeScript | tsconfig.json | tsc, eslint, biome |
| Rust | Cargo.toml | clippy, cargo fmt |
| Ruby | Gemfile | rubocop |
| Java | pom.xml, build.gradle | PMD |
| Shell | *.sh, *.bash | shellcheck |
| YAML | *.yml, *.yaml | yamllint |
| Markdown | *.md | markdownlint |
python3 ~/.claude/skills/universal-quality-gate/scripts/run_quality_gate.pyundefinedpython3 ~/.claude/skills/universal-quality-gate/scripts/run_quality_gate.pyundefinedundefinedundefined============================================================
Quality Gate: PASSED
============================================================
Languages: python, javascript
Files: 15
Tool Results:
[+] python/lint: passed
[+] python/format: passed
[-] python/typecheck: skipped (Optional tool not installed)
[+] javascript/lint: passed
[+] javascript/format: passed
Quality gate passed: 4/5 tools OK (1 skipped)============================================================
Quality Gate: FAILED
============================================================
Languages: python, go
Files: 8
Tool Results:
[X] python/lint: FAILED
hooks/example.py:42:1: F841 local variable 'x' is assigned but never used
hooks/example.py:56:1: F401 'os' imported but unused
[+] python/format: passed
[+] go/format: passed
[X] go/lint: FAILED
main.go:15:2: S1000: should use for range instead of for select
Pattern Matches:
[WARNING] hooks/example.py:78: Silent exception handler - add explanatory comment
Quality gate failed: 2 tool(s) reported issues, 1 error pattern(s)============================================================
Quality Gate: PASSED
============================================================
Languages: python, javascript
Files: 15
Tool Results:
[+] python/lint: passed
[+] python/format: passed
[-] python/typecheck: skipped (Optional tool not installed)
[+] javascript/lint: passed
[+] javascript/format: passed
Quality gate passed: 4/5 tools OK (1 skipped)============================================================
Quality Gate: FAILED
============================================================
Languages: python, go
Files: 8
Tool Results:
[X] python/lint: FAILED
hooks/example.py:42:1: F841 local variable 'x' is assigned but never used
hooks/example.py:56:1: F401 'os' imported but unused
[+] python/format: passed
[+] go/format: passed
[X] go/lint: FAILED
main.go:15:2: S1000: should use for range instead of for select
Pattern Matches:
[WARNING] hooks/example.py:78: Silent exception handler - add explanatory comment
Quality gate failed: 2 tool(s) reported issues, 1 error pattern(s)--fixundefined--fixundefinedundefinedundefinedgit diffgit diff--staged--fix// hooks/lib/language_registry.json
{
"new_language": {
"extensions": [".ext"],
"markers": ["config.file"],
"tools": {
"lint": {
"cmd": "linter {files}",
"fix_cmd": "linter --fix {files}",
"description": "Language linter",
"required": true
}
}
}
}git add// hooks/lib/language_registry.json
{
"new_language": {
"extensions": [".ext"],
"markers": ["config.file"],
"tools": {
"lint": {
"cmd": "linter {files}",
"fix_cmd": "linter --fix {files}",
"description": "Language linter",
"required": true
}
}
}
}pip install ruffgo install golangci-lintgit add--staged--langpip install ruffgo install golangci-lint--staged--lang--fix--staged--lang--fix--fixgit diff--fix--staged--lang--fixgit diff--fixhooks/lib/
quality_gate.py # 共享核心库
language_registry.json # 语言配置文件
skills/universal-quality-gate/
SKILL.md # 本文件
scripts/
run_quality_gate.py # Skill入口(轻量封装)hooks/lib/hooks/lib/
quality_gate.py # Shared core library
language_registry.json # Language configurations
skills/universal-quality-gate/
SKILL.md # This file
scripts/
run_quality_gate.py # Skill entry point (thin wrapper)hooks/lib/| 合理化借口 | 错误原因 | 必需操作 |
|---|---|---|
| “所有工具都通过了,代码可以提交了” | Linter只能捕获风格问题,无法发现逻辑问题 | 同时运行测试并审查代码 |
| “工具被跳过了,应该没问题” | 跳过工具意味着对应类别未被检查 | 安装工具或明确接受该风险 |
| “只是格式问题,不是真正的bug” | 不一致的格式会导致合并冲突 | 提交前修复格式问题 |
| “要检查的文件太多了,跳过吧” | 部分检查会带来虚假的安全感 | 使用--staged进行聚焦检查 |
| Rationalization | Why It's Wrong | Required Action |
|---|---|---|
| "All tools passed, code is ready" | Linters catch style, not logic | Run tests and review code too |
| "Tool was skipped, probably fine" | Skipped tool = unchecked category | Install tool or accept the gap explicitly |
| "Just formatting issues, not real problems" | Inconsistent formatting causes merge conflicts | Fix formatting before commit |
| "Too many files to check, skip it" | Partial checks give false confidence | Use --staged for focused checking |