Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[None][cleanup] Add supplemental ruff lint for legacy files via ruff-legacy hook#11469

Merged
venkywonka merged 1 commit intoNVIDIA:mainNVIDIA/TensorRT-LLM:mainfrom
venkywonka:venky/stricter-lintervenkywonka/TensorRT-LLM:venky/stricter-linterCopy head branch name to clipboard
Apr 4, 2026
Merged

[None][cleanup] Add supplemental ruff lint for legacy files via ruff-legacy hook#11469
venkywonka merged 1 commit intoNVIDIA:mainNVIDIA/TensorRT-LLM:mainfrom
venkywonka:venky/stricter-lintervenkywonka/TensorRT-LLM:venky/stricter-linterCopy head branch name to clipboard

Conversation

@venkywonka
Copy link
Copy Markdown
Collaborator

@venkywonka venkywonka commented Feb 12, 2026

Summary

  • Add ruff-legacy pre-commit hook that applies supplemental lint rules to ~1,350 legacy Python files (Group B) — rules that yapf, isort, and autoflake don't cover
  • Unify the two divergent file lists (.pre-commit-config.yaml and pyproject.toml) into a single source of truth: legacy-files.txt
  • Add a generator script (scripts/generate_legacy_lint_config.py) that renders all derived configs from legacy-files.txt via Jinja2 templates
  • Baseline-gated enforcement: the hook runs everywhere (local + CI), comparing violations against a snapshot (ruff-legacy-baseline.json). New violations block; pre-existing ones are tolerated.
  • Bulk-fix 3,816 auto-fixable violations and establish the baseline snapshot for remaining known violations
  • Fix one pre-existing I001 violation exposed by scoping the ruff exclude (see below)

Reviewer Guide

This PR is large (~7,900 lines) but most of it is auto-generated or mechanical. Here's how to navigate it efficiently:

Where to start (human-written logic — ~750 lines)

Review these first. This is where all the design decisions live:

File Lines What to look for
scripts/ruff_legacy_lint_baseline.py ~390 Core logic. The baseline-gated pre-commit wrapper. Focus on precommit_mode() (regression detection, improvement hints) and update_baseline_mode().
scripts/generate_legacy_lint_config.py ~280 Config generator. Reads legacy-files.txt, renders templates, has --check and --prune modes.
CODING_GUIDELINES.md (lines 527-640) ~110 Developer-facing docs for the two-tier lint system.
scripts/templates/ruff-legacy.toml.j2 ~85 Rule selection — which ruff rules are enabled for legacy files and why each is suppressed/enabled.

Skim or spot-check (~200 lines)

File Why
.pre-commit-config.yaml (bottom ~30 lines, after END AUTO-GENERATED marker) New hook definitions (ruff-legacy, verify-legacy-config). The ~1,500-line diff above the marker is auto-generated file lists — skip it.
pyproject.toml Only the managed block markers matter. The file list inside is auto-generated.
CONTRIBUTING.md 2 lines added.
scripts/templates/precommit-legacy-files.j2 22-line Jinja2 template.
scripts/templates/pyproject-format-exclude.j2 10-line Jinja2 template.

Skip entirely (auto-generated or mechanical — ~6,800 lines)

File(s) Lines Why safe to skip
ruff-legacy-baseline.json 2,593 Auto-generated by --update-baseline. JSON blob of per-file violation counts.
ruff-legacy.toml 1,431 Auto-generated from template + legacy-files.txt. Just the rendered config.
legacy-files.txt 1,350 One filepath per line — the source-of-truth list. Mechanical.
.pre-commit-config.yaml (lines 1-2716) ~1,500 Auto-generated file-list anchors (common_files, legacy_files).
pyproject.toml (managed block) ~170 Auto-generated exclude list.
~17 Python files with 1-6 line diffs ~60 total Trivial auto-fixes by ruff --fix: removed unused imports (F401), removed unused variables (F841), fixed comparisons (E711/E712), replaced lL (E741), fixed escape sequences (W605). Every change is a single-line mechanical fix.

One file that looks weird but is expected

tensorrt_llm/_torch/modules/fused_moe/fused_moe_cutlass.py — the ruff auto-fix removed a duplicate import (UnquantizedFusedMoEMethod, rule F811), which changed line lengths in the import block, triggering yapf to reformat it. The diff looks like a formatting change but it's rooted in a real lint fix.

