Skip to content

ci: run ruff check --fix in tox -e format#2369

Merged
james-garner-canonical merged 1 commit intocanonical:mainfrom
james-garner-canonical:26-03+ci+run-ruff-check-fix-from-tox
Mar 11, 2026
Merged

ci: run ruff check --fix in tox -e format#2369
james-garner-canonical merged 1 commit intocanonical:mainfrom
james-garner-canonical:26-03+ci+run-ruff-check-fix-from-tox

Conversation

@james-garner-canonical
Copy link
Copy Markdown
Contributor

This PR updates tox -e format to run ruff check --preview --fix after running ruff format --preview.

Why? tox -e lint will complain about errors that are fixable with ruff check --preview --fix, but we don't provide a way to fix them with tox. This is especially painful for import sorting errors. It's nice if tox -e format takes care of the automated changes that satisfy tox -e lint.

This doesn't introduce new checks -- we already enforce ruff check --preview on main via tox -e lint. It just adds developer convenience.

@dimaqq
Copy link
Copy Markdown
Contributor

dimaqq commented Mar 9, 2026

I certainly end up running the second command every now and again, so this is welcome :)
I think it should be safe too, as ruff has a separate switch for unsafe fixes.

@james-garner-canonical james-garner-canonical marked this pull request as ready for review March 9, 2026 22:56
Copy link
Copy Markdown
Collaborator

@tonyandrewmeyer tonyandrewmeyer left a comment

Choose a reason for hiding this comment

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

This seems reasonable to me - I generally find that the fixes that ruff check are the same fixes I would do manually.

@james-garner-canonical james-garner-canonical merged commit 9affc1e into canonical:main Mar 11, 2026
59 checks passed
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.

3 participants