name: code-quality-guardian description: 代码质量检测器 - 检测代码异味、复杂度、安全漏洞、风格规范等 | Code Quality Guardian - Detect code smells, complexity, security vulnerabilities and style issues homepage: https://github.com/kaiyuelv/code-quality-guardian category: devops tags: - code-quality - linting - security - python - javascript - static-analysis - ci-cd version: 1.0.0
| Field | Value |
|---|---|
| Name | code-quality-guardian |
| Display Name | 代码质量守护者 |
| Version | 1.0.0 |
| Category | Development Tools |
| Author | ClawHub |
| License | MIT |
A comprehensive code quality analysis tool supporting Python, JavaScript, and Go. It automatically detects code smells, complexity issues, security vulnerabilities, and style violations.
一款全面的代码质量分析工具,支持 Python、JavaScript 和 Go。自动检测代码异味、复杂度问题、安全漏洞和风格违规。
| Language | Tools Used | File Extensions |
|---|---|---|
| Python | flake8, pylint, bandit, radon, mypy | .py |
| JavaScript/TypeScript | eslint, jshint | .js, .jsx, .ts, .tsx |
| Go | go vet, golint, staticcheck | .go |
# Analyze a Python project code-quality-guardian analyze --path ./my-project --language python # Analyze with specific tools only code-quality-guardian analyze --path ./src --tools flake8,bandit # Generate HTML report code-quality-guardian analyze --path . --format html --output report.html # Check specific complexity threshold code-quality-guardian analyze --path . --max-complexity 107w4.net提供免费和付费技能下载。
from code_quality_guardian import QualityAnalyzer
# Initialize analyzer
analyzer = QualityAnalyzer(
language='python',
tools=['flake8', 'pylint', 'bandit'],
config_path='.quality.yml'
)
# Run analysis
results = analyzer.analyze('./src')
# Generate report
report = results.to_json()
print(f"Issues found: {results.total_issues}")
print(f"Complexity score: {results.complexity_score}")
language: python
tools:
- flake8
- pylint
- bandit
- radon
thresholds:
max_complexity: 10
max_line_length: 100
min_score: 8.0
ignore:
- "*/tests/*"
- "*/migrations/*"
- "*/venv/*"
flake8:
max_line_length: 100
ignore: [E501, W503]
pylint:
disable: [C0103, R0903]
bandit:
severity: MEDIUM
confidence: MEDIUM
# Install from ClawHub
clawhub install code-quality-guardian
# Or install dependencies manually
pip install -r requirements.txt
═══════════════════════════════════════════
Code Quality Guardian v1.0.0
═══════════════════════════════════════════
📁 Project: my-project
🔤 Language: python
📊 Files analyzed: 42
┌─────────────────────────────────────────┐
│ Issues Summary │
├─────────────────────────────────────────┤
│ 🔴 Critical 0 │
│ 🟠 High 2 │
│ 🟡 Medium 8 │
│ 🔵 Low 15 │
│ 💡 Info 23 │
├─────────────────────────────────────────┤
│ Total: 48 │
└─────────────────────────────────────────┘
Complexity: 7.2/10 (Good)
Maintainability: A
Security Score: 95%
{
"summary": {
"files_analyzed": 42,
"total_issues": 48,
"critical": 0,
"high": 2,
"medium": 8,
"low": 15,
"info": 23
},
"metrics": {
"complexity": 7.2,
"maintainability": "A",
"security_score": 95
},
"issues": [...]
}
| Code | Meaning |
|---|---|
| 0 | No issues found |
| 1 | Issues found but within thresholds |
| 2 | Threshold exceeded |
| 3 | Configuration error |
| 4 | Tool execution error |
- name: Code Quality Check
uses: clawhub/code-quality-guardian@v1
with:
language: python
path: ./src
fail-on: high
repos:
- repo: https://github.com/clawhub/code-quality-guardian
rev: v1.0.0
hooks:
- id: quality-guardian
args: ['--language', 'python']
MIT License - see LICENSE file for details.
Contributions are welcome! Please read CONTRIBUTING.md for guidelines.
这是一款专业的代码质量检测工具,检测范围广,支持多种编程语言,能自动发现代码风格、复杂度、安全漏洞等问题。报告清晰直观,带颜色标识和质量分数,还支持生成 HTML 报告方便查看。主要不足是文档部分内容不完整,且部分配置选项对新手不够友好,需要一定的学习成本才能用好。总体质量良好,适合有代码质量要求的项目使用。