← Back to Pull requests

feat(builtins): add odoo_lint for Odoo modules #1671

Closed
unknown closed this pull request without merging on Oct 08, 2026 20:58 UTC
View on GitHub
unknown unknown commented on Oct 08, 2026 11:58 UTC
Author

Adds an odoo_lint builtin for odoo-lint (odl), a linter for Odoo modules written in Rust. It covers pylint-odoo's checks and OCA's translation (.po/.pot) checks, keeping their codes and messages, and runs as a single fast binary. Odoo projects can now lint and auto-fix their addons from hk:

amends "package://github.com/jdx/hk/releases/download/vX.Y.Z/hk@X.Y.Z#/Config.pkl"
import "package://github.com/jdx/hk/releases/download/vX.Y.Z/hk@X.Y.Z#/Builtins.pkl"

hooks {
  ["pre-commit"] {
    fix = true
    steps { ["odoo_lint"] = Builtins.odoo_lint }
  }
}

  • Files: */.py, */.po and */.pot. Projects are detected by a __manifest__.py anywhere in the tree.

  • check: odl check {{files}}.

  • fix: odl check --fix {{files}} applies the safe fixes and exits non-zero while findings remain.

  • check_diff: odl check --diff prints a unified diff of the fixes. Like ruff, it only covers fixable findings and exits 0 when there is nothing to fix, so the step chains a plain odl check and sets check_after_diff. Findings that can't be fixed then still fail.

  • Configuration: odl reads the project's [tool.odoo-lint] in pyproject.toml, or odoo-lint.toml.
  • Tests cover a clean and a failing check, fix, and diff. For the partial fixer they also cover diff and fix on a manifest with one fixable and one non-fixable finding. The tool stub installs odoo-linter from PyPI.

    Validation: hk test --step odoo_lint passes all 7 tests locally, with hk built from this branch (Builtins.pkl generated with pkl 0.32.1) and odoo-linter 0.1.0a3, the version the tool stub pins.

    AI-assisted — Tool: Claude Code; model: anthropic/claude-opus-5-5; version: 2.1.294.

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    Summary by CodeRabbit

    Tests
    Added coverage for detecting Odoo modules with manifests at the project root or nested directories, while confirming that setup.py alone does not trigger detection.
    * Added a test stub for the odoo-linter tool, version 0.1.0a3.

    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 273 lines (+204 / -69) across 3 files Reviewer: bosd Review duration: 539m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 273 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.336
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #1671"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 39.5% (MEDIUM) · Higher = larger blast radius
    39.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 15.6% · Safe to merge
    15.6%
    Repository