Skip to content

MNT: replace flake8 + isort with ruff#270

Draft
ZLLentz wants to merge 1 commit intopcdshub:masterfrom
ZLLentz:mnt_please_ruff
Draft

MNT: replace flake8 + isort with ruff#270
ZLLentz wants to merge 1 commit intopcdshub:masterfrom
ZLLentz:mnt_please_ruff

Conversation

@ZLLentz
Copy link
Member

@ZLLentz ZLLentz commented Apr 18, 2025

Description

I'm putting this up for consideration because I find this tool very helpful.

Replace the flake8 pre-commit with ruff, using the config I've been using.
The settings are negotiable (comparing with the existing .flake8 config file, maybe there are more changes to make here before merging)

Motivation and Context

flake8 doesn't fix things for you
isort is slow

ruff is fast and fixes things for you

How Has This Been Tested?

This is the config I've been using in other projects

Where Has This Been Documented?

n/a

@ZLLentz ZLLentz requested a review from a team April 18, 2025 01:25
@ZLLentz ZLLentz mentioned this pull request May 6, 2025
@tangkong
Copy link
Contributor

tangkong commented May 6, 2025

How does this work when people submit code that does not conform to style guidelines? (as in, the submitter did not run pre-commit locally) Ruff might format stuff in the CI runner, but we don't have a way to translate that back into commits right?

As long as ruff throws an error in the pre-commit job when it fixes things the workflow is the same, but if it fixes things up silently we'll have to adjust our jobs to let the submitter know there are changes to be made.

@ZLLentz
Copy link
Member Author

ZLLentz commented May 7, 2025

All pre-commit tasks, ruff format included, have a nonzero return code when they edit files. So, it will cause the job to fail and the diff will appear in the output.

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.

2 participants