npx skills add https://github.com/eyadsibai/ltk --skill 'Code Quality'全面的代码质量分析技能,涵盖风格、复杂度、死代码检测和类型检查。
检查是否符合特定语言的风格指南:
Python (PEP8/Black):
风格检查命令:
# Black 格式化检查
black --check --diff .
# Flake8 代码检查
flake8 --max-line-length=88 .
# isort 导入排序
isort --check-only --diff .
测量并报告代码复杂度:
圈复杂度:
认知复杂度:
函数长度:
嵌套深度:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
复杂度分析:
# 使用 radon 分析 Python
radon cc . -a -s # 圈复杂度
radon mi . # 可维护性指数
radon hal . # Halstead 指标
识别未使用的代码元素:
未使用的导入:
# Python - 使用 autoflake
autoflake --check --remove-all-unused-imports .
# 使用带有 F401 的 flake8
flake8 --select=F401 .
未使用的变量:
未使用的函数/类:
不可达代码:
验证类型注解:
缺失的类型提示:
# 使用 mypy
mypy --strict .
# 检查特定的严格级别
mypy --disallow-untyped-defs .
mypy --disallow-incomplete-defs .
类型错误:
类型覆盖率:
分析代码库时,报告:
| 指标 | 值 | 目标 | 状态 |
|---|---|---|---|
| 风格合规性 | X% | > 95% | 通过/失败 |
| 平均圈复杂度 | X | < 10 | 通过/失败 |
| 最大函数长度 | X 行 | < 50 | 通过/失败 |
| 死代码 | X 项 | 0 | 通过/失败 |
| 类型覆盖率 | X% | > 80% | 通过/失败 |
执行全面的质量检查:
用于快速评估变更:
推荐工具:
配置 (pyproject.toml):
[tool.black]
line-length = 88
target-version = ['py311']
[tool.isort]
profile = "black"
line_length = 88
[tool.mypy]
python_version = "3.11"
strict = true
推荐工具:
配置 (.eslintrc.json):
{
"extends": ["eslint:recommended"],
"rules": {
"complexity": ["warn", 10],
"max-depth": ["warn", 4],
"max-lines-per-function": ["warn", 50]
}
}
按严重程度组织呈现发现的问题:
错误(必须修复):
警告(应该修复):
信息(考虑):
与其他技能协调:
每周安装次数
–
代码仓库
GitHub 星标数
1
首次出现时间
–
安全审计
Comprehensive code quality analysis skill covering style, complexity, dead code detection, and type checking.
Check adherence to language-specific style guides:
Python (PEP8/Black):
Style check commands:
# Black formatting check
black --check --diff .
# Flake8 linting
flake8 --max-line-length=88 .
# isort import sorting
isort --check-only --diff .
Measure and report code complexity:
Cyclomatic Complexity:
Cognitive Complexity:
Function Length:
Nesting Depth:
Complexity analysis:
# Using radon for Python
radon cc . -a -s # Cyclomatic complexity
radon mi . # Maintainability index
radon hal . # Halstead metrics
Identify unused code elements:
Unused Imports:
# Python - using autoflake
autoflake --check --remove-all-unused-imports .
# Using flake8 with F401
flake8 --select=F401 .
Unused Variables:
Unused Functions/Classes:
Unreachable Code:
Validate type annotations:
Missing Type Hints:
# Using mypy
mypy --strict .
# Check specific strictness levels
mypy --disallow-untyped-defs .
mypy --disallow-incomplete-defs .
Type Errors:
Type Coverage:
When analyzing a codebase, report:
| Metric | Value | Target | Status |
|---|---|---|---|
| Style Compliance | X% | > 95% | Pass/Fail |
| Avg Cyclomatic Complexity | X | < 10 | Pass/Fail |
| Max Function Length | X lines | < 50 | Pass/Fail |
| Dead Code | X items | 0 | Pass/Fail |
| Type Coverage | X% | > 80% | Pass/Fail |
To perform comprehensive quality check:
For rapid assessment of changes:
Recommended tooling:
Configuration (pyproject.toml):
[tool.black]
line-length = 88
target-version = ['py311']
[tool.isort]
profile = "black"
line_length = 88
[tool.mypy]
python_version = "3.11"
strict = true
Recommended tooling:
Configuration (.eslintrc.json):
{
"extends": ["eslint:recommended"],
"rules": {
"complexity": ["warn", 10],
"max-depth": ["warn", 4],
"max-lines-per-function": ["warn", 50]
}
}
Present findings organized by severity:
Errors (must fix):
Warnings (should fix):
Info (consider):
Coordinate with other skills:
Weekly Installs
–
Repository
GitHub Stars
1
First Seen
–
Security Audits
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
147,400 周安装