Skip to content

Add Ruff linting, pre-commit hooks, and CI#145

Open
korbonits wants to merge 1 commit intoyyfz:mainfrom
korbonits:add-ruff-ci
Open

Add Ruff linting, pre-commit hooks, and CI#145
korbonits wants to merge 1 commit intoyyfz:mainfrom
korbonits:add-ruff-ci

Conversation

@korbonits
Copy link
Copy Markdown

Summary

Adds Ruff linting + CI enforcement to catch style and correctness issues on every PR.

Changes:

  • pyproject.toml: add [tool.ruff] config (E/F/I rules, line-length 120, notebooks excluded)
  • .pre-commit-config.yaml: ruff + ruff-format hooks
  • .github/workflows/lint.yml: lint job via uv on push/PR

Auto-fixed 60 violations (unsorted imports, f-string placeholders, style).

Two items flagged for maintainer attention:

  • Potential NameErrorprev_rays_overlap in pi3/pipe/pi3x_vo.py:69 is referenced inside the if ... prev_local_depth_overlap is not None branch, but prev_rays_overlap is never initialized to None at the top of the loop (unlike prev_local_depth_overlap and prev_aligned_poses_overlap). On the first iteration where prev_local_depth_overlap is set, accessing prev_rays_overlap would raise NameError. Added F821 to the ignore list so CI passes, but this is worth a second look.
  • Dead unbind importxformers.ops.unbind is imported in pi3/models/layers/attention.py but all call sites are commented out (# q, k, v = unbind(qkv, 2)). Added # noqa: F401.

Ruff version: v0.12.2

- Add [tool.ruff] config to pyproject.toml (E/F/I rules, line-length 120)
- Add .pre-commit-config.yaml with ruff + ruff-format hooks
- Add .github/workflows/lint.yml CI job via uv

Auto-fixed 60 import-sort and style violations. Remaining notes:
- F821: `prev_rays_overlap` in pi3/pipe/pi3x_vo.py:69 is used before
  it is defined (it is assigned at line 130); similar overlap variables
  are initialised to None at the top of the loop but this one is not —
  may be a latent NameError on the first iteration when
  prev_local_depth_overlap is set but prev_rays_overlap is not
- F401: `unbind` in pi3/models/layers/attention.py is imported but all
  call sites are commented out; added # noqa: F401
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