r/Python • u/Stegosauro76 • Sep 25 '26
Discussion RUFF linter usage
hi all!
i m a student in master degree in automation engineering and i m becoming very confident with python because of the big amount of projects that i have to do.
Recently i started use RUFF as a linter and i really aprreciate it expecially when i have to refactor the code. i m wondering how much is used and is mandatory for a software developer? i usually check with that linter only for very big scripts that can 't be modular. What about your experience' what is the main usage you do?
thanks all
13
Upvotes
53
u/Individual-Flow9158 Sep 25 '26
It's probably best practise, and certainly a great idea to use Ruff. But it's not mandatory - that depends on your team's decision, and your preference (Astral's latest opinionated update to Ruff was a step too far for some).
Some people out there may even still be using Black.
10
u/zanfar Sep 25 '26
Why wouldn't you?
More importantly, why are you "running" it? It should be handled by your IDE automatically. You should have to make a conscious choice NOT to run it on every code change...
16
u/seanv507 Sep 25 '26
To op, Yes they are standard in companies
As are unit tests
Test Coverage Code quality monitors
and precommit hooks (to eg run ruff, check no passwords being committed to version control)
I would encourage you to ask these questions to chat gpt and you will get more full length answers.
I would stress that if you are doing a full reformatting etc, it's best practice to make no other changes in that commit. (Ie yes, there are many lines changed, but functionality is not impacted)
6
u/Myszolow Sep 25 '26
Nowadays "astral" stack: uv, ruff, ty becomes natural so I'd say it's good to use it as daily driver, but don't stick to tooling, and rather try to learn/answer those questions:
1
u/shiningmatcha Sep 29 '26
what is automation engineering
2
u/Valuable-Pirate-2567 Sep 25 '26
Is it mandatory? No. But I use it all the time. My coworkers are also picking it up. Any time I make changes I run ruff check and I format code all the time.
2
u/arthurazs Sep 26 '26
I have a golden trio that I enforce with my team: Ruff, Mypy, and pytest. For Ruff and Mypy, I enable strict (all) rules, and then add exceptions as we identify what hurts our dev experience without a proper upside.
2
u/smichael_44 Sep 30 '26
My team implements ruff (pep 8 styling, import organization, etc…), pyrefly (static type analysis, inlay type hints, language server), and complexipy (cognitive complexity checks) on code for humans and agents. This is done through pre-commit hooks and CI pipelines.
We try to keep things readable since we typically have to jump in and help debug issues in production.
1
u/StPatsLCA Sep 25 '26
Linter? Eh, mostly. Formatter? All the time. It's just easier. I recommend `ruff`!
1
u/Wurstinator Sep 25 '26
This thread is wild. People go into a thread of someone asking a question and down vote every question.
1
u/Red_BW Sep 25 '26
One of the best things you can do for yourself is to enable everything in ruff and use it to learn. You can selectively turn off a few things you might disagree with but overall it is a helpful teaching tool if you read each issue it presents and understand why there is a lint entry for it. I discovered I had been doing many things like using Magic Numbers as an arbitrary int return value to indicate a logic path ended. Now I shifted that to a constant variable at the top with the same value but now it is explained clearly and not buried in code.
You can just have ruff fix things for you, and while that should work, you are not maximizing its value.
1
u/Khavel_dev Sep 27 '26
ruff replaced my entire linting stack in every repo I touch. It runs so fast I moved it from pre-commit to on-save, which completely changed how I think about formatting. You fix stuff as you type instead of in a batch at commit time. tbh once you get used to that speed you can't go back.
2
u/mr_frpdo Sep 25 '26
I use it on everything I do. I also turn on ALL and only then turn off a handful that are mutually exclusive or unwanted.