python-code-quality-scan
Run analyzer MCP tools (Ruff + optional dead-code scan) as a quality gate before QA/UAT/release.
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
Skill Instructions
Purpose
Provide a consistent, repeatable code quality gate for Python changes.
This skill is intended to be invoked by agents with analyzer/* tooling enabled.
Inputs (Optional)
-
TARGETS(string): paths to scan (default:src tests run.py run_tests.py) -
MODE(string):check(default) orfix(formats/fixes where safe) -
FAIL_ON_FINDINGS(string):true(default) orfalse
Procedure
0) Scope selection (recommended)
Prefer scanning only Python files that changed (fast, relevant). If that’s not feasible, scan the default TARGETS set.
1) Ruff lint (required)
For each target Python file:
- Read the file contents.
- Run
analyzer/*Ruff lint on that code.
Acceptance target: no Ruff errors. If FAIL_ON_FINDINGS=true, treat warnings as failures too.
2) Ruff format (optional)
If MODE=fix:
- Run Ruff format via
analyzer/*on the same file contents. - Apply formatting updates to the file.
- Re-run Ruff lint to confirm it’s clean.
3) Dead-code scan (optional)
If available and appropriate:
- Run a dead-code scan (e.g., Vulture) on the same target code.
- Treat high-confidence findings as failures when
FAIL_ON_FINDINGS=true.
Notes:
- Keep scope reasonable (changed files first) to avoid huge scans.
- If findings are intentionally accepted, document the rationale and any follow-up.
Output
Record:
- Which tools were run (ruff lint/format, dead-code scan)
- Targets scanned
- Pass/fail summary
- Any action taken (formatting, removal of unused imports, etc.)
Acceptance Criteria
- Ruff reports clean results for the chosen targets
- If dead-code scan is run: no high-confidence dead-code findings (or documented exceptions)
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-01-20
- 索引更新时间
- 2026-01-26
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!