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

Python lint: Replace flake8 with ruff #806

Closed
wants to merge 4 commits into from
Closed

Conversation

cclauss
Copy link
Contributor

@cclauss cclauss commented Dec 10, 2024

https://docs.astral.sh/ruff is an extremely fast Python linter and code formatter, written in Rust. With over 800 linting rules, ruff can be used to replace Flake8 (plus dozens of plugins), Black, isort, pydocstyle, pyupgrade, autoflake, and more, all while executing tens or hundreds of times faster than any individual tool.

@ftnext
Copy link
Collaborator

ftnext commented Jan 1, 2025

If you are starting a completely new project, Ruff is a strong candidate.
However, for a project with history like SpeechRecognition, I think it is important to pay attention to the history.
ruff check itself is not fully compatible with flake8, so I don't see any reason why Ruff should be adopted in this project at the moment.

@ftnext ftnext closed this Jan 1, 2025
@cclauss cclauss deleted the ruff branch January 1, 2025 15:04
@cclauss
Copy link
Contributor Author

cclauss commented Jan 1, 2025

Based on the ruff docs, ruff is a complete superset of flake8.

[ ... ] designed as a drop-in replacement for Flake8 (plus dozens of plugins), isort, pydocstyle, pyupgrade, autoflake, and more.
-- https://docs.astral.sh/ruff/linter

By default, Ruff enables Flake8's F rules, along with a subset of the E rules, omitting any stylistic rules that overlap with the use of a formatter, like ruff format or Black.
-- https://docs.astral.sh/ruff/rules

@ftnext
Copy link
Collaborator

ftnext commented Jan 1, 2025

ruff is a complete superset of flake8.

No.
example: astral-sh/ruff#4125 (comment)
See https://docs.astral.sh/ruff/rules/#warning-w (No W503, W504)

@cclauss
Copy link
Contributor Author

cclauss commented Jan 1, 2025

Yes. Those are autocorrected by Black or Ruff Format as discussed above.

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