ci: add Ruff lint rules, pre-commit hooks, and lint job to CI#403
Open
korbonits wants to merge 1 commit intogoogle-research:masterfrom
Open
ci: add Ruff lint rules, pre-commit hooks, and lint job to CI#403korbonits wants to merge 1 commit intogoogle-research:masterfrom
korbonits wants to merge 1 commit intogoogle-research:masterfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
55d703b to
742f0f8
Compare
The [tool.ruff] section existed with formatting config only. This PR completes it by adding lint rules and wiring up enforcement: - Add [tool.ruff.lint] with E/F/I rules to pyproject.toml - Ignore F722/F821 globally (false positives from jaxtyping annotations such as Float[Array, "b n h d"] throughout the flax/ modules) - Add .pre-commit-config.yaml with ruff lint + format hooks - Add a lint job to .github/workflows/main.yml using astral-sh/setup-uv - Auto-fix 64 violations (unsorted imports, unused imports, f-strings)
742f0f8 to
f66960d
Compare
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
[tool.ruff.lint]topyproject.toml— the[tool.ruff]section existed with formatting config only (line length, indent width); this PR adds actual lint rulesF722/F821globally: these are false positives fromjaxtypingannotations (Float[Array, "b n h d"]etc.) throughout theflax/modules.pre-commit-config.yamlwith Ruff lint + format hookslintjob to.github/workflows/main.ymlusingastral-sh/setup-uv(uv is already used in thebuildjob)Motivation
The project already uses Ruff for formatting but has no lint rules enforced, no pre-commit hooks, and no lint step in CI. This PR completes that setup with a minimal, non-intrusive ruleset (E/F/I) that won't disrupt the existing Google 2-space indent style.
What's not included
buildormanual_publishworkflowsTesting
Ran
ruff check .andruff format --check .locally — all checks pass.