SuperAPI AI 工具集

ort-lint

编程与开发

查看项目

更新于 10-16 00:31

技能介绍

用途:对 ONNX Runtime 仓库中的 C++ 与 Python 文件做代码风格 lint 与格式化。

主要能力:基于 lintrunner 统一调用 C++ 的 clang-format 和 Python 的 ruff。

常用命令(需保持原样): 安装与初始化:pip install -r requirements-lintrunner.txt,然后 lintrunner init。 自动修复变更文件:lintrunner -a 自动修复全部文件:lintrunner -a --all-files 自动修复指定文件:lintrunner -a path/to/file.py path/to/other_file.cc 仅格式化 Python:lintrunner f --all-files 仅检查不修复(dry run):lintrunner

风格规则:C++ 采用修改版 Google C++ 风格(详见仓库文档),最大行宽 120 字符,尽量控制在 80,配置在 .clang-format 与 .clang-tidy;Python 采用 Google Python 风格(PEP 8 扩展),最大行宽 120,配置在 pyproject.toml。

使用提示:安装依赖前先激活 Python 虚拟环境;若尚未配置 lintrunner,需先完成安装与初始化;除非用户要求全量扫描,优先用 lintrunner -a 处理变更文件。

限制:资料未说明支持的其他语言、平台范围、运行开销或与 CI 集成的细节,暂未提供。