Problem

The codebase has two groups of Python files with different formatting toolchains:

Group Count Formatting Ruff lint coverage
A (modern) ~550 files ruff format (100-char) Full ruff rules
B (legacy) ~1,350 files yapf (80-char) + isort + autoflake None

Group B files get zero ruff lint coverage today. Bugs like bare except:, undefined names, invalid escape sequences, and raise NotImplemented go undetected.

Why not just enable full ruff on Group B?

  • Ruff's line-length = 100 vs yapf's column_limit = 80 would cause formatting conflicts
  • CI runs pre-commit run -a (all files), and Group B has thousands of pre-existing violations — enabling full ruff would break CI immediately
  • Ruff has no diff-aware mode, so there's no way to lint only changed lines

Solution: Baseline-Gated Supplemental Lint

A dedicated ruff-legacy hook applies only the rules that the legacy tools don't cover, gated by a violation snapshot (ruff-legacy-baseline.json):

  1. Runs ruff --fix on staged legacy files, auto-fixing what it can
  2. Compares remaining violations against the snapshot (per-file, per-rule counts)
  3. New violations (count exceeds snapshot) → commit blocked
  4. Pre-existing violations (within snapshot) → tolerated
  5. Resolved violations (count below snapshot) → prints a hint to tighten the ratchet

This means the hook runs in both local pre-commit AND CI --all-files mode.

Enabled Category Examples
F402, F403, F405, F601, F811, F821, F822, F901 Pyflakes (bug detection) Import shadowing, undefined names, star imports
E4, E711-E714, E721, E722, E731, E741 Pycodestyle (semantic) Bare except, None comparison, ambiguous vars
D (minus D100-D107, D417) Pydocstyle Docstring formatting
PLE Pylint errors Various
W605 Invalid escape sequences

Suppressed (overlap with legacy tools): E1xx/E2xx/E3xx (yapf), E501 (yapf), I001/I002 (isort), F401/F841 (autoflake).

Architecture

legacy-files.txt                     ← SINGLE SOURCE OF TRUTH (1,350 paths)
        │
        ├──► scripts/generate_legacy_lint_config.py (reads + renders)
        │         │
        │         ├──► ruff-legacy.toml              (full file, auto-generated)
        │         ├──► pyproject.toml                 (managed block: format.exclude)
        │         └──► .pre-commit-config.yaml        (managed blocks: common_files + legacy_files)
        │
        ├──► Validated by verify-legacy-config hook (freshness gate)
        │
        └──► ruff-legacy-baseline.json               ← VIOLATION SNAPSHOT
                    │
                    └──► scripts/ruff_legacy_lint_baseline.py
                              ├──► Pre-commit mode: --fix, compare against snapshot
                              └──► Update mode: --update-baseline (rescan all files)

Developer Experience

$ git add some_legacy_file.py
$ git commit -m "fix timeout"

ruff-legacy (baseline-gated lint for legacy files)....Failed
  Auto-fixed 1 file(s):
    some_legacy_file.py

  New violations (1 regressions):
    some_legacy_file.py E722 (+1)

  Re-stage modified files and fix new violations, then commit again.

$ git add some_legacy_file.py   # re-stage auto-fixes
$ # fix the bare except manually
$ git commit -m "fix timeout"
All hooks passed.

When a developer resolves existing violations:

ruff-legacy (baseline-gated lint for legacy files)....Passed

Tip: 3 known violation(s) were resolved. Run:
  python scripts/ruff_legacy_lint_baseline.py --update-baseline
to tighten the violation snapshot.

Files Created (8)

File Description
legacy-files.txt One path per line, sorted. Single source of truth for Group B membership.
ruff-legacy.toml Auto-generated supplemental ruff config (includes file list + rule selection)
ruff-legacy-baseline.json Per-file, per-rule violation counts — the ratchet snapshot
scripts/generate_legacy_lint_config.py Generator with --generate, --check, --prune modes
scripts/ruff_legacy_lint_baseline.py Baseline-gated lint wrapper with pre-commit and --update-baseline modes
scripts/templates/ruff-legacy.toml.j2 Jinja2 template for ruff-legacy.toml
scripts/templates/pyproject-format-exclude.j2 Template for pyproject.toml managed block
scripts/templates/precommit-legacy-files.j2 Template for .pre-commit-config.yaml managed blocks

