Ruff: A Fast Python Linter(lwn.net)
lwn.net
Ruff: A Fast Python Linter
https://lwn.net/Articles/930487/
5 comments
Thanks! Macroexpanded:
Ruff: A fast Python linter, written in Rust - https://news.ycombinator.com/item?id=34788020 - Feb 2023 (67 comments)
Ruff – a fast Python Linter written in Rust - https://news.ycombinator.com/item?id=32666035 - Aug 2022 (46 comments)
Reposts are ok when a story hasn't had significant attention in the last year or so (https://news.ycombinator.com/newsfaq.html) but as both of those threads were within the last year, the current submission counts as a dupe.
The intention behind that rule is to have a balance: it's good to re-discuss popular topics from time to time, and we also want room on the front page for lots of uncorrelated and unfamiliar things.
Ruff: A fast Python linter, written in Rust - https://news.ycombinator.com/item?id=34788020 - Feb 2023 (67 comments)
Ruff – a fast Python Linter written in Rust - https://news.ycombinator.com/item?id=32666035 - Aug 2022 (46 comments)
Reposts are ok when a story hasn't had significant attention in the last year or so (https://news.ycombinator.com/newsfaq.html) but as both of those threads were within the last year, the current submission counts as a dupe.
The intention behind that rule is to have a balance: it's good to re-discuss popular topics from time to time, and we also want room on the front page for lots of uncorrelated and unfamiliar things.
Ruff is an excellent base linter because it takes care of essential stuff and has sane default while integrates well without much work.
It's not going to replace pylint, but pylint is hard to configure and slow.
There is overlap between ruff checks and what's eliminated by black though, since ruff implemented flake8 rules first and a lot of them are PEP8 oriented.
Also, note that ruff is also a fast import sorter, faster than isort. But it's not a 1:1 match to isort (no fly to top, some formatting are different).
All in all, I would advice to use it if you are not used to linters, or if you don't feel like going full bazooka on a project.
It's has a very good cost/benefit ratio give how lighweight and easy to use it is.
It's not going to replace pylint, but pylint is hard to configure and slow.
There is overlap between ruff checks and what's eliminated by black though, since ruff implemented flake8 rules first and a lot of them are PEP8 oriented.
Also, note that ruff is also a fast import sorter, faster than isort. But it's not a 1:1 match to isort (no fly to top, some formatting are different).
All in all, I would advice to use it if you are not used to linters, or if you don't feel like going full bazooka on a project.
It's has a very good cost/benefit ratio give how lighweight and easy to use it is.
Ruff actually focuses on checks that don’t overlap with Black. (“By default, Ruff enables Flake8's E and F rules. Ruff supports all rules from the F category, and a subset of the E category, omitting those stylistic rules made obsolete by the use of an autoformatter, like Black.”)
Its import sorting is designed to be compatible with isort --profile=black by default (https://beta.ruff.rs/docs/faq/#how-does-ruffs-import-sorting...). Many isort settings are supported (https://beta.ruff.rs/docs/settings/#isort). I’m not sure what “fly to top” means.
Its import sorting is designed to be compatible with isort --profile=black by default (https://beta.ruff.rs/docs/faq/#how-does-ruffs-import-sorting...). Many isort settings are supported (https://beta.ruff.rs/docs/settings/#isort). I’m not sure what “fly to top” means.
interesting! I just set it up for a new project but I didn't know it had the ability to sort imports, how to you run this command ?
Enable the "I" category and run ruff with autofixing.
[deleted]
Why not replace pylint with it?
Pylint has hundreds of rules that ruff doesn't have, yet; see this GitHub issue: https://github.com/charliermarsh/ruff/issues/689
I'm very happy with ruff after coming from using flake8. I have it integrated in my pre-commit scripts, and it catches a lot of small stuff that would cause trouble down the pipeline. Best of all, it's really fast, as advertised, so it's much more practical than flake8 for that. All said, I'd still add heavier linters to a CI/CD process.
Ruff is amazing. I recommend turning on the [I]import rules as a replacement of isort and running `ruff check --fix`. Run it with black for best results.
It also has a very good LSP that complements pyright in my neovim setup. There's also a plug-in for pylsp if you're using an editor that doesn't support multiple LSPs at the same time (e.g. Helix).
After that, check the rules page[0] for anything that might be relevant to your project. Between enabling some of these rules, using pyright, black and sourcery, I feel like the most relevant cases are covered.
[0] https://beta.ruff.rs/docs/rules/
It also has a very good LSP that complements pyright in my neovim setup. There's also a plug-in for pylsp if you're using an editor that doesn't support multiple LSPs at the same time (e.g. Helix).
After that, check the rules page[0] for anything that might be relevant to your project. Between enabling some of these rules, using pyright, black and sourcery, I feel like the most relevant cases are covered.
[0] https://beta.ruff.rs/docs/rules/
Neat, it has a PyCharm plugin. Thanks, gonna try it out.
https://plugins.jetbrains.com/plugin/20574-ruff
https://plugins.jetbrains.com/plugin/20574-ruff
https://news.ycombinator.com/item?id=32666035 (46 comments)
https://news.ycombinator.com/item?id=34788020 (67 comments)
https://hn.algolia.com/?q=ruff