Skip to content

ci: add Ruff config, pre-commit hooks, and GitHub Actions lint workflow#92

Open
korbonits wants to merge 1 commit intomicrosoft:mainfrom
korbonits:ci/ruff-precommit-and-actions
Open

ci: add Ruff config, pre-commit hooks, and GitHub Actions lint workflow#92
korbonits wants to merge 1 commit intomicrosoft:mainfrom
korbonits:ci/ruff-precommit-and-actions

Conversation

@korbonits
Copy link
Copy Markdown

Summary

  • Add Ruff config to pyproject.toml (E/F/I rules, 120-char line length, per-file ignores for __init__.py)
  • Add .pre-commit-config.yaml with Ruff lint + format hooks
  • Add .github/workflows/lint.yml triggering on PRs and pushes to main
  • Auto-fix 349 violations (unsorted imports, unused imports, f-string placeholders)

Notes on conservative ignores

Several pre-existing issues are suppressed to keep this PR focused on infrastructure — worth addressing in follow-up PRs:

  • F821 (missing imports): np, nn, logging, pad_sequence, IGNORE_INDEX, and others are used but not imported in several files under data/, trainer/, and tools/
  • I001 (unsorted imports): active import pdb; pdb.set_trace() debug statements in data/conversations.py, data/dataset.py, and data/openx_magma/data_utils.py trigger the block-level import sort check — these may also be worth removing
  • E101 (mixed tabs/spaces): tools/simplerenv-magma/simpler_env/policies/magma/magma_model.py
  • F811: intentional subclassing of imported TrainingArguments in train.py

Motivation

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 . and ruff format --check . locally — all checks pass.

Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com

- 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>
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.

1 participant