ci: add Ruff config, pre-commit hooks, and GitHub Actions lint workflow#92
Open
korbonits wants to merge 1 commit intomicrosoft:mainfrom
Open
ci: add Ruff config, pre-commit hooks, and GitHub Actions lint workflow#92korbonits wants to merge 1 commit intomicrosoft:mainfrom
korbonits wants to merge 1 commit intomicrosoft:mainfrom
Conversation
- Add Ruff config to pyproject.toml (E/F/I rules, 120-char line length) - Add .pre-commit-config.yaml with ruff lint + format hooks - Add .github/workflows/lint.yml triggering on PRs - Auto-fix 349 violations (unsorted imports, unused imports, f-strings) Conservative ignores for pre-existing issues left for follow-up: - F821: missing imports in several files (np, nn, logging, pad_sequence, etc.) - I001: inline pdb.set_trace() debug statements in data/ trigger block-level sort check - E101: mixed tabs/spaces in tools/simplerenv-magma - F811: intentional subclassing of imported TrainingArguments in train.py Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pyproject.toml(E/F/I rules, 120-char line length, per-file ignores for__init__.py).pre-commit-config.yamlwith Ruff lint + format hooks.github/workflows/lint.ymltriggering on PRs and pushes tomainNotes on conservative ignores
Several pre-existing issues are suppressed to keep this PR focused on infrastructure — worth addressing in follow-up PRs:
np,nn,logging,pad_sequence,IGNORE_INDEX, and others are used but not imported in several files underdata/,trainer/, andtools/import pdb; pdb.set_trace()debug statements indata/conversations.py,data/dataset.py, anddata/openx_magma/data_utils.pytrigger the block-level import sort check — these may also be worth removingtools/simplerenv-magma/simpler_env/policies/magma/magma_model.pyTrainingArgumentsintrain.pyMotivation
No linting or PR-level CI exists today. This PR adds lightweight enforcement using Ruff and wires it up to run on every PR.
Testing
Ran
ruff check .andruff format --check .locally — all checks pass.Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com