From 31e0312e5f32675a668041245bf6b50c65a0134a Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Sat, 19 Oct 2024 00:54:00 +0100 Subject: [PATCH] Enable the entire PLR category in Ruff --- .ruff.toml | 48 +++++++++++++++++++----------------------------- 1 file changed, 19 insertions(+), 29 deletions(-) diff --git a/.ruff.toml b/.ruff.toml index 7287b02c167..2f698b28255 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -43,6 +43,24 @@ ignore = [ "PLC2701", # Private name import `{name}` from external module `{module}` # pylint ('PLE') "PLE0704", # Bare `raise` statement is not inside an exception handler + # pylint ('PLR') + "PLR0124", # Name compared with itself, consider replacing `{actual}` + "PLR0904", # Too many public methods ({methods} > {max_methods}) + "PLR0911", # Too many return statements ({returns} > {max_returns}) + "PLR0912", # Too many branches ({branches} > {max_branches}) + "PLR0913", # Too many arguments in function definition ({c_args} > {max_args}) + "PLR0914", # Too many local variables ({current_amount}/{max_amount}) + "PLR0915", # Too many statements ({statements} > {max_statements}) + "PLR0916", # Too many Boolean expressions ({expressions} > {max_expressions}) + "PLR0917", # Too many positional arguments ({c_pos}/{max_pos}) + "PLR1702", # Too many nested blocks ({nested_blocks} > {max_nested_blocks}) + "PLR1704", # Redefining argument with the local name `{name}` + "PLR1714", # Consider merging multiple comparisons: `{expression}`. Use a `set` if the elements are hashable. + "PLR2004", # Magic value used in comparison, consider replacing `{value}` with a constant variable + "PLR5501", # Use `elif` instead of `else` then `if`, to reduce indentation + "PLR6104", # Use `{operator}` to perform an augmented assignment directly + "PLR6201", # Use a set literal when testing for membership + "PLR6301", # Method `{method_name}` could be a function, class method, or static method # flake8-simplify "SIM102", # Use a single `if` statement instead of nested `if` statements "SIM108", # Use ternary operator `{contents}` instead of `if`-`else`-block @@ -180,35 +198,7 @@ select = [ # pylint ('PLE') "PLE", # pylint ('PLR') -# "PLR0124", # Name compared with itself, consider replacing `{actual}` - "PLR0133", # Two constants compared in a comparison, consider replacing `{left_constant} {op} {right_constant}` - "PLR0202", # Class method defined without decorator - "PLR0203", # Static method defined without decorator - "PLR0206", # Cannot have defined parameters for properties - "PLR0402", # Use `from {module} import {name}` in lieu of alias -# "PLR0904", # Too many public methods ({methods} > {max_methods}) -# "PLR0911", # Too many return statements ({returns} > {max_returns}) -# "PLR0912", # Too many branches ({branches} > {max_branches}) -# "PLR0913", # Too many arguments in function definition ({c_args} > {max_args}) -# "PLR0914", # Too many local variables ({current_amount}/{max_amount}) -# "PLR0915", # Too many statements ({statements} > {max_statements}) -# "PLR0916", # Too many Boolean expressions ({expressions} > {max_expressions}) -# "PLR0917", # Too many positional arguments ({c_pos}/{max_pos}) -# "PLR1702", # Too many nested blocks ({nested_blocks} > {max_nested_blocks}) -# "PLR1704", # Redefining argument with the local name `{name}` - "PLR1711", # Useless `return` statement at end of function -# "PLR1714", # Consider merging multiple comparisons: `{expression}`. Use a `set` if the elements are hashable. - "PLR1716", # Contains chained boolean comparison that can be simplified - "PLR1722", # Use `sys.exit()` instead of `{name}` - "PLR1730", # Replace `if` statement with `{replacement}` - "PLR1733", # Unnecessary lookup of dictionary value by key - "PLR1736", # List index lookup in `enumerate()` loop -# "PLR2004", # Magic value used in comparison, consider replacing `{value}` with a constant variable - "PLR2044", # Line with empty comment -# "PLR5501", # Use `elif` instead of `else` then `if`, to reduce indentation -# "PLR6104", # Use `{operator}` to perform an augmented assignment directly -# "PLR6201", # Use a set literal when testing for membership -# "PLR6301", # Method `{method_name}` could be a function, class method, or static method + "PLR", # pylint ('PLW') # "PLW0108", # Lambda may be unnecessary; consider inlining inner function "PLW0120", # `else` clause on loop without a `break` statement; remove the `else` and dedent its contents