Open matthewlloyd opened 1 year ago
Thank you for this, super thorough and much appreciated!
I'm looking forward to see those checks in ruff! I'll expand here some moments regarding F811 and similar check in pycharm.
In the following example all redeclarations were highlighted by pycharm, but ruff alerts only on imports and function/class definitions. Variable redeclaration without usage passes the check.
import os
import sys
import os # ruff alerts F811
def foo():
pass
def foo(): # ruff alerts F811
pass
class Foo:
pass
class Foo: # ruff alerts F811
pass
class Bar:
x = 10
x = 20 # No alert
BAR = "bar"
BAR = "baz" # No alert
It would be great to enable checking for variables too.
(Opening a new issue to continue the discussion from #2972 which will be closed by https://github.com/charliermarsh/ruff/pull/3022)
I went through all the PyCharm inspections, filtered those I deemed implementable in a non-type-aware linter, and categorized them by whether they have Ruff or PyLint counterparts, mostly by running Ruff and PyLint directly on the examples provided in the PyCharm Settings panel.
There were five left over, which might merit consideration for inclusion as RUF rules.
PyCharm inspections not currently covered by Ruff or PyLint
Invalid definition of 'typing.NamedTuple' (field with default followed by one or more fields without)
Covered by Ruff or PyLint