Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Transition Python linting from flake8 to ruff #7338

Merged
merged 1 commit into from Nov 3, 2023

Conversation

jcfr
Copy link
Member

@jcfr jcfr commented Nov 3, 2023

Ruff is 10-100x faster than existing linters (like Flake8) and has over 700 built-in rules, with native re-implementations of popular Flake8 plugins.

See https://beta.ruff.rs/docs/

Ruff is 10-100x faster than existing linters (like Flake8) and
has over 700 built-in rules, with native re-implementations of
popular Flake8 plugins.

See https://beta.ruff.rs/docs/
@lassoan
Copy link
Contributor

lassoan commented Nov 3, 2023

These improvements all sound good, thanks for working on it. What I would really appreciate though if it was possible to:

  • easily run the exact same checks in the local build tree without any extra configuration, maybe as part of the build process
  • have an option for the the linter to change the source code to make it compliant

@jcfr
Copy link
Member Author

jcfr commented Nov 3, 2023

easily run the exact same checks in the local build tree without any extra configuration, maybe as part of the build process

While it is not running as part of the build process, the .ruff.toml will be found and used by modern IDE (e.g vscode)

For running the tool locally, it is currently possible doing:

  • installing pre-commit in a virtual env
  • running pre-commit run --all

It should be possible to create a virtual env within the build tree all to install the tooling needed at build time, I wil create an issue,

have an option for the the linter to change the source code to make it compliant

If possible fixed will be applied running the tool locally.

@jcfr
Copy link
Member Author

jcfr commented Nov 3, 2023

In the meantime, could it be approved ?

Copy link
Contributor

@jamesobutler jamesobutler left a comment

Choose a reason for hiding this comment

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

The performance looks promising and the community seems to have responded in favor of it.

@jcfr jcfr merged commit ce04529 into Slicer:main Nov 3, 2023
6 checks passed
@jcfr jcfr deleted the transition-from-flake8-to-ruff branch November 3, 2023 23:05
@jcfr jcfr added the backport:5.x Identify pull request expected to be backported to the current 5.x release branch. label Nov 5, 2023
@jcfr jcfr removed the backport:5.x Identify pull request expected to be backported to the current 5.x release branch. label Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants