Expand the Ruff ALL code

This commit is contained in:
Adam Turner 2023-12-26 03:15:37 +00:00
parent 581eea0a1e
commit f89658d082

View File

@ -152,8 +152,163 @@ external = [ # Whitelist for RUF100 unknown code warnings
"SIM113",
]
select = [
"ALL", # every check supported by Ruff
# nursery rules
# flake8-builtins ('A')
"A001", # Variable `{name}` is shadowing a Python builtin
"A002", # Argument `{name}` is shadowing a Python builtin
"A003", # Class attribute `{name}` is shadowing a Python builtin
# airflow ('AIR')
"AIR001", # Task variable name should match the `task_id`: "{task_id}"
# flake8-annotations ('ANN')
"ANN001", # Missing type annotation for function argument `{name}`
"ANN002", # Missing type annotation for `*{name}`
"ANN003", # Missing type annotation for `**{name}`
"ANN101", # Missing type annotation for `{name}` in method
"ANN102", # Missing type annotation for `{name}` in classmethod
"ANN201", # Missing return type annotation for public function `{name}`
"ANN202", # Missing return type annotation for private function `{name}`
"ANN204", # Missing return type annotation for special method `{name}`
"ANN205", # Missing return type annotation for staticmethod `{name}`
"ANN206", # Missing return type annotation for classmethod `{name}`
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed in `{name}`
# flake8-unused-arguments ('ARG')
"ARG001", # Unused function argument: `{name}`
"ARG002", # Unused method argument: `{name}`
"ARG003", # Unused class method argument: `{name}`
"ARG004", # Unused static method argument: `{name}`
"ARG005", # Unused lambda argument: `{name}`
# flake8-async ('ASYNC')
"ASYNC100", # Async functions should not call blocking HTTP methods
"ASYNC101", # Async functions should not call `open`, `time.sleep`, or `subprocess` methods
"ASYNC102", # Async functions should not call synchronous `os` methods
# flake8-bugbear ('B')
"B002", # Python does not support the unary prefix increment operator (`++`)
"B003", # Assigning to `os.environ` doesn't clear the environment
"B004", # Using `hasattr(x, "__call__")` to test if x is callable is unreliable. Use `callable(x)` for consistent results.
"B005", # Using `.strip()` with multi-character strings is misleading the reader
"B006", # Do not use mutable data structures for argument defaults
"B007", # Loop control variable `{name}` not used within loop body
"B008", # Do not perform function call `{name}` in argument defaults
"B009", # Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
"B010", # Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.
"B011", # Do not `assert False` (`python -O` removes these calls), raise `AssertionError()`
"B012", # `{name}` inside `finally` blocks cause exceptions to be silenced
"B013", # A length-one tuple literal is redundant. Write `except {name}` instead of `except ({name},)`.
"B014", # Exception handler with duplicate exception: `{name}`
"B015", # Pointless comparison. This comparison does nothing but waste CPU instructions. Either prepend `assert` or remove it.
"B016", # Cannot raise a literal. Did you intend to return it or raise an Exception?
"B017", # `{assertion}({exception})` should be considered evil
"B018", # Found useless expression. Either assign it to a variable or remove it.
"B019", # Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
"B020", # Loop control variable `{name}` overrides iterable it iterates
"B021", # f-string used as docstring. Python will interpret this as a joined string, rather than a docstring.
"B022", # No arguments passed to `contextlib.suppress`. No exceptions will be suppressed and therefore this context manager is redundant
"B023", # Function definition does not bind loop variable `{name}`
"B024", # `{name}` is an abstract base class, but it has no abstract methods
"B025", # try-except block with duplicate exception `{name}`
"B026", # Star-arg unpacking after a keyword argument is strongly discouraged
"B027", # `{name}` is an empty method in an abstract base class, but has no abstract decorator
"B028", # No explicit `stacklevel` keyword argument found
"B029", # Using `except ():` with an empty tuple does not catch anything; add exceptions to handle
"B030", # `except` handlers should only be exception classes or tuples of exception classes
"B031", # Using the generator returned from `itertools.groupby()` more than once will do nothing on the second usage
"B032", # Possible unintentional type annotation (using `:`). Did you mean to assign (using `=`)?
"B033", # Sets should not contain duplicate item `{value}`
"B034", # `{method}` should pass `{param_name}` and `flags` as keyword arguments to avoid confusion due to unintuitive argument positions
"B904", # Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
"B905", # `zip()` without an explicit `strict=` parameter
# flake8-blind-except ('BLE')
"BLE001", # Do not catch blind exception: `{name}`
# mccabe ('C')
"C400", # Unnecessary generator (rewrite as a `list` comprehension)
"C401", # Unnecessary generator (rewrite as a `set` comprehension)
"C402", # Unnecessary generator (rewrite as a `dict` comprehension)
"C403", # Unnecessary `list` comprehension (rewrite as a `set` comprehension)
"C404", # Unnecessary `list` comprehension (rewrite as a `dict` comprehension)
"C405", # Unnecessary `{obj_type}` literal (rewrite as a `set` literal)
"C406", # Unnecessary `{obj_type}` literal (rewrite as a `dict` literal)
"C408", # Unnecessary `{obj_type}` call (rewrite as a literal)
"C409", # Unnecessary `{literal}` literal passed to `tuple()` (rewrite as a `tuple` literal)
"C410", # Unnecessary `{literal}` literal passed to `list()` (remove the outer call to `list()`)
"C411", # Unnecessary `list` call (remove the outer call to `list()`)
"C413", # Unnecessary `{func}` call around `sorted()`
"C414", # Unnecessary `{inner}` call within `{outer}()`
"C415", # Unnecessary subscript reversal of iterable within `{func}()`
"C416", # Unnecessary `{obj_type}` comprehension (rewrite using `{obj_type}()`)
"C417", # Unnecessary `map` usage (rewrite using a {object_type})
"C418", # Unnecessary `dict` {kind} passed to `dict()` (remove the outer call to `dict()`)
"C419", # Unnecessary list comprehension.
"C901", # `{name}` is too complex ({complexity} > {max_complexity})
# flake8-commas ('COM')
"COM812", # Trailing comma missing
"COM818", # Trailing comma on bare tuple prohibited
"COM819", # Trailing comma prohibited
# pydocstyle ('D')
"D100", # Missing docstring in public module
"D101", # Missing docstring in public class
"D102", # Missing docstring in public method
"D103", # Missing docstring in public function
"D104", # Missing docstring in public package
"D105", # Missing docstring in magic method
"D106", # Missing docstring in public nested class
"D107", # Missing docstring in `__init__`
"D200", # One-line docstring should fit on one line
"D201", # No blank lines allowed before function docstring (found {num_lines})
"D202", # No blank lines allowed after function docstring (found {num_lines})
"D203", # 1 blank line required before class docstring
"D204", # 1 blank line required after class docstring
"D205", # 1 blank line required between summary line and description
"D206", # Docstring should be indented with spaces, not tabs
"D207", # Docstring is under-indented
"D208", # Docstring is over-indented
"D209", # Multi-line docstring closing quotes should be on a separate line
"D210", # No whitespaces allowed surrounding docstring text
"D211", # No blank lines allowed before class docstring
"D212", # Multi-line docstring summary should start at the first line
"D213", # Multi-line docstring summary should start at the second line
"D214", # Section is over-indented ("{name}")
"D215", # Section underline is over-indented ("{name}")
"D300", # Use triple double quotes `"""`
"D301", # Use `r"""` if any backslashes in a docstring
"D400", # First line should end with a period
"D401", # First line of docstring should be in imperative mood: "{first_line}"
"D402", # First line should not be the function's signature
"D403", # First word of the first line should be capitalized: `{}` -> `{}`
"D404", # First word of the docstring should not be "This"
"D405", # Section name should be properly capitalized ("{name}")
"D406", # Section name should end with a newline ("{name}")
"D407", # Missing dashed underline after section ("{name}")
"D408", # Section underline should be in the line following the section's name ("{name}")
"D409", # Section underline should match the length of its name ("{name}")
"D410", # Missing blank line after section ("{name}")
"D411", # Missing blank line before section ("{name}")
"D412", # No blank lines allowed between a section header and its content ("{name}")
"D413", # Missing blank line after last section ("{name}")
"D414", # Section has no content ("{name}")
"D415", # First line should end with a period, question mark, or exclamation point
"D416", # Section name should end with a colon ("{name}")
"D417", # Missing argument description in the docstring for `{definition}`: `{name}`
"D418", # Function decorated with `@overload` shouldn't contain a docstring
"D419", # Docstring is empty
# flake8-django ('DJ')
"DJ001", # Avoid using `null=True` on string-based fields such as {field_name}
"DJ003", # Avoid passing `locals()` as context to a `render` function
"DJ006", # Do not use `exclude` with `ModelForm`, use `fields` instead
"DJ007", # Do not use `__all__` with `ModelForm`, use `fields` instead
"DJ008", # Model does not define `__str__` method
"DJ012", # Order of model's inner classes, methods, and fields does not follow the Django Style Guide: {element_type} should come before {prev_element_type}
"DJ013", # `@receiver` decorator must be on top of all the other decorators
# flake8-datetimez ('DTZ')
"DTZ001", # The use of `datetime.datetime()` without `tzinfo` argument is not allowed
"DTZ002", # The use of `datetime.datetime.today()` is not allowed, use `datetime.datetime.now(tz=)` instead
"DTZ003", # The use of `datetime.datetime.utcnow()` is not allowed, use `datetime.datetime.now(tz=)` instead
"DTZ004", # The use of `datetime.datetime.utcfromtimestamp()` is not allowed, use `datetime.datetime.fromtimestamp(ts, tz=)` instead
"DTZ005", # The use of `datetime.datetime.now()` without `tz` argument is not allowed
"DTZ006", # The use of `datetime.datetime.fromtimestamp()` without `tz` argument is not allowed
"DTZ007", # The use of `datetime.datetime.strptime()` without %z must be followed by `.replace(tzinfo=)` or `.astimezone()`
"DTZ011", # The use of `datetime.date.today()` is not allowed, use `datetime.datetime.now(tz=).date()` instead
"DTZ012", # The use of `datetime.date.fromtimestamp()` is not allowed, use `datetime.datetime.fromtimestamp(ts, tz=).date()` instead
# pycodestyle ('E')
"E101", # Indentation contains mixed spaces and tabs
"E111", # Indentation is not a multiple of {indent_size}
"E112", # Expected an indented block
"E113", # Unexpected indentation
@ -162,9 +317,8 @@ select = [
"E116", # Unexpected indentation (comment)
"E117", # Over-indented (comment)
"E201", # Whitespace after '{symbol}'
"E201", # Whitespace after '{symbol}'
"E202", # Whitespace before '{symbol}'
"E203", # Whitespace before '{punctuation}'
"E203", # Whitespace before '{symbol}'
"E211", # Whitespace before '{bracket}'
"E221", # Multiple spaces before operator
"E222", # Multiple spaces after operator
@ -177,6 +331,7 @@ select = [
"E231", # Missing whitespace after '{token}'
"E241", # Multiple spaces after comma
"E242", # Tab after comma
"E251", # Unexpected spaces around keyword / parameter equals
"E252", # Missing whitespace around parameter equals
"E261", # Insert at least two spaces before an inline comment
"E262", # Inline comment should start with `# `
@ -187,6 +342,548 @@ select = [
"E273", # Tab after keyword
"E274", # Tab before keyword
"E275", # Missing whitespace after keyword
"E401", # Multiple imports on one line
"E402", # Module level import not at top of file
"E501", # Line too long ({width} > {limit} characters)
"E701", # Multiple statements on one line (colon)
"E702", # Multiple statements on one line (semicolon)
"E703", # Statement ends with an unnecessary semicolon
"E711", # Comparison to `None` should be `cond is None`
"E712", # Comparison to `True` should be `cond is True` or `if cond:`
"E713", # Test for membership should be `not in`
"E714", # Test for object identity should be `is not`
"E721", # Do not compare types, use `isinstance()`
"E722", # Do not use bare `except`
"E731", # Do not assign a `lambda` expression, use a `def`
"E741", # Ambiguous variable name: `{name}`
"E742", # Ambiguous class name: `{name}`
"E743", # Ambiguous function name: `{name}`
"E902", # {message}
"E999", # SyntaxError: {message}
# flake8-errmsg ('EM')
"EM101", # Exception must not use a string literal, assign to variable first
"EM102", # Exception must not use an f-string literal, assign to variable first
"EM103", # Exception must not use a `.format()` string directly, assign to variable first
# eradicate ('ERA')
"ERA001", # Found commented-out code
# flake8-executable ('EXE')
"EXE001", # Shebang is present but file is not executable
"EXE002", # The file is executable but no shebang is present
"EXE003", # Shebang should contain `python`
"EXE004", # Avoid whitespace before shebang
"EXE005", # Shebang should be at the beginning of the file
# pyflakes ('F')
"F401", # `{name}` imported but unused; consider using `importlib.util.find_spec` to test for availability
"F402", # Import `{name}` from line {line} shadowed by loop variable
"F403", # `from {name} import *` used; unable to detect undefined names
"F404", # `from __future__` imports must occur at the beginning of the file
"F405", # `{name}` may be undefined, or defined from star imports
"F406", # `from {name} import *` only allowed at module level
"F407", # Future feature `{name}` is not defined
"F501", # `%`-format string has invalid format string: {message}
"F502", # `%`-format string expected mapping but got sequence
"F503", # `%`-format string expected sequence but got mapping
"F504", # `%`-format string has unused named argument(s): {message}
"F505", # `%`-format string is missing argument(s) for placeholder(s): {message}
"F506", # `%`-format string has mixed positional and named placeholders
"F507", # `%`-format string has {wanted} placeholder(s) but {got} substitution(s)
"F508", # `%`-format string `*` specifier requires sequence
"F509", # `%`-format string has unsupported format character `{char}`
"F521", # `.format` call has invalid format string: {message}
"F522", # `.format` call has unused named argument(s): {message}
"F523", # `.format` call has unused arguments at position(s): {message}
"F524", # `.format` call is missing argument(s) for placeholder(s): {message}
"F525", # `.format` string mixes automatic and manual numbering
"F541", # f-string without any placeholders
"F601", # Dictionary key literal `{name}` repeated
"F602", # Dictionary key `{name}` repeated
"F621", # Too many expressions in star-unpacking assignment
"F622", # Two starred expressions in assignment
"F631", # Assert test is a non-empty tuple, which is always `True`
"F632", # Use `==` to compare constant literals
"F633", # Use of `>>` is invalid with `print` function
"F634", # If test is a tuple, which is always `True`
"F701", # `break` outside loop
"F702", # `continue` not properly in loop
"F704", # `{keyword}` statement outside of a function
"F706", # `return` statement outside of a function/method
"F707", # An `except` block as not the last exception handler
"F722", # Syntax error in forward annotation: `{body}`
"F811", # Redefinition of unused `{name}` from line {line}
"F821", # Undefined name `{name}`
"F822", # Undefined name `{name}` in `__all__`
"F823", # Local variable `{name}` referenced before assignment
"F841", # Local variable `{name}` is assigned to but never used
"F842", # Local variable `{name}` is annotated but never used
"F901", # `raise NotImplemented` should be `raise NotImplementedError`
# flake8-future-annotations ('FA')
"FA100", # Missing `from __future__ import annotations`, but uses `{name}`
"FA102", # Missing `from __future__ import annotations`, but uses {reason}
# flake8-boolean-trap ('FBT')
"FBT001", # Boolean positional arg in function definition
"FBT002", # Boolean default value in function definition
"FBT003", # Boolean positional value in function call
# flake8-fixme ('FIX')
"FIX001", # Line contains FIXME, consider resolving the issue
"FIX002", # Line contains TODO, consider resolving the issue
"FIX003", # Line contains XXX, consider resolving the issue
"FIX004", # Line contains HACK, consider resolving the issue
# flynt ('FLY')
"FLY002", # Consider `{expr}` instead of string join
# flake8-logging-format ('G')
"G001", # Logging statement uses `str.format`
"G002", # Logging statement uses `%`
"G003", # Logging statement uses `+`
"G004", # Logging statement uses f-string
"G010", # Logging statement uses `warn` instead of `warning`
"G101", # Logging statement uses an `extra` field that clashes with a `LogRecord` field: `{key}`
"G201", # Logging `.exception(...)` should be used instead of `.error(..., exc_info=True)`
"G202", # Logging statement has redundant `exc_info`
# isort ('I')
"I001", # Import block is un-sorted or un-formatted
"I002", # Missing required import: `{name}`
# flake8-import-conventions ('ICN')
"ICN001", # `{name}` should be imported as `{asname}`
"ICN002", # `{name}` should not be imported as `{asname}`
"ICN003", # Members of `{name}` should not be imported explicitly
# flake8-no-pep420 ('INP')
"INP001", # File `{filename}` is part of an implicit namespace package. Add an `__init__.py`.
# flake8-gettext ('INT')
"INT001", # f-string is resolved before function call; consider `_("string %s") % arg`
"INT002", # `format` method argument is resolved before function call; consider `_("string %s") % arg`
"INT003", # printf-style format is resolved before function call; consider `_("string %s") % arg`
# flake8-implicit-str-concat ('ISC')
"ISC001", # Implicitly concatenated string literals on one line
"ISC002", # Implicitly concatenated string literals over multiple lines
"ISC003", # Explicitly concatenated string should be implicitly concatenated
# pep8-naming ('N')
"N801", # Class name `{name}` should use CapWords convention
"N802", # Function name `{name}` should be lowercase
"N803", # Argument name `{name}` should be lowercase
"N804", # First argument of a class method should be named `cls`
"N805", # First argument of a method should be named `self`
"N806", # Variable `{name}` in function should be lowercase
"N807", # Function name should not start and end with `__`
"N811", # Constant `{name}` imported as non-constant `{asname}`
"N812", # Lowercase `{name}` imported as non-lowercase `{asname}`
"N813", # Camelcase `{name}` imported as lowercase `{asname}`
"N814", # Camelcase `{name}` imported as constant `{asname}`
"N815", # Variable `{name}` in class scope should not be mixedCase
"N816", # Variable `{name}` in global scope should not be mixedCase
"N817", # CamelCase `{name}` imported as acronym `{asname}`
"N818", # Exception name `{name}` should be named with an Error suffix
"N999", # Invalid module name: '{name}'
# numpy-specific rules ('NPY')
"NPY001", # Type alias `np.{type_name}` is deprecated, replace with builtin type
"NPY002", # Replace legacy `np.random.{method_name}` call with `np.random.Generator`
"NPY003", # `np.{existing}` is deprecated; use `np.{replacement}` instead
# pandas-vet ('PD')
"PD002", # `inplace=True` should be avoided; it has inconsistent behavior
"PD003", # `.isna` is preferred to `.isnull`; functionality is equivalent
"PD004", # `.notna` is preferred to `.notnull`; functionality is equivalent
"PD007", # `.ix` is deprecated; use more explicit `.loc` or `.iloc`
"PD008", # Use `.loc` instead of `.at`. If speed is important, use NumPy.
"PD009", # Use `.iloc` instead of `.iat`. If speed is important, use NumPy.
"PD010", # `.pivot_table` is preferred to `.pivot` or `.unstack`; provides same functionality
"PD011", # Use `.to_numpy()` instead of `.values`
"PD012", # Use `.read_csv` instead of `.read_table` to read CSV files
"PD013", # `.melt` is preferred to `.stack`; provides same functionality
"PD015", # Use `.merge` method instead of `pd.merge` function. They have equivalent functionality.
"PD101", # Using `series.nunique()` for checking that a series is constant is inefficient
"PD901", # `df` is a bad variable name. Be kinder to your future self.
# perflint ('PERF')
"PERF101", # Do not cast an iterable to `list` before iterating over it
"PERF102", # When using only the {subset} of a dict use the `{subset}()` method
"PERF203", # `try`-`except` within a loop incurs performance overhead
"PERF401", # Use a list comprehension to create a transformed list
"PERF402", # Use `list` or `list.copy` to create a copy of a list
# pygrep-hooks ('PGH')
"PGH001", # No builtin `eval()` allowed
"PGH002", # `warn` is deprecated in favor of `warning`
"PGH003", # Use specific rule codes when ignoring type issues
"PGH004", # Use specific rule codes when using `noqa`
"PGH005", # Mock method should be called: `{name}`
# flake8-pie ('PIE')
"PIE790", # Unnecessary `pass` statement
"PIE794", # Class field `{name}` is defined multiple times
"PIE796", # Enum contains duplicate value: `{value}`
"PIE800", # Unnecessary spread `**`
"PIE804", # Unnecessary `dict` kwargs
"PIE807", # Prefer `list` over useless lambda
"PIE810", # Call `{attr}` once with a `tuple`
# pylint ('PLC')
"PLC0105", # `{kind}` name "{param_name}" does not reflect its {variance}; consider renaming it to "{replacement_name}"
"PLC0131", # `{kind}` cannot be both covariant and contravariant
"PLC0132", # `{kind}` name `{param_name}` does not match assigned variable name `{var_name}`
"PLC0205", # Class `__slots__` should be a non-string iterable
"PLC0208", # Use a sequence type instead of a `set` when iterating over values
"PLC0414", # Import alias does not rename original package
"PLC3002", # Lambda expression called directly. Execute the expression inline instead.
# pylint ('PLE')
"PLE0100", # `__init__` method is a generator
"PLE0101", # Explicit return in `__init__`
"PLE0116", # `continue` not supported inside `finally` clause
"PLE0117", # Nonlocal name `{name}` found without binding
"PLE0118", # Name `{name}` is used prior to global declaration on line {line}
"PLE0241", # Duplicate base `{base}` for class `{class}`
"PLE0302", # The special method `{}` expects {}, {} {} given
"PLE0307", # `__str__` does not return `str`
"PLE0604", # Invalid object in `__all__`, must contain only strings
"PLE0605", # Invalid format for `__all__`, must be `tuple` or `list`
"PLE1142", # `await` should be used within an async function
"PLE1205", # Too many arguments for `logging` format string
"PLE1206", # Not enough arguments for `logging` format string
"PLE1300", # Unsupported format character '{}'
"PLE1307", # Format type does not match argument type
"PLE1310", # String `{strip}` call contains duplicate characters (did you mean `{removal}`?)
"PLE1507", # Invalid type for initial `os.getenv` argument; expected `str`
"PLE1700", # `yield from` statement in async function; use `async for` instead
"PLE2502", # Contains control characters that can permit obfuscated code
"PLE2510", # Invalid unescaped character backspace, use "\b" instead
"PLE2512", # Invalid unescaped character SUB, use "\x1A" instead
"PLE2513", # Invalid unescaped character ESC, use "\x1B" instead
"PLE2514", # Invalid unescaped character NUL, use "\0" instead
"PLE2515", # Invalid unescaped character zero-width-space, use "\u200B" instead
# pylint ('PLR')
"PLR0124", # Name compared with itself, consider replacing `{left} {} {right}`
"PLR0133", # Two constants compared in a comparison, consider replacing `{left_constant} {} {right_constant}`
"PLR0206", # Cannot have defined parameters for properties
"PLR0402", # Use `from {module} import {name}` in lieu of alias
"PLR0911", # Too many return statements ({returns} > {max_returns})
"PLR0912", # Too many branches ({branches} > {max_branches})
"PLR0913", # Too many arguments to function call ({c_args} > {max_args})
"PLR0915", # Too many statements ({statements} > {max_statements})
"PLR1701", # Merge `isinstance` calls: `{expr}`
"PLR1711", # Useless `return` statement at end of function
"PLR1714", # Consider merging multiple comparisons: `{expr}`. Use a `set` if the elements are hashable.
"PLR1722", # Use `sys.exit()` instead of `{name}`
"PLR2004", # Magic value used in comparison, consider replacing {value} with a constant variable
"PLR5501", # Use `elif` instead of `else` then `if`, to reduce indentation
# pylint ('PLW')
"PLW0120", # `else` clause on loop without a `break` statement; remove the `else` and de-indent all the code inside it
"PLW0127", # Self-assignment of variable `{name}`
"PLW0129", # Asserting on an empty string literal will never pass
"PLW0131", # Named expression used without context
"PLW0406", # Module `{name}` imports itself
"PLW0602", # Using global for `{name}` but no assignment is done
"PLW0603", # Using the global statement to update `{name}` is discouraged
"PLW0711", # Exception to catch is the result of a binary `and` operation
"PLW1508", # Invalid type for environment variable default; expected `str` or `None`
"PLW1509", # `preexec_fn` argument is unsafe when using threads
"PLW2901", # Outer {outer_kind} variable `{name}` overwritten by inner {inner_kind} target
"PLW3301", # Nested `{}` calls can be flattened
# flake8-pytest-style ('PT')
"PT001", # Use `@pytest.fixture{expected}` over `@pytest.fixture{actual}`
"PT002", # Configuration for fixture `{function}` specified via positional args, use kwargs
"PT003", # `scope='function'` is implied in `@pytest.fixture()`
"PT004", # Fixture `{function}` does not return anything, add leading underscore
"PT005", # Fixture `{function}` returns a value, remove leading underscore
"PT006", # Wrong name(s) type in `@pytest.mark.parametrize`, expected `{expected}`
"PT007", # Wrong values type in `@pytest.mark.parametrize` expected `{values}` of `{row}`
"PT008", # Use `return_value=` instead of patching with `lambda`
"PT009", # Use a regular `assert` instead of unittest-style `{assertion}`
"PT010", # set the expected exception in `pytest.raises()`
"PT011", # `pytest.raises({exception})` is too broad, set the `match` parameter or use a more specific exception
"PT012", # `pytest.raises()` block should contain a single simple statement
"PT013", # Found incorrect import of pytest, use simple `import pytest` instead
"PT015", # Assertion always fails, replace with `pytest.fail()`
"PT016", # No message passed to `pytest.fail()`
"PT017", # Found assertion on exception `{name}` in `except` block, use `pytest.raises()` instead
"PT018", # Assertion should be broken down into multiple parts
"PT019", # Fixture `{name}` without value is injected as parameter, use `@pytest.mark.usefixtures` instead
"PT020", # `@pytest.yield_fixture` is deprecated, use `@pytest.fixture`
"PT021", # Use `yield` instead of `request.addfinalizer`
"PT022", # No teardown in fixture `{name}`, use `return` instead of `yield`
"PT023", # Use `@pytest.mark.{mark_name}{expected_parens}` over `@pytest.mark.{mark_name}{actual_parens}`
"PT024", # `pytest.mark.asyncio` is unnecessary for fixtures
"PT025", # `pytest.mark.usefixtures` has no effect on fixtures
"PT026", # Useless `pytest.mark.usefixtures` without parameters
# flake8-use-pathlib ('PTH')
"PTH100", # `os.path.abspath()` should be replaced by `Path.resolve()`
"PTH101", # `os.chmod()` should be replaced by `Path.chmod()`
"PTH102", # `os.mkdir()` should be replaced by `Path.mkdir()`
"PTH103", # `os.makedirs()` should be replaced by `Path.mkdir(parents=True)`
"PTH104", # `os.rename()` should be replaced by `Path.rename()`
"PTH105", # `os.replace()` should be replaced by `Path.replace()`
"PTH106", # `os.rmdir()` should be replaced by `Path.rmdir()`
"PTH107", # `os.remove()` should be replaced by `Path.unlink()`
"PTH108", # `os.unlink()` should be replaced by `Path.unlink()`
"PTH109", # `os.getcwd()` should be replaced by `Path.cwd()`
"PTH110", # `os.path.exists()` should be replaced by `Path.exists()`
"PTH111", # `os.path.expanduser()` should be replaced by `Path.expanduser()`
"PTH112", # `os.path.isdir()` should be replaced by `Path.is_dir()`
"PTH113", # `os.path.isfile()` should be replaced by `Path.is_file()`
"PTH114", # `os.path.islink()` should be replaced by `Path.is_symlink()`
"PTH115", # `os.readlink()` should be replaced by `Path.readlink()`
"PTH116", # `os.stat()` should be replaced by `Path.stat()`, `Path.owner()`, or `Path.group()`
"PTH117", # `os.path.isabs()` should be replaced by `Path.is_absolute()`
"PTH118", # `os.{module}.join()` should be replaced by `Path` with `/` operator
"PTH119", # `os.path.basename()` should be replaced by `Path.name`
"PTH120", # `os.path.dirname()` should be replaced by `Path.parent`
"PTH121", # `os.path.samefile()` should be replaced by `Path.samefile()`
"PTH122", # `os.path.splitext()` should be replaced by `Path.suffix`
"PTH123", # `open()` should be replaced by `Path.open()`
"PTH124", # `py.path` is in maintenance mode, use `pathlib` instead
"PTH201", # Do not pass the current directory explicitly to `Path`
"PTH202", # `os.path.getsize` should be replaced by `Path.stat().st_size`
"PTH203", # `os.path.getatime` should be replaced by `Path.stat().st_atime`
"PTH204", # `os.path.getmtime` should be replaced by `Path.stat().st_mtime`
"PTH205", # `os.path.getctime` should be replaced by `Path.stat().st_ctime`
"PTH206", # Replace `.split(os.sep)` with `Path.parts`
"PTH207", # Replace `{function}` with `Path.glob` or `Path.rglob`
# flake8-pyi ('PYI')
"PYI001", # Name of private `{kind}` must start with `_`
"PYI002", # `if` test must be a simple comparison against `sys.platform` or `sys.version_info`
"PYI003", # Unrecognized `sys.version_info` check
"PYI004", # Version comparison must use only major and minor version
"PYI005", # Version comparison must be against a length-{expected_length} tuple
"PYI006", # Use `<` or `>=` for `sys.version_info` comparisons
"PYI007", # Unrecognized `sys.platform` check
"PYI008", # Unrecognized platform `{platform}`
"PYI009", # Empty body should contain `...`, not `pass`
"PYI010", # Function body must contain only `...`
"PYI011", # Only simple default values allowed for typed arguments
"PYI012", # Class body must not contain `pass`
"PYI013", # Non-empty class body must not contain `...`
"PYI014", # Only simple default values allowed for arguments
"PYI015", # Only simple default values allowed for assignments
"PYI016", # Duplicate union member `{}`
"PYI017", # Stubs should not contain assignments to attributes or multiple targets
"PYI018", # Private TypeVar `{name}` is never used
"PYI019", # Methods like `{method_name}` should return `typing.Self` instead of a custom `TypeVar`
"PYI020", # Quoted annotations should not be included in stubs
"PYI021", # Docstrings should not be included in stubs
"PYI024", # Use `typing.NamedTuple` instead of `collections.namedtuple`
"PYI025", # Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin
"PYI026", # Use `typing.TypeAlias` for type alias, e.g., `{name}: typing.TypeAlias = {value}`
"PYI029", # Defining `{name}` in a stub is almost always redundant
"PYI030", # Multiple literal members in a union. Use a single literal, e.g. `Literal[{}]`
"PYI032", # Prefer `object` to `Any` for the second parameter to `{method_name}`
"PYI033", # Don't use type comments in stub file
"PYI034", # `__new__` methods usually return `self` at runtime
"PYI035", # `{name}` in a stub file must have a value, as it has the same semantics as `{name}` at runtime
"PYI036", # Star-args in `{method_name}` should be annotated with `object`
"PYI041", # Use `{supertype}` instead of `{subtype} | {supertype}`
"PYI042", # Type alias `{name}` should be CamelCase
"PYI043", # Private type alias `{name}` should not be suffixed with `T` (the `T` suffix implies that an object is a `TypeVar`)
"PYI044", # `from __future__ import annotations` has no effect in stub files, since type checkers automatically treat stubs as having those semantics
"PYI045", # `__aiter__` methods should return an `AsyncIterator`, not an `AsyncIterable`
"PYI046", # Private protocol `{name}` is never used
"PYI047", # Private TypeAlias `{name}` is never used
"PYI048", # Function body must contain exactly one statement
"PYI049", # Private TypedDict `{name}` is never used
"PYI050", # Prefer `{module}.Never` over `NoReturn` for argument annotations
"PYI051", # `Literal[{literal}]` is redundant in a union with `{builtin_type}`
"PYI052", # Need type annotation for `{name}`
"PYI053", # String and bytes literals longer than 50 characters are not permitted
"PYI054", # Numeric literals with a string representation longer than ten characters are not permitted
"PYI055", # Multiple `type` members in a union. Combine them into one, e.g., `type[{union_str}]`.
"PYI056", # Calling `.{name}()` on `__all__` may not be supported by all type checkers (use `+=` instead)
# flake8-quotes ('Q')
"Q000", # Single quotes found but double quotes preferred
"Q001", # Single quote multiline found but double quotes preferred
"Q002", # Single quote docstring found but double quotes preferred
"Q003", # Change outer quotes to avoid escaping inner quotes
# flake8-return ('RET')
"RET501", # Do not explicitly `return None` in function if it is the only possible return value
"RET502", # Do not implicitly `return None` in function able to return non-`None` value
"RET503", # Missing explicit `return` at the end of function able to return non-`None` value
"RET504", # Unnecessary assignment to `{name}` before `return` statement
"RET505", # Unnecessary `{branch}` after `return` statement
"RET506", # Unnecessary `{branch}` after `raise` statement
"RET507", # Unnecessary `{branch}` after `continue` statement
"RET508", # Unnecessary `{branch}` after `break` statement
# flake8-raise ('RSE')
"RSE102", # Unnecessary parentheses on raised exception
# ruff-specific rules ('RUF')
"RUF001", # String contains ambiguous {}. Did you mean {}?
"RUF002", # Docstring contains ambiguous {}. Did you mean {}?
"RUF003", # Comment contains ambiguous {}. Did you mean {}?
"RUF005", # Consider `{expr}` instead of concatenation
"RUF006", # Store a reference to the return value of `asyncio.{method}`
"RUF007", # Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs
"RUF008", # Do not use mutable default values for dataclass attributes
"RUF009", # Do not perform function call `{name}` in dataclass defaults
"RUF010", # Use explicit conversion flag
"RUF011", # Dictionary comprehension uses static key: `{key}`
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
"RUF013", # PEP 484 prohibits implicit `Optional`
"RUF015", # Prefer `next({iterable})` over single element slice
"RUF016", # Slice in indexed access to type `{value_type}` uses type `{index_type}` instead of an integer.
"RUF100", # Unused `noqa` directive
"RUF200", # Failed to parse pyproject.toml: {}
# flake8-bandit ('S')
"S101", # Use of `assert` detected
"S102", # Use of `exec` detected
"S103", # `os.chmod` setting a permissive mask `{mask:#o}` on file or directory
"S104", # Possible binding to all interfaces
"S105", # Possible hardcoded password assigned to: "{}"
"S106", # Possible hardcoded password assigned to argument: "{}"
"S107", # Possible hardcoded password assigned to function default: "{}"
"S108", # Probable insecure usage of temporary file or directory: "{}"
"S110", # `try`-`except`-`pass` detected, consider logging the exception
"S112", # `try`-`except`-`continue` detected, consider logging the exception
"S113", # Probable use of requests call without timeout
"S301", # `pickle` and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue
"S302", # Deserialization with the `marshal` module is possibly dangerous
"S303", # Use of insecure MD2, MD4, MD5, or SHA1 hash function
"S304", # Use of insecure cipher, replace with a known secure cipher such as AES
"S305", # Use of insecure cipher mode, replace with a known secure cipher such as AES
"S306", # Use of insecure and deprecated function (`mktemp`)
"S307", # Use of possibly insecure function; consider using `ast.literal_eval`
"S308", # Use of `mark_safe` may expose cross-site scripting vulnerabilities
"S310", # Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
"S312", # Telnet-related functions are being called. Telnet is considered insecure. Use SSH or some other encrypted protocol.
"S313", # Using `xml` to parse untrusted data is known to be vulnerable to XML attacks; use `defusedxml` equivalents
"S314", # Using `xml` to parse untrusted data is known to be vulnerable to XML attacks; use `defusedxml` equivalents
"S315", # Using `xml` to parse untrusted data is known to be vulnerable to XML attacks; use `defusedxml` equivalents
"S316", # Using `xml` to parse untrusted data is known to be vulnerable to XML attacks; use `defusedxml` equivalents
"S317", # Using `xml` to parse untrusted data is known to be vulnerable to XML attacks; use `defusedxml` equivalents
"S318", # Using `xml` to parse untrusted data is known to be vulnerable to XML attacks; use `defusedxml` equivalents
"S319", # Using `xml` to parse untrusted data is known to be vulnerable to XML attacks; use `defusedxml` equivalents
"S320", # Using `lxml` to parse untrusted data is known to be vulnerable to XML attacks
"S321", # FTP-related functions are being called. FTP is considered insecure. Use SSH/SFTP/SCP or some other encrypted protocol.
"S323", # Python allows using an insecure context via the `_create_unverified_context` that reverts to the previous behavior that does not validate certificates or perform hostname checks.
"S324", # Probable use of insecure hash functions in `hashlib`: `{string}`
"S501", # Probable use of `{string}` call with `verify=False` disabling SSL certificate checks
"S506", # Probable use of unsafe loader `{name}` with `yaml.load`. Allows instantiation of arbitrary objects. Consider `yaml.safe_load`.
"S508", # The use of SNMPv1 and SNMPv2 is insecure. Use SNMPv3 if able.
"S509", # You should not use SNMPv3 without encryption. `noAuthNoPriv` & `authNoPriv` is insecure.
"S601", # Possible shell injection via Paramiko call; check inputs are properly sanitized
"S602", # `subprocess` call with `shell=True` seems safe, but may be changed in the future; consider rewriting without `shell`
"S603", # `subprocess` call: check for execution of untrusted input
"S604", # Function call with `shell=True` parameter identified, security issue
"S605", # Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell`
"S606", # Starting a process without a shell
"S607", # Starting a process with a partial executable path
"S608", # Possible SQL injection vector through string-based query construction
"S609", # Possible wildcard injection in call due to `*` usage
"S612", # Use of insecure `logging.config.listen` detected
"S701", # Using jinja2 templates with `autoescape=False` is dangerous and can lead to XSS. Ensure `autoescape=True` or use the `select_autoescape` function.
# flake8-simplify ('SIM')
"SIM101", # Multiple `isinstance` calls for `{name}`, merge into a single call
"SIM102", # Use a single `if` statement instead of nested `if` statements
"SIM103", # Return the condition `{condition}` directly
"SIM105", # Use `contextlib.suppress({exception})` instead of `try`-`except`-`pass`
"SIM107", # Don't use `return` in `try`-`except` and `finally`
"SIM108", # Use ternary operator `{contents}` instead of `if`-`else`-block
"SIM109", # Use `{replacement}` instead of multiple equality comparisons
"SIM110", # Use `{replacement}` instead of `for` loop
"SIM112", # Use capitalized environment variable `{expected}` instead of `{original}`
"SIM114", # Combine `if` branches using logical `or` operator
"SIM115", # Use context handler for opening files
"SIM116", # Use a dictionary instead of consecutive `if` statements
"SIM117", # Use a single `with` statement with multiple contexts instead of nested `with` statements
"SIM118", # Use `{key} {operator} {dict}` instead of `{key} {operator} {dict}.keys()`
"SIM201", # Use `{left} != {right}` instead of `not {left} == {right}`
"SIM202", # Use `{left} == {right}` instead of `not {left} != {right}`
"SIM208", # Use `{expr}` instead of `not (not {expr})`
"SIM210", # Use `bool({expr})` instead of `True if {expr} else False`
"SIM211", # Use `not {expr}` instead of `False if {expr} else True`
"SIM212", # Use `{expr_else} if {expr_else} else {expr_body}` instead of `{expr_body} if not {expr_else} else {expr_else}`
"SIM220", # Use `False` instead of `{name} and not {name}`
"SIM221", # Use `True` instead of `{name} or not {name}`
"SIM222", # Use `{expr}` instead of `{replaced}`
"SIM223", # Use `{expr}` instead of `{replaced}`
"SIM300", # Yoda conditions are discouraged, use `{suggestion}` instead
"SIM401", # Use `{contents}` instead of an `if` block
"SIM910", # Use `{expected}` instead of `{original}`
# flake8-self ('SLF')
"SLF001", # Private member accessed: `{access}`
# flake8-slots ('SLOT')
"SLOT000", # Subclasses of `str` should define `__slots__`
"SLOT001", # Subclasses of `tuple` should define `__slots__`
"SLOT002", # Subclasses of `collections.namedtuple()` should define `__slots__`
# flake8-print ('T')
"T100", # Trace found: `{name}` used
"T201", # `print` found
"T203", # `pprint` found
# flake8-type-checking ('TCH')
"TCH001", # Move application import `{}` into a type-checking block
"TCH002", # Move third-party import `{}` into a type-checking block
"TCH003", # Move standard library import `{}` into a type-checking block
"TCH004", # Move import `{qualified_name}` out of type-checking block. Import is used for more than type hinting.
"TCH005", # Found empty type-checking block
# flake8-todos ('TD')
"TD001", # Invalid TODO tag: `{tag}`
"TD002", # Missing author in TODO; try: `# TODO(<author_name>): ...` or `# TODO @<author_name>: ...`
"TD003", # Missing issue link on the line following this TODO
"TD004", # Missing colon in TODO
"TD005", # Missing issue description after `TODO`
"TD006", # Invalid TODO capitalization: `{tag}` should be `TODO`
"TD007", # Missing space after colon in TODO
# flake8-tidy-imports ('TID')
"TID251", # `{name}` is banned: {message}
"TID252", # Relative imports from parent modules are banned
# tryceratops ('TRY')
"TRY002", # Create your own exception
"TRY003", # Avoid specifying long messages outside the exception class
"TRY004", # Prefer `TypeError` exception for invalid type
"TRY200", # Use `raise from` to specify exception cause
"TRY201", # Use `raise` without specifying exception name
"TRY300", # Consider moving this statement to an `else` block
"TRY301", # Abstract `raise` to an inner function
"TRY302", # Remove exception handler; error is immediately re-raised
"TRY400", # Use `logging.exception` instead of `logging.error`
"TRY401", # Redundant exception object included in `logging.exception` call
# pyupgrade ('UP')
"UP001", # `__metaclass__ = type` is implied
"UP003", # Use `{}` instead of `type(...)`
"UP004", # Class `{name}` inherits from `object`
"UP005", # `{alias}` is deprecated, use `{target}`
"UP006", # Use `{to}` instead of `{from}` for type annotation
"UP007", # Use `X | Y` for type annotations
"UP008", # Use `super()` instead of `super(__class__, self)`
"UP009", # UTF-8 encoding declaration is unnecessary
"UP010", # Unnecessary `__future__` import `{import}` for target Python version
"UP011", # Unnecessary parentheses to `functools.lru_cache`
"UP012", # Unnecessary call to `encode` as UTF-8
"UP013", # Convert `{name}` from `TypedDict` functional to class syntax
"UP014", # Convert `{name}` from `NamedTuple` functional to class syntax
"UP015", # Unnecessary open mode parameters
"UP017", # Use `datetime.UTC` alias
"UP018", # Unnecessary `{literal_type}` call (rewrite as a literal)
"UP019", # `typing.Text` is deprecated, use `str`
"UP020", # Use builtin `open`
"UP021", # `universal_newlines` is deprecated, use `text`
"UP022", # Sending `stdout` and `stderr` to `PIPE` is deprecated, use `capture_output`
"UP023", # `cElementTree` is deprecated, use `ElementTree`
"UP024", # Replace aliased errors with `OSError`
"UP025", # Remove unicode literals from strings
"UP026", # `mock` is deprecated, use `unittest.mock`
"UP027", # Replace unpacked list comprehension with a generator expression
"UP028", # Replace `yield` over `for` loop with `yield from`
"UP029", # Unnecessary builtin import: `{import}`
"UP030", # Use implicit references for positional format fields
"UP031", # Use format specifiers instead of percent format
"UP032", # Use f-string instead of `format` call
"UP033", # Use `@functools.cache` instead of `@functools.lru_cache(maxsize=None)`
"UP034", # Avoid extraneous parentheses
"UP035", # Import from `{target}` instead: {names}
"UP036", # Version block is outdated for minimum Python version
"UP037", # Remove quotes from type annotation
"UP038", # Use `X | Y` in `{}` call instead of `(X, Y)`
"UP039", # Unnecessary parentheses after class definition
"UP040", # Type alias `{name}` uses `TypeAlias` annotation instead of the `type` keyword
# pycodestyle ('W')
"W191", # Indentation contains tabs
"W291", # Trailing whitespace
"W292", # No newline at end of file
"W293", # Blank line contains whitespace
"W505", # Doc line too long ({width} > {limit} characters)
"W605", # Invalid escape sequence: `\{char}`
# flake8-2020 ('YTT')
"YTT101", # `sys.version[:3]` referenced (python3.10), use `sys.version_info`
"YTT102", # `sys.version[2]` referenced (python3.10), use `sys.version_info`
"YTT103", # `sys.version` compared to string (python3.10), use `sys.version_info`
"YTT201", # `sys.version_info[0] == 3` referenced (python4), use `>=`
"YTT202", # `six.PY3` referenced (python4), use `not six.PY2`
"YTT203", # `sys.version_info[1]` compared to integer (python4), compare `sys.version_info` to tuple
"YTT204", # `sys.version_info.minor` compared to integer (python4), compare `sys.version_info` to tuple
"YTT301", # `sys.version[0]` referenced (python10), use `sys.version_info`
"YTT302", # `sys.version` compared to string (python10), use `sys.version_info`
"YTT303", # `sys.version[:1]` referenced (python10), use `sys.version_info`
]
[per-file-ignores]