← Back to Pull requests

Lint __init__ and underscore-prefixed files with ruff #9273

Open
unknown opened this pull request with 378 lines diff across 4 files
View on GitHub
unknown unknown commented on Nov 27, 2026 17:51 UTC
Author

Description

TL;DR: extend-exclude = ["_"] in pyproject.toml matches file basenames, so ruff and the pre-commit ruff/ruff-format hooks have been silently skipping every __init__.py (552), __init__.pyi (241) and _private.py module. This PR narrows the exclude and fixes the 30 lint errors and 17 format diffs that the change exposes.

  • Config: replaced "_" with the directories it was meant to cover. _isaac_sim was already listed; I added _build and _repo, which match .gitignore and the [tool.pyright] excludes. This also brings source/_isaaclab_testing, docs/_extensions and .github/actions/_lib under lint. All three were added after the pattern in #4329.

  • Stub safety: __init__.pyi stubs are export lists that lazy_export() parses at runtime (isaaclab/utils/module.py::_parse_stub). Later relative wildcards override earlier names, and fallback packages are searched in order. So the stubs get F401, F403, F811 and I001 per-file ignores. Without them, the ruff --fix hook would rewrite 77 stub lines on the next commit (8 F401, 3 F811, 66 I001).

  • Fixes: 11 I001, 10 E501, 7 F403, 1 C901 and 1 SIM105 in the newly covered files, plus ruff format on the 17 files it flags. The CI pre-commit job runs --all-files, so these would otherwise fail it. No behaviour changes.
  • Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Checklist

  • I have read and understood the contribution guidelines

  • I have run the pre-commit checks with uv run isaaclab --format

  • I have made corresponding changes to the documentation

  • My changes generate no new warnings

  • I have validated the changed behavior with focused coverage and applied the test-audit criteria to any test changes

  • I have added a changelog fragment under source/<pkg>/changelog.d/ for every touched package (do not edit CHANGELOG.rst or bump package versions — CI handles that)

  • I have added my name to the CONTRIBUTORS.md or my name already exists there
  • <details>
    <summary>How it was verified (optional)</summary>

  • pre-commit run --all-files passes with the repo's hooks (ruff 0.14.10, ruff-format, license, codespell, changelog check), and the ruff --fix hook leaves the tree unchanged, so no stub is rewritten.

  • For the Python files (.py/.pyi), the AST of every changed file matches main apart from import order, contextlib.suppress, and one rewrapped docstring line in a stub. Wrapped strings concatenate to the same values. Non-Python files were not AST-compared.

  • No GPU or Isaac Sim tests were run; the changes are lint and format only.

  • Each touched package gets a ruff-init-coverage.skip changelog fragment, since nothing user-facing changed.
  • </details>

    🤖 Generated with Claude Code

    Diff: 378 lines (+283 / -95) across 4 files Reviewer: maxwbuckley Review duration: 5009m
    All Vouch review confidence checks passed
    Residual risk 0.23 = Change Risk (0.43) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 378 lines diff across 4 files
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    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.355
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #9273"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% 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: 42.9% (MEDIUM) · Higher = larger blast radius
    42.9%
    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: 46.7% · Lower = rushed or shallow review
    46.7%
    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: 22.9% · Safe to merge
    22.9%