Files Modified (6)

File Change
.pre-commit-config.yaml Wrap file lists in managed block markers; add legacy_files anchor; add exclude: *legacy_files to ruff + ruff-format hooks; add ruff-legacy and verify-legacy-config hooks; move static-analysis-files anchor outside auto-generated zone; fix pass_filenames on model-registry-check
pyproject.toml Move legacy list from [tool.ruff] exclude (global) to [tool.ruff.format] exclude (format-only); wrap in managed block markers; add force-exclude = true
CODING_GUIDELINES.md Rewrite "Pre-commit Linting" section with baseline-gated enforcement docs, terminology, subsections for violations/cleanup/graduation/maintenance
CONTRIBUTING.md Update pre-commit note to mention baseline-gated enforcement
tensorrt_llm/runtime/kv_cache_manager_v2/rawref/setup.py Fix unsorted import (see note below)
~28 legacy Python files Bulk auto-fix of 3,816 ruff-fixable violations (unused imports, f-strings, comparison order, etc.)

Note: basename-match side effect on main

On main, the root setup.py is in [tool.ruff] exclude. Because ruff matches exclude patterns against basenames, this accidentally excluded every file named setup.py in the entire repo from linting — including tensorrt_llm/runtime/kv_cache_manager_v2/rawref/setup.py. The ruff pre-commit hook uses --force-exclude (built into astral-sh/ruff-pre-commit), which enforces excludes even when files are passed by path.

This PR moves the legacy list from the global [tool.ruff] exclude to [tool.ruff.format] exclude, so "setup.py" no longer suppresses linting for all basename matches. This exposed a pre-existing I001 (unsorted import) in rawref/setup.py, which is fixed in this PR.

Graduation Path

To move a file from Group B → Group A:

  1. Remove the path from legacy-files.txt
  2. Regenerate derived configs: python scripts/generate_legacy_lint_config.py
  3. Update the violation snapshot: python scripts/ruff_legacy_lint_baseline.py --update-baseline
  4. Fix all violations under the main ruff ruleset: ruff check --fix <file> && ruff format <file>
  5. Commit everything together (regenerated configs + snapshot + formatted file)

When legacy-files.txt reaches 0 entries, delete all supplemental infrastructure and switch to a single ruff toolchain.

Maintenance

  • legacy-files.txt is the single source of truth. Three derived configs are auto-generated — never edit by hand.
  • The verify-legacy-config pre-commit hook catches stale configs.
  • ruff-legacy-baseline.json is a separate artifact — update with --update-baseline.
  • After editing legacy-files.txt: run generate_legacy_lint_config.py then --update-baseline.
  • Periodic housekeeping: generate_legacy_lint_config.py --prune removes stale entries for deleted/renamed files.

Measured Impact

Metric Value
Total supplemental-rule violations in Group B (before fix) ~5,700
Auto-fixed in bulk-fix commit 3,816 (67%)
Remaining known violations (in baseline) 5,577 across 499 files
Python source files with lint fixes in this PR ~28

Developer disruption estimate

Subsequent PRs that touch legacy files will encounter scoped lint enforcement only on the files they touch. The baseline gate means pre-existing violations don't block — only new regressions.

Test plan

  • python scripts/generate_legacy_lint_config.py --check exits 0
  • ruff check --config ruff-legacy.toml <legacy-file> reports only supplemental rules
  • YAML and TOML validation passes
  • All pre-commit hooks pass on --all-files (excluding clang and mypy which need compiled bindings)
  • Baseline gate enforcement verified: injecting a new violation blocks the commit (exit 1)
  • Ratchet hint verified: resolving a violation prints tip to update baseline (exit 0)
  • Hook routing verified: ruff-legacy runs on Group B / skips Group A; main ruff skips Group B / runs on Group A
  • Freshness check catches manual edits to generated files
  • verify-legacy-config passes after regeneration
  • force-exclude = true confirmed in both pyproject.toml and ruff-legacy.toml

