diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c6294655f91b4b..85ec7f646ac609 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -30,6 +30,8 @@ repos: files: ^pandas exclude: ^pandas/tests args: [--select, "ANN001,ANN2", --fix-only, --exit-non-zero-on-fix] + - id: ruff + args: [--exit-non-zero-on-fix, --preview, "--ignore=E721,F841,RUF025,RUF100,RUF001,E226,RUF003,E203"] - id: ruff-format - repo: https://github.com/jendrikseipp/vulture rev: v2.11 diff --git a/pyproject.toml b/pyproject.toml index 2039c89af7a9dd..451735603c7e3f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -307,7 +307,6 @@ ignore = [ # The following rules may cause conflicts when used with the formatter: "ISC001", - ### TODO: Enable gradually # Useless statement "B018", @@ -321,6 +320,48 @@ ignore = [ "RUF007", # mutable-class-default "RUF012", + # Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks + # "E721", + # "F841", + # Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear + "RUF021", + # `__all__` is not sorted + "RUF022", + # Use a `set` literal when testing for membership + "PLR6201", + # Method could be a function, class method, or static method + "PLR6301", + # Too many positional arguments (6/5) + "PLR0917", + # `import` should be at the top-level of a file + "PLC0415", + # Too many public methods (23 > 20) + "PLR0904", + # Too many local variables + "PLR0914", + # Too many nested blocks (6 > 5) + "PLR1702", + # Too many Boolean expressions + "PLR0916", + # Private name import + "PLC2701", + # Redefining argument with the local name + "PLR1704", + # Unnecessary dunder call + "PLC2801", + # Lambda may be unnecessary; consider inlining inner function + # Autofix might not be correct + "PLW0108", + # Object does not implement `__hash__` method + "PLW1641", + # `tempfile.NamedTemporaryFile` in text mode without explicit `encoding` argument + "PLW1514", + # Bad or misspelled dunder method name + "PLW3201", + # Unnecessary lookup of dictionary value by key + "PLR1733", + # Unnecessary lookup of list item by index + "PLR1736" ] exclude = [