Skip to content

discover generation_*.py in model directories - #50

Merged
tarekziade merged 1 commit into
mainfrom
discover-generation-files
Aug 24, 2026
Merged

tarekziade merged 1 commit into
mainfrom
discover-generation-files

Conversation

@tarekziade

Copy link
Copy Markdown
Collaborator

The ten generation_*.py files in transformers hold model implementation code but no pattern in MODELING_PATTERNS matched them, so no rule ever saw them. TRF009 gains the matching prefix and reports the two real cross-model imports this exposes. A full run over transformers goes 40 -> 42 findings, both new ones TRF009, so the rules that gate on AST content are unaffected.

Also corrects the leftover "only exemption" claim in the TRF009 changelog entry, which convert_*.py and init.py contradict.

Closes #49.

The ten generation_*.py files in transformers hold model implementation code but
no pattern in MODELING_PATTERNS matched them, so no rule ever saw them. TRF009
gains the matching prefix and reports the two real cross-model imports this
exposes. A full run over transformers goes 40 -> 42 findings, both new ones
TRF009, so the rules that gate on AST content are unaffected.

Also corrects the leftover "only exemption" claim in the TRF009 changelog entry,
which convert_*.py and __init__.py contradict.

Closes #49.
@tarekziade

Copy link
Copy Markdown
Collaborator Author

@askserge review

@sergereview sergereview Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤗 Serge says:

This PR cleanly widens file discovery to include generation_*.py files in model directories and updates TRF009 to lint them. The change is consistent across mlinter/mlinter.py, mlinter/trf009.py, mlinter/rules.toml, README, docs, and tests. The standalone-repo test sensibly renames its helper from generation_utils.py to sampling_helpers.py to avoid it being misclassified as a model file, and the new TRF009 test verifies that cross-model imports in generation_*.py are flagged. Documentation and changelog prose accurately reflect that modular_*.py is the sole exemption while convert_*.py and __init__.py are out of scope. No correctness issues.

serge v0.1.0 · model: moonshotai/Kimi-K2.7-Code · 10 LLM turns · 12 tool calls · 17.4s · 152685 in / 3847 out tokens

@tarekziade
tarekziade merged commit 898e792 into main Aug 24, 2026
7 checks passed
@tarekziade
tarekziade deleted the discover-generation-files branch August 24, 2026 15:50
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.

generation_*.py in model dirs is never discovered, so no rule checks it

1 participant