@venkywonka venkywonka changed the title [None][cleanup] Close Python lint gap: enable ruff lint on all files [None][cleanup] Close Python lint gap: enable supplemental ruff lint on legacy files Feb 19, 2026
@venkywonka venkywonka changed the title [None][cleanup] Close Python lint gap: enable supplemental ruff lint on legacy files [None][cleanup] Add supplemental ruff lint for legacy files via ruff-legacy hook Feb 19, 2026
@venkywonka venkywonka self-assigned this Feb 19, 2026
@venkywonka
Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #36306 [ run ] triggered by Bot. Commit: 2f6ca3c Link to invocation

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #36306 [ run ] completed with state SUCCESS. Commit: 2f6ca3c
/LLM/main/L0_MergeRequest_PR pipeline #28079 completed with status: 'SUCCESS'

Link to invocation

@venkywonka venkywonka marked this pull request as ready for review February 23, 2026 22:03
@venkywonka venkywonka requested review from a team as code owners February 23, 2026 22:03
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 23, 2026

📝 Walkthrough

Walkthrough

This PR implements a two-group Python linting strategy by introducing legacy file management and automated configuration generation. It adds ~1,350 legacy files to a dedicated list, creates configuration templates and a generator script to maintain lint/format rules automatically, documents the strategy in development guides, and updates configuration files accordingly.

Changes

Cohort / File(s) Summary
Documentation
CODING_GUIDELINES.md, CONTRIBUTING.md
Adds sections explaining the two-group Python linting workflow (Group A: ~550 newer files with ruff; Group B: ~1,350 legacy files with yapf/isort/autoflake plus supplemental ruff rules). Includes procedures for file graduation and CI considerations. Note: CODING_GUIDELINES.md contains a duplicated section.
Legacy File Registry
legacy-files.txt
Adds comprehensive list of ~1,350 legacy Python files across the codebase (python utilities, C++ components, test suites, models, backends, benchmarking tools, examples, and documentation).
Configuration Files
pyproject.toml, ruff-legacy.toml
Updates pyproject.toml with force-exclude toggle and auto-generated Ruff exclusion blocks referencing legacy-files.txt. Introduces ruff-legacy.toml with supplemental lint rules (F, E4/E7, D, PLE, W605) and per-file ignores for legacy files.
Generation Script and Templates
scripts/generate_legacy_lint_config.py, scripts/templates/ruff-legacy.toml.j2, scripts/templates/precommit-legacy-files.j2, scripts/templates/pyproject-format-exclude.j2
Adds script to generate/validate/prune lint configuration from legacy-files.txt source. Provides functions for path reading, validation, template rendering, and managed block replacement. Creates Jinja2 templates for ruff-legacy.toml, pyproject exclude list, and pre-commit regex patterns.
Tool Updates
scripts/release_check.py
Adds SKIP=ruff-legacy environment variable to pre-commit run command to exclude supplemental hook in certain CI modes.
Minor Import Fix
tensorrt_llm/runtime/kv_cache_manager_v2/rawref/setup.py
Reorders import statement from setup, Extension to Extension, setup.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title '[None][cleanup] Add supplemental ruff lint for legacy files via ruff-legacy hook' clearly and concisely describes the main change: introducing a supplemental ruff lint hook for legacy files.
Docstring Coverage ✅ Passed Docstring coverage is 86.67% which is sufficient. The required threshold is 80.00%.
Description check ✅ Passed The PR description is comprehensive and well-structured, covering objectives, problem statement, solution approach, architecture, files created/modified, testing, and maintenance.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
tensorrt_llm/runtime/kv_cache_manager_v2/rawref/setup.py (1)

16-27: ⚠️ Potential issue | 🟡 Minor

Align setuptools imports with the namespace-preserving rule.

The direct import of Extension violates the coding guideline. However, the proposed fix is incorrect—using import setuptools explicitly violates the guideline's "Avoid import package" requirement.

Import the submodule instead and qualify usages:

🔧 Proposed fix
-from setuptools import Extension, setup
+from setuptools import extension, setup

