Only if the rule is enabled. Do they enable it by default?
How much time do you want to spend selecting lint rules for a large existing codebase from the ruff list?
Would you enable the whole of the B or SIM categories? Why those categories and have you evaluated every other possible category?
Either of these categories might throw up thousands of false positives because of other pointless rules like these ones:
If you enable just these two rules in the sympy codebase you get:
$ ruff check sympy --statistics
910 SIM300 [*] yoda-conditions
243 B007 [ ] unused-loop-control-variable
Found 1153 errors.
[*] 910 fixable with the `--fix` option (165 hidden fixes can be enabled with the `--unsafe-fixes` option).
An example of each case is:
sympy/utilities/tests/test_wester.py:3008:12: SIM300 [*] Yoda condition detected
|
3006 |
3007 | F, _, _ = mellin_transform(1/(1 - x), x, s)
3008 | assert F == pi*cot(pi*s)
| ^^^^^^^^^^^^^^^^^ SIM300
|
= help: Rewrite as `pi*cot(pi*s) == F`
sympy/utilities/_compilation/util.py:174:15: B007 Loop control variable `dirs` not used within loop body
|
172 | cwd = '.'
173 | globbed = []
174 | for root, dirs, filenames in os.walk(cwd):
| ^^^^ B007
175 | for fn in filenames:
|
= help: Rename unused `dirs` to `_dirs`
Does either of those look like a meaningful improvement? Do you want to review 1000 examples of these? In either case would you want to impose this kind of rule on all future contributors?
How much time do you want to spend making pointless changes in the code so that you can use the SIM category or otherwise carefully analysing what each of the different rules in the category is doing to select which ones to include/exclude?
Driveby contributors often open pull requests to sympy attempting to apply seemingly random choices from among these rules and fixers. I can’t think of a time when any of them has actually picked a genuinely useful rule though so those kinds of PRs are just a drain. Do you want to review a 1000 line diff touching every part of a large codebase from some new contributor that you have no prior trust in and where the change provides zero meaningful improvement?
This is why sympy did not have either the B012 or SIM107 rules enabled in either flake8 or ruff even though both linters are run in CI. If these rules are important then they should not be buried in a mess of random opinionated stuff.
I don’t see why special authority is really needed though. The current way this generally works is:
- Someone makes a flake8 plugin with some rules
- Other people copy the rules into ruff
Anyone can do either of these things but thus far the result of people doing this is the sets of rules that you can see for ruff here. The problem is that there is no plugin/section containing rules that are non-opinionated and universally applicable with low false positive rate. I think if someone carefully curated such a list of rules then the situation could arise where it could be considered if linters should apply those rules by default.
I think the problem is that people who make these rule sets are typically the kind of people who like to have lots of opinionated rules. Each rule set is really just the author’s personal rule fiefdom rather than being any meaningful categorisation from the perspective of anyone else choosing which rules to use.
There is nothing stopping anyone from making more conservative rule sets though and I imagine linter maintainers would welcome that as well.