用途:在编辑代码后对改动文件执行针对性的 lint、格式化与质量检查,避免全仓库扫描。
主要能力:通过 hatch run lint:<脚本> 调用多类检查。fmt 用 Ruff 格式化并自动修复风格问题;style 只校验不修复,覆盖 Ruff、Cython、C、CMake 格式;format_check 校验 Python 格式;typing 用 mypy 做类型检查;security 用 Bandit 做安全审计;spelling 检查文档、注释与 docstring 拼写;riot 校验 riotfile;suitespec-check 校验测试套件规格;error-log-check 校验错误日志约定;sg 与 sg-test 做 ast-grep 静态分析与规则测试;cformat_check、cmakeformat_check 校验 C 与 CMake 格式。
使用方式:命令形如 hatch run lint:fmt -- path/to/file.py、hatch run lint:typing -- path/to/file.py、hatch run lint:security -- -r ddtrace/contrib/、hatch run lint:spelling -- docs/ releasenotes/;提交前可运行 hatch run lint:checks 执行综合检查。参数通过 -- 传入。
适用场景:编辑后格式化、添加类型注解后类型检查、提交前综合验证、处理敏感代码前安全审查、文档与 docstring 拼写检查、修改测试基础设施后校验。
限制:资料未提供该技能的安装方式、收费、平台支持与效果数据;命令依赖项目根目录与 hatch 环境,具体配置以 hatch.toml、riotfile.py 为准。