-rawref_module = Extension(
+rawref_module = extension.Extension(
     '_rawref',
     sources=['rawrefmodule.c'],
 )

As per coding guidelines, "Always maintain the namespace when importing. Use from package.subpackage import foo instead of from package.subpackage.foo import SomeClass or import package."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tensorrt_llm/runtime/kv_cache_manager_v2/rawref/setup.py` around lines 16 -
27, Replace the direct import of Extension with a submodule import: keep setup
imported from setuptools but import Extension from the setuptools.extension
submodule (i.e., change "from setuptools import Extension, setup" to "from
setuptools import setup" and "from setuptools.extension import Extension"),
leaving usages of Extension and setup unchanged in the file.
pyproject.toml (1)

107-122: ⚠️ Potential issue | 🟡 Minor

Potential crash if END marker is on the last line without a trailing newline.

replace_managed_block in the generator (line 120 of the script) uses content.index("\n", end_idx) which raises ValueError if the END marker is on the very last line with no trailing newline. While the auto-generated templates likely always produce a trailing newline, this is fragile if someone manually edits the file. The same logic applies to the managed blocks in this file.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pyproject.toml` around lines 107 - 122, The replace_managed_block function
currently calls content.index("\n", end_idx) which will raise ValueError if the
END marker is the last thing in the file with no trailing newline; update
replace_managed_block (and other managed-block handlers in this file) to safely
handle a missing newline by using content.find("\n", end_idx) and if it returns
-1 fall back to len(content) (or wrap the index call in try/except and set the
end position to len(content) on ValueError), so the function will correctly
replace/remove the block even when the END marker is at EOF.
🧹 Nitpick comments (3)
scripts/generate_legacy_lint_config.py (3)

221-230: set(stale) is rebuilt for every element in the list comprehension.

Minor inefficiency — pre-compute the set.

Proposed fix
-    valid = [p for p in paths if p not in set(stale)]
+    stale_set = set(stale)
+    valid = [p for p in paths if p not in stale_set]
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/generate_legacy_lint_config.py` around lines 221 - 230, In
do_prune(), the list comprehension builds set(stale) on every iteration causing
inefficiency; fix it by precomputing the set once (e.g., stale_set = set(stale))
before creating valid and then use that stale_set in the comprehension (valid =
[p for p in paths if p not in stale_set]) so the set conversion isn’t repeated
for each element.

164-183: do_generate writes three files non-atomically.

If the script fails midway (e.g., a missing marker in .pre-commit-config.yaml), ruff-legacy.toml and pyproject.toml will already be overwritten, leaving the config in a partially-updated state. For a developer-facing CLI tool this is low-risk (re-running fixes it), but worth noting.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/generate_legacy_lint_config.py` around lines 164 - 183, do_generate
currently writes RUFF_LEGACY_TOML, PYPROJECT_TOML, and PRECOMMIT_YAML in-place
which can leave files partially-updated if an error occurs; change it to perform
atomic replacements by writing each generated content to a temporary file (e.g.,
next to the target path with a unique suffix) and only calling
Path.replace/os.replace to move the temp into place after all
generation/replace_managed_block operations succeed. Use the existing helpers
generate_ruff_legacy_toml, generate_pyproject_block, generate_precommit_block
and the targets RUFF_LEGACY_TOML, PYPROJECT_TOML, PRECOMMIT_YAML to locate where
to write temps; ensure temps are cleaned up on error and that writes use atomic
replace so no original file is lost if a later step fails.

238-279: --generate with default=True makes args.generate always True, even when --check or --prune is passed.

The code works because args.prune and args.check are checked first in the if-chain, but this is misleading — args.generate is never actually read. A cleaner approach would use store_const or simply drop default=True and fall through to do_generate as the default.

Cleaner alternative
     group = parser.add_mutually_exclusive_group()
     group.add_argument(
         "--generate",
         action="store_true",
-        default=True,
         help="Write generated files in-place (default)",
     )

The else-branch already handles the default (generate) case, so default=True is unnecessary.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/generate_legacy_lint_config.py` around lines 238 - 279, The
--generate argument is declared with default=True causing args.generate to
always be True; remove the confusing default (or change the add_argument for
"--generate" to use action="store_const"/const=True without a default) so that
args.generate is False unless explicitly passed, and rely on the existing
if/else flow in main() that calls do_prune(), do_check(paths) or, by falling
through, do_generate(paths); update the group.add_argument("--generate", ...)
definition accordingly (referencing main, the ArgumentParser/group.add_argument
for "--generate", and the downstream checks do_generate/do_check/do_prune).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@scripts/generate_legacy_lint_config.py`:
- Around line 107-122: The code assumes content.index("\n", end_idx) will always
find a newline and will raise ValueError if the END marker is the file's final
line; update the logic in generate_legacy_lint_config.py to use
content.find("\n", end_idx) and treat -1 as "no trailing newline" by setting
end_line_end = len(content) in that case so the return statement (using
begin_idx, new_block and end_line_end) works when the END_MARKER is on the last
line.

---

Outside diff comments:
In `@pyproject.toml`:
- Around line 107-122: The replace_managed_block function currently calls
content.index("\n", end_idx) which will raise ValueError if the END marker is
the last thing in the file with no trailing newline; update
replace_managed_block (and other managed-block handlers in this file) to safely
handle a missing newline by using content.find("\n", end_idx) and if it returns
-1 fall back to len(content) (or wrap the index call in try/except and set the
end position to len(content) on ValueError), so the function will correctly
replace/remove the block even when the END marker is at EOF.

In `@tensorrt_llm/runtime/kv_cache_manager_v2/rawref/setup.py`:
- Around line 16-27: Replace the direct import of Extension with a submodule
import: keep setup imported from setuptools but import Extension from the
setuptools.extension submodule (i.e., change "from setuptools import Extension,
setup" to "from setuptools import setup" and "from setuptools.extension import
Extension"), leaving usages of Extension and setup unchanged in the file.

---

Nitpick comments:
In `@scripts/generate_legacy_lint_config.py`:
- Around line 221-230: In do_prune(), the list comprehension builds set(stale)
on every iteration causing inefficiency; fix it by precomputing the set once
(e.g., stale_set = set(stale)) before creating valid and then use that stale_set
in the comprehension (valid = [p for p in paths if p not in stale_set]) so the
set conversion isn’t repeated for each element.
- Around line 164-183: do_generate currently writes RUFF_LEGACY_TOML,
PYPROJECT_TOML, and PRECOMMIT_YAML in-place which can leave files
partially-updated if an error occurs; change it to perform atomic replacements
by writing each generated content to a temporary file (e.g., next to the target
path with a unique suffix) and only calling Path.replace/os.replace to move the
temp into place after all generation/replace_managed_block operations succeed.
Use the existing helpers generate_ruff_legacy_toml, generate_pyproject_block,
generate_precommit_block and the targets RUFF_LEGACY_TOML, PYPROJECT_TOML,
PRECOMMIT_YAML to locate where to write temps; ensure temps are cleaned up on
error and that writes use atomic replace so no original file is lost if a later
step fails.
- Around line 238-279: The --generate argument is declared with default=True
causing args.generate to always be True; remove the confusing default (or change
the add_argument for "--generate" to use action="store_const"/const=True without
a default) so that args.generate is False unless explicitly passed, and rely on
the existing if/else flow in main() that calls do_prune(), do_check(paths) or,
by falling through, do_generate(paths); update the
group.add_argument("--generate", ...) definition accordingly (referencing main,
the ArgumentParser/group.add_argument for "--generate", and the downstream
checks do_generate/do_check/do_prune).

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1208553 and 2f6ca3c.

📒 Files selected for processing (12)
  • .pre-commit-config.yaml
  • CODING_GUIDELINES.md
  • CONTRIBUTING.md
  • legacy-files.txt
  • pyproject.toml
  • ruff-legacy.toml
  • scripts/generate_legacy_lint_config.py
  • scripts/release_check.py
  • scripts/templates/precommit-legacy-files.j2
  • scripts/templates/pyproject-format-exclude.j2
  • scripts/templates/ruff-legacy.toml.j2
  • tensorrt_llm/runtime/kv_cache_manager_v2/rawref/setup.py

Comment thread scripts/generate_legacy_lint_config.py Outdated
Comment thread scripts/templates/precommit-legacy-files.j2
Copy link
Copy Markdown
Collaborator

@hnover-nv hnover-nv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question, but to the limited extent I understand it, looks good!
We'll want to message something out to the team before we turn this on. Did you want to hold this until everything is finalized, or should we message this change now-ish and turn it on?

hnover-nv

This comment was marked as duplicate.

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #41588 [ run ] completed with state SUCCESS. Commit: 3d0fec2
/LLM/main/L0_MergeRequest_PR pipeline #32497 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

Link to invocation

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #41599 [ run ] triggered by Bot. Commit: 3d0fec2 Link to invocation

@venkywonka
Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #41640 [ run ] triggered by Bot. Commit: 3d0fec2 Link to invocation

@venkywonka
Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #41666 [ run ] triggered by Bot. Commit: 3d0fec2 Link to invocation

@venkywonka venkywonka force-pushed the venky/stricter-linter branch from 3d0fec2 to b3d52b1 Compare April 3, 2026 16:34
@venkywonka
Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #41711 [ run ] triggered by Bot. Commit: b3d52b1 Link to invocation

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #41711 [ run ] completed with state SUCCESS. Commit: b3d52b1
/LLM/main/L0_MergeRequest_PR pipeline #32613 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

Link to invocation

@venkywonka
Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #41728 [ run ] triggered by Bot. Commit: b3d52b1 Link to invocation

@venkywonka
Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #41728 [ run ] completed with state SUCCESS. Commit: b3d52b1
/LLM/main/L0_MergeRequest_PR pipeline #32629 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

Link to invocation

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #41760 [ run ] triggered by Bot. Commit: b3d52b1 Link to invocation

@venkywonka
Copy link
Copy Markdown
Collaborator Author

/bot run --disable-multi-gpu-test

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #41782 [ run ] triggered by Bot. Commit: b3d52b1 Link to invocation

@venkywonka
Copy link
Copy Markdown
Collaborator Author

/bot run --disable-multi-gpu-test

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #41782 [ run ] completed with state FAILURE. Commit: b3d52b1
/LLM/main/L0_MergeRequest_PR pipeline #32677 (Partly Tested) completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

Link to invocation

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #41784 [ run ] triggered by Bot. Commit: b3d52b1 Link to invocation

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #41784 [ run ] completed with state SUCCESS. Commit: b3d52b1
/LLM/main/L0_MergeRequest_PR pipeline #32678 (Partly Tested) completed with status: 'SUCCESS'

CI Report

Link to invocation

…legacy hook

Two-group Python lint strategy:
- Group A (~550 modern files): full ruff lint+format via existing hooks
- Group B (~1,350 legacy files): baseline-gated supplemental ruff lint
  that blocks new violations while tolerating pre-existing ones

Key changes:
- Add ruff-legacy pre-commit hook with baseline JSON snapshot
- Add scripts/legacy_utils.py for baseline management (prune, gen-configs,
  lint-update-violations, lint-precommit, check-configs)
- Auto-generate ruff-legacy.toml and file lists in pyproject.toml /
  .pre-commit-config.yaml from a single source of truth
- Bulk-fix auto-fixable legacy violations, update CONTRIBUTING.md and
  CODING_GUIDELINES.md with lint documentation
- Add unit tests for lint scripts in tests/unittest/scripts/

Signed-off-by: venkywonka <23023424+venkywonka@users.noreply.github.com>
@venkywonka venkywonka force-pushed the venky/stricter-linter branch from b3d52b1 to e74e905 Compare April 4, 2026 06:27
@venkywonka
Copy link
Copy Markdown
Collaborator Author

/bot skip --comment "pipeline 32678 passed. latest force-push was a mere rebase"

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #41810 [ skip ] triggered by Bot. Commit: e74e905 Link to invocation

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #41810 [ skip ] completed with state SUCCESS. Commit: e74e905
Skipping testing for commit e74e905

Link to invocation

@venkywonka venkywonka merged commit 249013a into NVIDIA:main Apr 4, 2026
5 checks passed
yufeiwu-nv pushed a commit to yufeiwu-nv/TensorRT-LLM that referenced this pull request Apr 7, 2026
…legacy hook (NVIDIA#11469)

Signed-off-by: venkywonka <23023424+venkywonka@users.noreply.github.com>
karen-sy pushed a commit to karen-sy/TensorRT-LLM that referenced this pull request Apr 7, 2026
…legacy hook (NVIDIA#11469)

Signed-off-by: venkywonka <23023424+venkywonka@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.