Comment by IshKebab
1 day ago
I don't think people expect import sorting to fix bugs. It's just good (and free!) practice.
Anyway I have definitely had linters like Ruff catch bugs. Probably the most common is the mutable default argument gotcha.
1 day ago
I don't think people expect import sorting to fix bugs. It's just good (and free!) practice.
Anyway I have definitely had linters like Ruff catch bugs. Probably the most common is the mutable default argument gotcha.
I'm not saying that it's not catching bugs. Sometimes it does. But most of the rules are nonsense and the number of rules that makes no sense is growing.
Also, mutable default argument is not a bug. It is a bug only if mutable default argument is mutated inside the body of a function/method. Which is almost never the case.
> Which is almost never the case.
It's quite common in my experience.
And sure it's not always a bug, otherwise Python itself would flag it. The point of linters is to improve code quality to avoid things that are error-prone. This is one of the most error-prone things in Python in my experience.
First would probably be implicit bool coersion (e.g. `if a_string:`) but that can only be caught by a static type checker.