odoo-lint

io.github.bosdv0.1.0-alpha.5更新于 Oct 8, 2026

Lint and fix Odoo addons: pylint-odoo and OCA checks, translation files and upgrades.

已验证STDIO仅桌面Developer ToolsAI & ML

概览

AI 生成的概览

通过本地 MCP 服务器,让助手检查并自动修复 Odoo 插件的代码、清单、XML 数据文件和翻译文件。

功能
把 odl 检查器提供给 AI 编码代理,用于检查 Odoo 模块的 Python、清单、XML 和 .po 翻译问题,规则移植自 pylint-odoo 与 OCA 检查,代码、名称和消息保持一致。它可以列出并解释规则、应用安全或不安全的自动修复、以 diff 预览修复结果,并报告旧版 Odoo 遗留的升级问题。输出可生成 GitHub 注解、GitLab Code Quality、SARIF 和 JSON 等 CI 格式。
适用场景
适合助手在编辑或审查 Odoo 插件时同步发现 lint、升级和翻译问题,也适合希望在不运行 pylint 的情况下获得与 OCA pre-commit 钩子相同检查的场景。它面向 Odoo 模块开发,而非通用 Python 项目。
运行要求
作为本地 stdio 进程运行,通过 uvx 从 PyPI 包 odoo-linter 启动(也可用 pip、pipx 或 cargo 安装)。仅支持桌面端;未声明认证、环境变量或请求头。规则和公司特定的作者设置配置在项目的 pyproject.toml 中。
安装前请注意
修复命令会修改插件目录中的文件,包括不安全的修复,因此应用前应查看 diff,并把工作内容纳入版本控制。未声明任何凭据或网络访问。

安装

在 SourceWeft 中

  1. 打开 控制台中的 odoo-lint,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

[odoo-lint logo]

odoo-lint

[PyPI] [crates.io] [Tests] [OCA parity] [Documentation] [License: MIT]

Blazing fast Rust-native linter for Odoo modules. The command is called odl.

It checks Python files, manifests, XML data files and translation (.po) files, with the checks of OCA's pylint-odoo, oca-checks-odoo-module and oca-checks-po: same names, same messages, same results on their own test suites.

[Bar chart: linting OCA/sale-workflow takes 0.10s with odoo-lint and 25.8s with pylint-odoo]

Linting all of OCA/sale-workflow 18.0, as OCA's pre-commit hook runs pylint-odoo. See benchmarks.

  • ⚡ 250x faster than pylint with pylint-odoo, and still 30x faster on a single core
  • ⚖️ Drop-in for pylint-odoo and OCA's pre-commit checks: same codes, names and messages, 95/95 checks matching on their own test suites (Python, manifests, XML, .po), and # pylint: disable= comments keep working
  • 🔧 Automatic fixes, safe and unsafe as in Ruff, for Python, manifests, XML and .po files (odl check --fix, --diff to preview)
  • ⬆️ Upgrade checks: leftovers of older Odoo versions, such as Bootstrap 4 classes that do nothing since Odoo 15.0, with fixes
  • 🌍 Translation checks that predict Odoo's loader: why Odoo logs "malformed po file", and why a translation does not show up
  • 📦 Installable with pip, uv or pipx: one binary in prebuilt wheels for Linux, macOS and Windows, without Python dependencies
  • 🛠️ Configured in pyproject.toml, including company-specific author rules
  • 📋 Output for CI: GitHub annotations, GitLab Code Quality, SARIF and JSON
  • 🤖 For AI coding agents: an MCP server, and plugins for Claude Code, DeepSeek Harness and OpenCode that lint every file the agent edits
  • 🪝 Git hooks: pre-commit and hk

Installation

bash
uv tool install odoo-linter   # or: pipx install odoo-lintercargo install odoo-lint       # from crates.io

The PyPI package is called odoo-linter, because odoo-lint is too similar to an existing PyPI project. On crates.io it is odoo-lint.

Quick start

bash
odl check path/to/addons   # lint a directoryodl rule                   # list all rulesodl rule C8101             # explain a ruleodl check --fix            # apply the safe fixes (--diff to preview)

Rules ported from pylint-odoo keep its codes, names and messages, and # pylint: disable= comments keep working. Company-specific rules are configured in your pyproject.toml:

toml
[tool.odoo-lint]target-version = "17.0"
[tool.odoo-lint.rules.manifest-required-author.mapping]"acme_*" = "Acme Corp"

For AI coding agents there is an MCP server (odl mcp) and a post-edit hook, packaged as plugins for Claude Code (/plugin marketplace add bosd/odoo-lint), DeepSeek Harness and OpenCode.

See the documentation for all commands, configuration options and rules.

Development

bash
uv sync --all-groups   # builds odl into .venv via maturinuv run nox             # pre-commit, fmt, clippy, cargo tests, CLI tests, docs

See the development guide.

License

MIT

来源:README.md,提交 8469e21

工具

0
工具元数据尚未被收录。

版本历史

1
  1. v0.1.0-alpha.5最新Oct 8, 2026