Rules
Ruff supports over 800 lint rules, many of which are inspired by popular tools like Flake8, isort, pyupgrade, and others. Regardless of the rule's origin, Ruff re-implements every rule in Rust as a first-party feature.
By default, Ruff enables Flake8's F
rules, along with a subset of the E
rules, omitting any
stylistic rules that overlap with the use of a formatter, like ruff format
or
Black.
If you're just getting started with Ruff, the default rule set is a great place to start: it catches a wide variety of common errors (like unused imports) with zero configuration.
Legend
โ๏ธ The rule is stable.
๐งช The rule is unstable and is in "preview".
โ ๏ธ The rule has been deprecated and will be removed in a future release.
โ The rule has been removed only the documentation is available.
๐ ๏ธ The rule is automatically fixable by the --fix
command-line option.
Pyflakes (F)
For more, see Pyflakes on PyPI.
Code | Name | Message | |
---|---|---|---|
F401 | unused-import | {name} imported but unused; consider using importlib.util.find_spec to test for availability |
โ๏ธ ๐ ๏ธ |
F402 | import-shadowed-by-loop-var | Import {name} from {row} shadowed by loop variable |
โ๏ธ |
F403 | undefined-local-with-import-star | from {name} import * used; unable to detect undefined names |
โ๏ธ |
F404 | late-future-import | from __future__ imports must occur at the beginning of the file |
โ๏ธ |
F405 | undefined-local-with-import-star-usage | {name} may be undefined, or defined from star imports |
โ๏ธ |
F406 | undefined-local-with-nested-import-star-usage | from {name} import * only allowed at module level |
โ๏ธ |
F407 | future-feature-not-defined | Future feature {name} is not defined |
โ๏ธ |
F501 | percent-format-invalid-format | % -format string has invalid format string: {message} |
โ๏ธ |
F502 | percent-format-expected-mapping | % -format string expected mapping but got sequence |
โ๏ธ |
F503 | percent-format-expected-sequence | % -format string expected sequence but got mapping |
โ๏ธ |
F504 | percent-format-extra-named-arguments | % -format string has unused named argument(s): {message} |
โ๏ธ ๐ ๏ธ |
F505 | percent-format-missing-argument | % -format string is missing argument(s) for placeholder(s): {message} |
โ๏ธ |
F506 | percent-format-mixed-positional-and-named | % -format string has mixed positional and named placeholders |
โ๏ธ |
F507 | percent-format-positional-count-mismatch | % -format string has {wanted} placeholder(s) but {got} substitution(s) |
โ๏ธ |
F508 | percent-format-star-requires-sequence | % -format string * specifier requires sequence |
โ๏ธ |
F509 | percent-format-unsupported-format-character | % -format string has unsupported format character {char} |
โ๏ธ |
F521 | string-dot-format-invalid-format | .format call has invalid format string: {message} |
โ๏ธ |
F522 | string-dot-format-extra-named-arguments | .format call has unused named argument(s): {message} |
โ๏ธ ๐ ๏ธ |
F523 | string-dot-format-extra-positional-arguments | .format call has unused arguments at position(s): {message} |
โ๏ธ ๐ ๏ธ |
F524 | string-dot-format-missing-arguments | .format call is missing argument(s) for placeholder(s): {message} |
โ๏ธ |
F525 | string-dot-format-mixing-automatic | .format string mixes automatic and manual numbering |
โ๏ธ |
F541 | f-string-missing-placeholders | f-string without any placeholders | โ๏ธ ๐ ๏ธ |
F601 | multi-value-repeated-key-literal | Dictionary key literal {name} repeated |
โ๏ธ ๐ ๏ธ |
F602 | multi-value-repeated-key-variable | Dictionary key {name} repeated |
โ๏ธ ๐ ๏ธ |
F621 | expressions-in-star-assignment | Too many expressions in star-unpacking assignment | โ๏ธ |
F622 | multiple-starred-expressions | Two starred expressions in assignment | โ๏ธ |
F631 | assert-tuple | Assert test is a non-empty tuple, which is always True |
โ๏ธ |
F632 | is-literal | Use == to compare constant literals |
โ๏ธ ๐ ๏ธ |
F633 | invalid-print-syntax | Use of >> is invalid with print function |
โ๏ธ |
F634 | if-tuple | If test is a tuple, which is always True |
โ๏ธ |
F701 | break-outside-loop | break outside loop |
โ๏ธ |
F702 | continue-outside-loop | continue not properly in loop |
โ๏ธ |
F704 | yield-outside-function | {keyword} statement outside of a function |
โ๏ธ |
F706 | return-outside-function | return statement outside of a function/method |
โ๏ธ |
F707 | default-except-not-last | An except block as not the last exception handler |
โ๏ธ |
F722 | forward-annotation-syntax-error | Syntax error in forward annotation: {body} |
โ๏ธ |
F811 | redefined-while-unused | Redefinition of unused {name} from {row} |
โ๏ธ ๐ ๏ธ |
F821 | undefined-name | Undefined name {name} . {tip} |
โ๏ธ |
F822 | undefined-export | Undefined name {name} in __all__ |
โ๏ธ |
F823 | undefined-local | Local variable {name} referenced before assignment |
โ๏ธ |
F841 | unused-variable | Local variable {name} is assigned to but never used |
โ๏ธ ๐ ๏ธ |
F842 | unused-annotation | Local variable {name} is annotated but never used |
โ๏ธ |
F901 | raise-not-implemented | raise NotImplemented should be raise NotImplementedError |
โ๏ธ ๐ ๏ธ |
pycodestyle (E, W)
For more, see pycodestyle on PyPI.
For related settings, see pycodestyle.
Error (E)
Code | Name | Message | |
---|---|---|---|
E101 | mixed-spaces-and-tabs | Indentation contains mixed spaces and tabs | โ๏ธ |
E111 | indentation-with-invalid-multiple | Indentation is not a multiple of {indent_width} | ๐งช |
E112 | no-indented-block | Expected an indented block | ๐งช |
E113 | unexpected-indentation | Unexpected indentation | ๐งช |
E114 | indentation-with-invalid-multiple-comment | Indentation is not a multiple of {indent_width} (comment) | ๐งช |
E115 | no-indented-block-comment | Expected an indented block (comment) | ๐งช |
E116 | unexpected-indentation-comment | Unexpected indentation (comment) | ๐งช |
E117 | over-indented | Over-indented (comment) | ๐งช |
E201 | whitespace-after-open-bracket | Whitespace after '{symbol}' | ๐งช ๐ ๏ธ |
E202 | whitespace-before-close-bracket | Whitespace before '{symbol}' | ๐งช ๐ ๏ธ |
E203 | whitespace-before-punctuation | Whitespace before '{symbol}' | ๐งช ๐ ๏ธ |
E204 | whitespace-after-decorator | Whitespace after decorator | ๐งช ๐ ๏ธ |
E211 | whitespace-before-parameters | Whitespace before '{bracket}' | ๐งช ๐ ๏ธ |
E221 | multiple-spaces-before-operator | Multiple spaces before operator | ๐งช ๐ ๏ธ |
E222 | multiple-spaces-after-operator | Multiple spaces after operator | ๐งช ๐ ๏ธ |
E223 | tab-before-operator | Tab before operator | ๐งช ๐ ๏ธ |
E224 | tab-after-operator | Tab after operator | ๐งช ๐ ๏ธ |
E225 | missing-whitespace-around-operator | Missing whitespace around operator | ๐งช ๐ ๏ธ |
E226 | missing-whitespace-around-arithmetic-operator | Missing whitespace around arithmetic operator | ๐งช ๐ ๏ธ |
E227 | missing-whitespace-around-bitwise-or-shift-operator | Missing whitespace around bitwise or shift operator | ๐งช ๐ ๏ธ |
E228 | missing-whitespace-around-modulo-operator | Missing whitespace around modulo operator | ๐งช ๐ ๏ธ |
E231 | missing-whitespace | Missing whitespace after {} | ๐งช ๐ ๏ธ |
E241 | multiple-spaces-after-comma | Multiple spaces after comma | ๐งช ๐ ๏ธ |
E242 | tab-after-comma | Tab after comma | ๐งช ๐ ๏ธ |
E251 | unexpected-spaces-around-keyword-parameter-equals | Unexpected spaces around keyword / parameter equals | ๐งช ๐ ๏ธ |
E252 | missing-whitespace-around-parameter-equals | Missing whitespace around parameter equals | ๐งช ๐ ๏ธ |
E261 | too-few-spaces-before-inline-comment | Insert at least two spaces before an inline comment | ๐งช ๐ ๏ธ |
E262 | no-space-after-inline-comment | Inline comment should start with # |
๐งช ๐ ๏ธ |
E265 | no-space-after-block-comment | Block comment should start with # |
๐งช ๐ ๏ธ |
E266 | multiple-leading-hashes-for-block-comment | Too many leading # before block comment |
๐งช ๐ ๏ธ |
E271 | multiple-spaces-after-keyword | Multiple spaces after keyword | ๐งช ๐ ๏ธ |
E272 | multiple-spaces-before-keyword | Multiple spaces before keyword | ๐งช ๐ ๏ธ |
E273 | tab-after-keyword | Tab after keyword | ๐งช ๐ ๏ธ |
E274 | tab-before-keyword | Tab before keyword | ๐งช ๐ ๏ธ |
E275 | missing-whitespace-after-keyword | Missing whitespace after keyword | ๐งช ๐ ๏ธ |
E301 | blank-line-between-methods | Expected {BLANK_LINES_NESTED_LEVEL:?} blank line, found 0 | ๐งช ๐ ๏ธ |
E302 | blank-lines-top-level | Expected {expected_blank_lines:?} blank lines, found {actual_blank_lines} | ๐งช ๐ ๏ธ |
E303 | too-many-blank-lines | Too many blank lines ({actual_blank_lines}) | ๐งช ๐ ๏ธ |
E304 | blank-line-after-decorator | Blank lines found after function decorator ({lines}) | ๐งช ๐ ๏ธ |
E305 | blank-lines-after-function-or-class | Expected 2 blank lines after class or function definition, found ({blank_lines}) | ๐งช ๐ ๏ธ |
E306 | blank-lines-before-nested-definition | Expected 1 blank line before a nested definition, found 0 | ๐งช ๐ ๏ธ |
E401 | multiple-imports-on-one-line | Multiple imports on one line | โ๏ธ ๐ ๏ธ |
E402 | module-import-not-at-top-of-file | Module level import not at top of cell | โ๏ธ |
E501 | line-too-long | Line too long ({width} > {limit}) | โ๏ธ |
E502 | redundant-backslash | Redundant backslash | ๐งช ๐ ๏ธ |
E701 | multiple-statements-on-one-line-colon | Multiple statements on one line (colon) | โ๏ธ |
E702 | multiple-statements-on-one-line-semicolon | Multiple statements on one line (semicolon) | โ๏ธ |
E703 | useless-semicolon | Statement ends with an unnecessary semicolon | โ๏ธ ๐ ๏ธ |
E711 | none-comparison | Comparison to None should be cond is None |
โ๏ธ ๐ ๏ธ |
E712 | true-false-comparison | Avoid equality comparisons to True ; use if {cond}: for truth checks |
โ๏ธ ๐ ๏ธ |
E713 | not-in-test | Test for membership should be not in |
โ๏ธ ๐ ๏ธ |
E714 | not-is-test | Test for object identity should be is not |
โ๏ธ ๐ ๏ธ |
E721 | type-comparison | Use is and is not for type comparisons, or isinstance() for isinstance checks |
โ๏ธ |
E722 | bare-except | Do not use bare except |
โ๏ธ |
E731 | lambda-assignment | Do not assign a lambda expression, use a def |
โ๏ธ ๐ ๏ธ |
E741 | ambiguous-variable-name | Ambiguous variable name: {name} |
โ๏ธ |
E742 | ambiguous-class-name | Ambiguous class name: {name} |
โ๏ธ |
E743 | ambiguous-function-name | Ambiguous function name: {name} |
โ๏ธ |
E902 | io-error | {message} | โ๏ธ |
E999 | syntax-error | SyntaxError: {message} | โ ๏ธ |
Warning (W)
Code | Name | Message | |
---|---|---|---|
W191 | tab-indentation | Indentation contains tabs | โ๏ธ |
W291 | trailing-whitespace | Trailing whitespace | โ๏ธ ๐ ๏ธ |
W292 | missing-newline-at-end-of-file | No newline at end of file | โ๏ธ ๐ ๏ธ |
W293 | blank-line-with-whitespace | Blank line contains whitespace | โ๏ธ ๐ ๏ธ |
W391 | too-many-newlines-at-end-of-file | Too many newlines at end of file | ๐งช ๐ ๏ธ |
W505 | doc-line-too-long | Doc line too long ({width} > {limit}) | โ๏ธ |
W605 | invalid-escape-sequence | Invalid escape sequence: \{ch} |
โ๏ธ ๐ ๏ธ |
mccabe (C90)
For more, see mccabe on PyPI.
For related settings, see mccabe.
Code | Name | Message | |
---|---|---|---|
C901 | complex-structure | {name} is too complex ({complexity} > {max_complexity}) |
โ๏ธ |
isort (I)
For more, see isort on PyPI.
For related settings, see isort.
Code | Name | Message | |
---|---|---|---|
I001 | unsorted-imports | Import block is un-sorted or un-formatted | โ๏ธ ๐ ๏ธ |
I002 | missing-required-import | Missing required import: {name} |
โ๏ธ ๐ ๏ธ |
pep8-naming (N)
For more, see pep8-naming on PyPI.
For related settings, see pep8-naming.
Code | Name | Message | |
---|---|---|---|
N801 | invalid-class-name | Class name {name} should use CapWords convention |
โ๏ธ |
N802 | invalid-function-name | Function name {name} should be lowercase |
โ๏ธ |
N803 | invalid-argument-name | Argument name {name} should be lowercase |
โ๏ธ |
N804 | invalid-first-argument-name-for-class-method | First argument of a class method should be named cls |
โ๏ธ ๐ ๏ธ |
N805 | invalid-first-argument-name-for-method | First argument of a method should be named self |
โ๏ธ ๐ ๏ธ |
N806 | non-lowercase-variable-in-function | Variable {name} in function should be lowercase |
โ๏ธ |
N807 | dunder-function-name | Function name should not start and end with __ |
โ๏ธ |
N811 | constant-imported-as-non-constant | Constant {name} imported as non-constant {asname} |
โ๏ธ |
N812 | lowercase-imported-as-non-lowercase | Lowercase {name} imported as non-lowercase {asname} |
โ๏ธ |
N813 | camelcase-imported-as-lowercase | Camelcase {name} imported as lowercase {asname} |
โ๏ธ |
N814 | camelcase-imported-as-constant | Camelcase {name} imported as constant {asname} |
โ๏ธ |
N815 | mixed-case-variable-in-class-scope | Variable {name} in class scope should not be mixedCase |
โ๏ธ |
N816 | mixed-case-variable-in-global-scope | Variable {name} in global scope should not be mixedCase |
โ๏ธ |
N817 | camelcase-imported-as-acronym | CamelCase {name} imported as acronym {asname} |
โ๏ธ |
N818 | error-suffix-on-exception-name | Exception name {name} should be named with an Error suffix |
โ๏ธ |
N999 | invalid-module-name | Invalid module name: '{name}' | โ๏ธ |
pydocstyle (D)
For more, see pydocstyle on PyPI.
For related settings, see pydocstyle.
Code | Name | Message | |
---|---|---|---|
D100 | undocumented-public-module | Missing docstring in public module | โ๏ธ |
D101 | undocumented-public-class | Missing docstring in public class | โ๏ธ |
D102 | undocumented-public-method | Missing docstring in public method | โ๏ธ |
D103 | undocumented-public-function | Missing docstring in public function | โ๏ธ |
D104 | undocumented-public-package | Missing docstring in public package | โ๏ธ |
D105 | undocumented-magic-method | Missing docstring in magic method | โ๏ธ |
D106 | undocumented-public-nested-class | Missing docstring in public nested class | โ๏ธ |
D107 | undocumented-public-init | Missing docstring in __init__ |
โ๏ธ |
D200 | fits-on-one-line | One-line docstring should fit on one line | โ๏ธ ๐ ๏ธ |
D201 | no-blank-line-before-function | No blank lines allowed before function docstring (found {num_lines}) | โ๏ธ ๐ ๏ธ |
D202 | no-blank-line-after-function | No blank lines allowed after function docstring (found {num_lines}) | โ๏ธ ๐ ๏ธ |
D203 | one-blank-line-before-class | 1 blank line required before class docstring | โ๏ธ ๐ ๏ธ |
D204 | one-blank-line-after-class | 1 blank line required after class docstring | โ๏ธ ๐ ๏ธ |
D205 | blank-line-after-summary | 1 blank line required between summary line and description | โ๏ธ ๐ ๏ธ |
D206 | indent-with-spaces | Docstring should be indented with spaces, not tabs | โ๏ธ |
D207 | under-indentation | Docstring is under-indented | โ๏ธ ๐ ๏ธ |
D208 | over-indentation | Docstring is over-indented | โ๏ธ ๐ ๏ธ |
D209 | new-line-after-last-paragraph | Multi-line docstring closing quotes should be on a separate line | โ๏ธ ๐ ๏ธ |
D210 | surrounding-whitespace | No whitespaces allowed surrounding docstring text | โ๏ธ ๐ ๏ธ |
D211 | blank-line-before-class | No blank lines allowed before class docstring | โ๏ธ ๐ ๏ธ |
D212 | multi-line-summary-first-line | Multi-line docstring summary should start at the first line | โ๏ธ ๐ ๏ธ |
D213 | multi-line-summary-second-line | Multi-line docstring summary should start at the second line | โ๏ธ ๐ ๏ธ |
D214 | section-not-over-indented | Section is over-indented ("{name}") | โ๏ธ ๐ ๏ธ |
D215 | section-underline-not-over-indented | Section underline is over-indented ("{name}") | โ๏ธ ๐ ๏ธ |
D300 | triple-single-quotes | Use triple double quotes """ |
โ๏ธ ๐ ๏ธ |
D301 | escape-sequence-in-docstring | Use r""" if any backslashes in a docstring |
โ๏ธ ๐ ๏ธ |
D400 | ends-in-period | First line should end with a period | โ๏ธ ๐ ๏ธ |
D401 | non-imperative-mood | First line of docstring should be in imperative mood: "{first_line}" | โ๏ธ |
D402 | no-signature | First line should not be the function's signature | โ๏ธ |
D403 | first-line-capitalized | First word of the first line should be capitalized: {} -> {} |
โ๏ธ ๐ ๏ธ |
D404 | docstring-starts-with-this | First word of the docstring should not be "This" | โ๏ธ |
D405 | capitalize-section-name | Section name should be properly capitalized ("{name}") | โ๏ธ ๐ ๏ธ |
D406 | new-line-after-section-name | Section name should end with a newline ("{name}") | โ๏ธ ๐ ๏ธ |
D407 | dashed-underline-after-section | Missing dashed underline after section ("{name}") | โ๏ธ ๐ ๏ธ |
D408 | section-underline-after-name | Section underline should be in the line following the section's name ("{name}") | โ๏ธ ๐ ๏ธ |
D409 | section-underline-matches-section-length | Section underline should match the length of its name ("{name}") | โ๏ธ ๐ ๏ธ |
D410 | no-blank-line-after-section | Missing blank line after section ("{name}") | โ๏ธ ๐ ๏ธ |
D411 | no-blank-line-before-section | Missing blank line before section ("{name}") | โ๏ธ ๐ ๏ธ |
D412 | blank-lines-between-header-and-content | No blank lines allowed between a section header and its content ("{name}") | โ๏ธ ๐ ๏ธ |
D413 | blank-line-after-last-section | Missing blank line after last section ("{name}") | โ๏ธ ๐ ๏ธ |
D414 | empty-docstring-section | Section has no content ("{name}") | โ๏ธ |
D415 | ends-in-punctuation | First line should end with a period, question mark, or exclamation point | โ๏ธ ๐ ๏ธ |
D416 | section-name-ends-in-colon | Section name should end with a colon ("{name}") | โ๏ธ ๐ ๏ธ |
D417 | undocumented-param | Missing argument description in the docstring for {definition} : {name} |
โ๏ธ |
D418 | overload-with-docstring | Function decorated with @overload shouldn't contain a docstring |
โ๏ธ |
D419 | empty-docstring | Docstring is empty | โ๏ธ |
pyupgrade (UP)
For more, see pyupgrade on PyPI.
For related settings, see pyupgrade.
Code | Name | Message | |
---|---|---|---|
UP001 | useless-metaclass-type | __metaclass__ = type is implied |
โ๏ธ ๐ ๏ธ |
UP003 | type-of-primitive | Use {} instead of type(...) |
โ๏ธ ๐ ๏ธ |
UP004 | useless-object-inheritance | Class {name} inherits from object |
โ๏ธ ๐ ๏ธ |
UP005 | deprecated-unittest-alias | {alias} is deprecated, use {target} |
โ๏ธ ๐ ๏ธ |
UP006 | non-pep585-annotation | Use {to} instead of {from} for type annotation |
โ๏ธ ๐ ๏ธ |
UP007 | non-pep604-annotation | Use X | Y for type annotations |
โ๏ธ ๐ ๏ธ |
UP008 | super-call-with-parameters | Use super() instead of super(__class__, self) |
โ๏ธ ๐ ๏ธ |
UP009 | utf8-encoding-declaration | UTF-8 encoding declaration is unnecessary | โ๏ธ ๐ ๏ธ |
UP010 | unnecessary-future-import | Unnecessary __future__ import {import} for target Python version |
โ๏ธ ๐ ๏ธ |
UP011 | lru-cache-without-parameters | Unnecessary parentheses to functools.lru_cache |
โ๏ธ ๐ ๏ธ |
UP012 | unnecessary-encode-utf8 | Unnecessary call to encode as UTF-8 |
โ๏ธ ๐ ๏ธ |
UP013 | convert-typed-dict-functional-to-class | Convert {name} from TypedDict functional to class syntax |
โ๏ธ ๐ ๏ธ |
UP014 | convert-named-tuple-functional-to-class | Convert {name} from NamedTuple functional to class syntax |
โ๏ธ ๐ ๏ธ |
UP015 | redundant-open-modes | Unnecessary open mode parameters | โ๏ธ ๐ ๏ธ |
UP017 | datetime-timezone-utc | Use datetime.UTC alias |
โ๏ธ ๐ ๏ธ |
UP018 | native-literals | Unnecessary {literal_type} call (rewrite as a literal) |
โ๏ธ ๐ ๏ธ |
UP019 | typing-text-str-alias | typing.Text is deprecated, use str |
โ๏ธ ๐ ๏ธ |
UP020 | open-alias | Use builtin open |
โ๏ธ ๐ ๏ธ |
UP021 | replace-universal-newlines | universal_newlines is deprecated, use text |
โ๏ธ ๐ ๏ธ |
UP022 | replace-stdout-stderr | Prefer capture_output over sending stdout and stderr to PIPE |
โ๏ธ ๐ ๏ธ |
UP023 | deprecated-c-element-tree | cElementTree is deprecated, use ElementTree |
โ๏ธ ๐ ๏ธ |
UP024 | os-error-alias | Replace aliased errors with OSError |
โ๏ธ ๐ ๏ธ |
UP025 | unicode-kind-prefix | Remove unicode literals from strings | โ๏ธ ๐ ๏ธ |
UP026 | deprecated-mock-import | mock is deprecated, use unittest.mock |
โ๏ธ ๐ ๏ธ |
UP027 | unpacked-list-comprehension | Replace unpacked list comprehension with a generator expression | โ ๏ธ ๐ ๏ธ |
UP028 | yield-in-for-loop | Replace yield over for loop with yield from |
โ๏ธ ๐ ๏ธ |
UP029 | unnecessary-builtin-import | Unnecessary builtin import: {import} |
โ๏ธ ๐ ๏ธ |
UP030 | format-literals | Use implicit references for positional format fields | โ๏ธ ๐ ๏ธ |
UP031 | printf-string-formatting | Use format specifiers instead of percent format | โ๏ธ ๐ ๏ธ |
UP032 | f-string | Use f-string instead of format call |
โ๏ธ ๐ ๏ธ |
UP033 | lru-cache-with-maxsize-none | Use @functools.cache instead of @functools.lru_cache(maxsize=None) |
โ๏ธ ๐ ๏ธ |
UP034 | extraneous-parentheses | Avoid extraneous parentheses | โ๏ธ ๐ ๏ธ |
UP035 | deprecated-import | Import from {target} instead: {names} |
โ๏ธ ๐ ๏ธ |
UP036 | outdated-version-block | Version block is outdated for minimum Python version | โ๏ธ ๐ ๏ธ |
UP037 | quoted-annotation | Remove quotes from type annotation | โ๏ธ ๐ ๏ธ |
UP038 | non-pep604-isinstance | Use X | Y in {} call instead of (X, Y) |
โ๏ธ ๐ ๏ธ |
UP039 | unnecessary-class-parentheses | Unnecessary parentheses after class definition | โ๏ธ ๐ ๏ธ |
UP040 | non-pep695-type-alias | Type alias {name} uses {type_alias_method} instead of the type keyword |
โ๏ธ ๐ ๏ธ |
UP041 | timeout-error-alias | Replace aliased errors with TimeoutError |
โ๏ธ ๐ ๏ธ |
UP042 | replace-str-enum | Class {name} inherits from both str and enum.Enum |
๐งช ๐ ๏ธ |
UP043 | unnecessary-default-type-args | Unnecessary default type arguments | ๐งช ๐ ๏ธ |
UP044 | non-pep646-unpack | Use * for unpacking |
๐งช ๐ ๏ธ |
flake8-2020 (YTT)
For more, see flake8-2020 on PyPI.
Code | Name | Message | |
---|---|---|---|
YTT101 | sys-version-slice3 | sys.version[:3] referenced (python3.10), use sys.version_info |
โ๏ธ |
YTT102 | sys-version2 | sys.version[2] referenced (python3.10), use sys.version_info |
โ๏ธ |
YTT103 | sys-version-cmp-str3 | sys.version compared to string (python3.10), use sys.version_info |
โ๏ธ |
YTT201 | sys-version-info0-eq3 | sys.version_info[0] == 3 referenced (python4), use >= |
โ๏ธ |
YTT202 | six-py3 | six.PY3 referenced (python4), use not six.PY2 |
โ๏ธ |
YTT203 | sys-version-info1-cmp-int | sys.version_info[1] compared to integer (python4), compare sys.version_info to tuple |
โ๏ธ |
YTT204 | sys-version-info-minor-cmp-int | sys.version_info.minor compared to integer (python4), compare sys.version_info to tuple |
โ๏ธ |
YTT301 | sys-version0 | sys.version[0] referenced (python10), use sys.version_info |
โ๏ธ |
YTT302 | sys-version-cmp-str10 | sys.version compared to string (python10), use sys.version_info |
โ๏ธ |
YTT303 | sys-version-slice1 | sys.version[:1] referenced (python10), use sys.version_info |
โ๏ธ |
flake8-annotations (ANN)
For more, see flake8-annotations on PyPI.
For related settings, see flake8-annotations.
Code | Name | Message | |
---|---|---|---|
ANN001 | missing-type-function-argument | Missing type annotation for function argument {name} |
โ๏ธ |
ANN002 | missing-type-args | Missing type annotation for *{name} |
โ๏ธ |
ANN003 | missing-type-kwargs | Missing type annotation for **{name} |
โ๏ธ |
ANN101 | missing-type-self | Missing type annotation for {name} in method |
โ ๏ธ |
ANN102 | missing-type-cls | Missing type annotation for {name} in classmethod |
โ ๏ธ |
ANN201 | missing-return-type-undocumented-public-function | Missing return type annotation for public function {name} |
โ๏ธ ๐ ๏ธ |
ANN202 | missing-return-type-private-function | Missing return type annotation for private function {name} |
โ๏ธ ๐ ๏ธ |
ANN204 | missing-return-type-special-method | Missing return type annotation for special method {name} |
โ๏ธ ๐ ๏ธ |
ANN205 | missing-return-type-static-method | Missing return type annotation for staticmethod {name} |
โ๏ธ ๐ ๏ธ |
ANN206 | missing-return-type-class-method | Missing return type annotation for classmethod {name} |
โ๏ธ ๐ ๏ธ |
ANN401 | any-type | Dynamically typed expressions (typing.Any) are disallowed in {name} |
โ๏ธ |
flake8-async (ASYNC)
For more, see flake8-async on PyPI.
Code | Name | Message | |
---|---|---|---|
ASYNC100 | cancel-scope-no-checkpoint | A with {method_name}(...): context does not contain any await statements. This makes it pointless, as the timeout can only be triggered by a checkpoint. |
โ๏ธ |
ASYNC105 | trio-sync-call | Call to {method_name} is not immediately awaited |
โ๏ธ ๐ ๏ธ |
ASYNC109 | async-function-with-timeout | Async function definition with a timeout parameter |
โ๏ธ |
ASYNC110 | async-busy-wait | Use {module}.Event instead of awaiting {module}.sleep in a while loop |
โ๏ธ |
ASYNC115 | async-zero-sleep | Use {module}.lowlevel.checkpoint() instead of {module}.sleep(0) |
โ๏ธ ๐ ๏ธ |
ASYNC116 | long-sleep-not-forever | {module}.sleep() with >24 hour interval should usually be {module}.sleep_forever() |
๐งช ๐ ๏ธ |
ASYNC210 | blocking-http-call-in-async-function | Async functions should not call blocking HTTP methods | โ๏ธ |
ASYNC220 | create-subprocess-in-async-function | Async functions should not create subprocesses with blocking methods | โ๏ธ |
ASYNC221 | run-process-in-async-function | Async functions should not run processes with blocking methods | โ๏ธ |
ASYNC222 | wait-for-process-in-async-function | Async functions should not wait on processes with blocking methods | โ๏ธ |
ASYNC230 | blocking-open-call-in-async-function | Async functions should not open files with blocking methods like open |
โ๏ธ |
ASYNC251 | blocking-sleep-in-async-function | Async functions should not call time.sleep |
โ๏ธ |
flake8-bandit (S)
For more, see flake8-bandit on PyPI.
For related settings, see flake8-bandit.
Code | Name | Message | |
---|---|---|---|
S101 | assert | Use of assert detected |
โ๏ธ |
S102 | exec-builtin | Use of exec detected |
โ๏ธ |
S103 | bad-file-permissions | os.chmod setting a permissive mask {mask:#o} on file or directory |
โ๏ธ |
S104 | hardcoded-bind-all-interfaces | Possible binding to all interfaces | โ๏ธ |
S105 | hardcoded-password-string | Possible hardcoded password assigned to: "{}" | โ๏ธ |
S106 | hardcoded-password-func-arg | Possible hardcoded password assigned to argument: "{}" | โ๏ธ |
S107 | hardcoded-password-default | Possible hardcoded password assigned to function default: "{}" | โ๏ธ |
S108 | hardcoded-temp-file | Probable insecure usage of temporary file or directory: "{}" | โ๏ธ |
S110 | try-except-pass | try -except -pass detected, consider logging the exception |
โ๏ธ |
S112 | try-except-continue | try -except -continue detected, consider logging the exception |
โ๏ธ |
S113 | request-without-timeout | Probable use of {module} call without timeout |
โ๏ธ |
S201 | flask-debug-true | Use of debug=True in Flask app detected |
โ๏ธ |
S202 | tarfile-unsafe-members | Uses of tarfile.extractall() |
โ๏ธ |
S301 | suspicious-pickle-usage | pickle and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue |
โ๏ธ |
S302 | suspicious-marshal-usage | Deserialization with the marshal module is possibly dangerous |
โ๏ธ |
S303 | suspicious-insecure-hash-usage | Use of insecure MD2, MD4, MD5, or SHA1 hash function | โ๏ธ |
S304 | suspicious-insecure-cipher-usage | Use of insecure cipher, replace with a known secure cipher such as AES | โ๏ธ |
S305 | suspicious-insecure-cipher-mode-usage | Use of insecure block cipher mode, replace with a known secure mode such as CBC or CTR | โ๏ธ |
S306 | suspicious-mktemp-usage | Use of insecure and deprecated function (mktemp ) |
โ๏ธ |
S307 | suspicious-eval-usage | Use of possibly insecure function; consider using ast.literal_eval |
โ๏ธ |
S308 | suspicious-mark-safe-usage | Use of mark_safe may expose cross-site scripting vulnerabilities |
โ๏ธ |
S310 | suspicious-url-open-usage | Audit URL open for permitted schemes. Allowing use of file: or custom schemes is often unexpected. |
โ๏ธ |
S311 | suspicious-non-cryptographic-random-usage | Standard pseudo-random generators are not suitable for cryptographic purposes | โ๏ธ |
S312 | suspicious-telnet-usage | Telnet-related functions are being called. Telnet is considered insecure. Use SSH or some other encrypted protocol. | โ๏ธ |
S313 | suspicious-xmlc-element-tree-usage | Using xml to parse untrusted data is known to be vulnerable to XML attacks; use defusedxml equivalents |
โ๏ธ |
S314 | suspicious-xml-element-tree-usage | Using xml to parse untrusted data is known to be vulnerable to XML attacks; use defusedxml equivalents |
โ๏ธ |
S315 | suspicious-xml-expat-reader-usage | Using xml to parse untrusted data is known to be vulnerable to XML attacks; use defusedxml equivalents |
โ๏ธ |
S316 | suspicious-xml-expat-builder-usage | Using xml to parse untrusted data is known to be vulnerable to XML attacks; use defusedxml equivalents |
โ๏ธ |
S317 | suspicious-xml-sax-usage | Using xml to parse untrusted data is known to be vulnerable to XML attacks; use defusedxml equivalents |
โ๏ธ |
S318 | suspicious-xml-mini-dom-usage | Using xml to parse untrusted data is known to be vulnerable to XML attacks; use defusedxml equivalents |
โ๏ธ |
S319 | suspicious-xml-pull-dom-usage | Using xml to parse untrusted data is known to be vulnerable to XML attacks; use defusedxml equivalents |
โ๏ธ |
S320 | suspicious-xmle-tree-usage | Using lxml to parse untrusted data is known to be vulnerable to XML attacks |
โ๏ธ |
S321 | suspicious-ftp-lib-usage | FTP-related functions are being called. FTP is considered insecure. Use SSH/SFTP/SCP or some other encrypted protocol. | โ๏ธ |
S323 | suspicious-unverified-context-usage | 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 | hashlib-insecure-hash-function | Probable use of insecure hash functions in {library} : {string} |
โ๏ธ |
S401 | suspicious-telnetlib-import | telnetlib and related modules are considered insecure. Use SSH or another encrypted protocol. |
๐งช |
S402 | suspicious-ftplib-import | ftplib and related modules are considered insecure. Use SSH, SFTP, SCP, or another encrypted protocol. |
๐งช |
S403 | suspicious-pickle-import | pickle , cPickle , dill , and shelve modules are possibly insecure |
๐งช |
S404 | suspicious-subprocess-import | subprocess module is possibly insecure |
๐งช |
S405 | suspicious-xml-etree-import | xml.etree methods are vulnerable to XML attacks |
๐งช |
S406 | suspicious-xml-sax-import | xml.sax methods are vulnerable to XML attacks |
๐งช |
S407 | suspicious-xml-expat-import | xml.dom.expatbuilder is vulnerable to XML attacks |
๐งช |
S408 | suspicious-xml-minidom-import | xml.dom.minidom is vulnerable to XML attacks |
๐งช |
S409 | suspicious-xml-pulldom-import | xml.dom.pulldom is vulnerable to XML attacks |
๐งช |
S410 | suspicious-lxml-import | lxml is vulnerable to XML attacks |
โ |
S411 | suspicious-xmlrpc-import | XMLRPC is vulnerable to remote XML attacks | ๐งช |
S412 | suspicious-httpoxy-import | httpoxy is a set of vulnerabilities that affect application code running inCGI, or CGI-like environments. The use of CGI for web applications should be avoided |
๐งช |
S413 | suspicious-pycrypto-import | pycrypto library is known to have publicly disclosed buffer overflow vulnerability |
๐งช |
S415 | suspicious-pyghmi-import | An IPMI-related module is being imported. Prefer an encrypted protocol over IPMI. | ๐งช |
S501 | request-with-no-cert-validation | Probable use of {string} call with verify=False disabling SSL certificate checks |
โ๏ธ |
S502 | ssl-insecure-version | Call made with insecure SSL protocol: {protocol} |
โ๏ธ |
S503 | ssl-with-bad-defaults | Argument default set to insecure SSL protocol: {protocol} |
โ๏ธ |
S504 | ssl-with-no-version | ssl.wrap_socket called without an `ssl_version`` |
โ๏ธ |
S505 | weak-cryptographic-key | {cryptographic_key} key sizes below {minimum_key_size} bits are considered breakable | โ๏ธ |
S506 | unsafe-yaml-load | Probable use of unsafe loader {name} with yaml.load . Allows instantiation of arbitrary objects. Consider yaml.safe_load . |
โ๏ธ |
S507 | ssh-no-host-key-verification | Paramiko call with policy set to automatically trust the unknown host key | โ๏ธ |
S508 | snmp-insecure-version | The use of SNMPv1 and SNMPv2 is insecure. Use SNMPv3 if able. | โ๏ธ |
S509 | snmp-weak-cryptography | You should not use SNMPv3 without encryption. noAuthNoPriv & authNoPriv is insecure. |
โ๏ธ |
S601 | paramiko-call | Possible shell injection via Paramiko call; check inputs are properly sanitized | โ๏ธ |
S602 | subprocess-popen-with-shell-equals-true | subprocess call with shell=True seems safe, but may be changed in the future; consider rewriting without shell |
โ๏ธ |
S603 | subprocess-without-shell-equals-true | subprocess call: check for execution of untrusted input |
โ๏ธ |
S604 | call-with-shell-equals-true | Function call with shell=True parameter identified, security issue |
โ๏ธ |
S605 | start-process-with-a-shell | Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without shell |
โ๏ธ |
S606 | start-process-with-no-shell | Starting a process without a shell | โ๏ธ |
S607 | start-process-with-partial-path | Starting a process with a partial executable path | โ๏ธ |
S608 | hardcoded-sql-expression | Possible SQL injection vector through string-based query construction | โ๏ธ |
S609 | unix-command-wildcard-injection | Possible wildcard injection in call due to * usage |
โ๏ธ |
S610 | django-extra | Use of Django extra can lead to SQL injection vulnerabilities |
โ๏ธ |
S611 | django-raw-sql | Use of RawSQL can lead to SQL injection vulnerabilities |
โ๏ธ |
S612 | logging-config-insecure-listen | Use of insecure logging.config.listen detected |
โ๏ธ |
S701 | jinja2-autoescape-false | Using jinja2 templates with autoescape=False is dangerous and can lead to XSS. Ensure autoescape=True or use the select_autoescape function. |
โ๏ธ |
S702 | mako-templates | Mako templates allow HTML and JavaScript rendering by default and are inherently open to XSS attacks | โ๏ธ |
flake8-blind-except (BLE)
For more, see flake8-blind-except on PyPI.
Code | Name | Message | |
---|---|---|---|
BLE001 | blind-except | Do not catch blind exception: {name} |
โ๏ธ |
flake8-boolean-trap (FBT)
For more, see flake8-boolean-trap on PyPI.
For related settings, see flake8-boolean-trap.
Code | Name | Message | |
---|---|---|---|
FBT001 | boolean-type-hint-positional-argument | Boolean-typed positional argument in function definition | โ๏ธ |
FBT002 | boolean-default-value-positional-argument | Boolean default positional argument in function definition | โ๏ธ |
FBT003 | boolean-positional-value-in-call | Boolean positional value in function call | โ๏ธ |
flake8-bugbear (B)
For more, see flake8-bugbear on PyPI.
For related settings, see flake8-bugbear.
Code | Name | Message | |
---|---|---|---|
B002 | unary-prefix-increment-decrement | Python does not support the unary prefix increment operator (++ ) |
โ๏ธ |
B003 | assignment-to-os-environ | Assigning to os.environ doesn't clear the environment |
โ๏ธ |
B004 | unreliable-callable-check | Using hasattr(x, "__call__") to test if x is callable is unreliable. Use callable(x) for consistent results. |
โ๏ธ ๐ ๏ธ |
B005 | strip-with-multi-characters | Using .strip() with multi-character strings is misleading |
โ๏ธ |
B006 | mutable-argument-default | Do not use mutable data structures for argument defaults | โ๏ธ ๐ ๏ธ |
B007 | unused-loop-control-variable | Loop control variable {name} not used within loop body |
โ๏ธ ๐ ๏ธ |
B008 | function-call-in-default-argument | Do not perform function call {name} in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable |
โ๏ธ |
B009 | get-attr-with-constant | Do not call getattr with a constant attribute value. It is not any safer than normal property access. |
โ๏ธ ๐ ๏ธ |
B010 | set-attr-with-constant | Do not call setattr with a constant attribute value. It is not any safer than normal property access. |
โ๏ธ ๐ ๏ธ |
B011 | assert-false | Do not assert False (python -O removes these calls), raise AssertionError() |
โ๏ธ ๐ ๏ธ |
B012 | jump-statement-in-finally | {name} inside finally blocks cause exceptions to be silenced |
โ๏ธ |
B013 | redundant-tuple-in-exception-handler | A length-one tuple literal is redundant in exception handlers | โ๏ธ ๐ ๏ธ |
B014 | duplicate-handler-exception | Exception handler with duplicate exception: {name} |
โ๏ธ ๐ ๏ธ |
B015 | useless-comparison | Pointless comparison. Did you mean to assign a value? Otherwise, prepend assert or remove it. |
โ๏ธ |
B016 | raise-literal | Cannot raise a literal. Did you intend to return it or raise an Exception? | โ๏ธ |
B017 | assert-raises-exception | {assertion}({exception}) should be considered evil |
โ๏ธ |
B018 | useless-expression | Found useless expression. Either assign it to a variable or remove it. | โ๏ธ |
B019 | cached-instance-method | Use of functools.lru_cache or functools.cache on methods can lead to memory leaks |
โ๏ธ |
B020 | loop-variable-overrides-iterator | Loop control variable {name} overrides iterable it iterates |
โ๏ธ |
B021 | f-string-docstring | f-string used as docstring. Python will interpret this as a joined string, rather than a docstring. | โ๏ธ |
B022 | useless-contextlib-suppress | No arguments passed to contextlib.suppress . No exceptions will be suppressed and therefore this context manager is redundant |
โ๏ธ |
B023 | function-uses-loop-variable | Function definition does not bind loop variable {name} |
โ๏ธ |
B024 | abstract-base-class-without-abstract-method | {name} is an abstract base class, but it has no abstract methods |
โ๏ธ |
B025 | duplicate-try-block-exception | try-except block with duplicate exception {name} |
โ๏ธ |
B026 | star-arg-unpacking-after-keyword-arg | Star-arg unpacking after a keyword argument is strongly discouraged | โ๏ธ |
B027 | empty-method-without-abstract-decorator | {name} is an empty method in an abstract base class, but has no abstract decorator |
โ๏ธ |
B028 | no-explicit-stacklevel | No explicit stacklevel keyword argument found |
โ๏ธ |
B029 | except-with-empty-tuple | Using except (): with an empty tuple does not catch anything; add exceptions to handle |
โ๏ธ |
B030 | except-with-non-exception-classes | except handlers should only be exception classes or tuples of exception classes |
โ๏ธ |
B031 | reuse-of-groupby-generator | Using the generator returned from itertools.groupby() more than once will do nothing on the second usage |
โ๏ธ |
B032 | unintentional-type-annotation | Possible unintentional type annotation (using : ). Did you mean to assign (using = )? |
โ๏ธ |
B033 | duplicate-value | Sets should not contain duplicate item {value} |
โ๏ธ ๐ ๏ธ |
B034 | re-sub-positional-args | {method} should pass {param_name} and flags as keyword arguments to avoid confusion due to unintuitive argument positions |
โ๏ธ |
B035 | static-key-dict-comprehension | Dictionary comprehension uses static key: {key} |
โ๏ธ |
B039 | mutable-contextvar-default | Do not use mutable data structures for ContextVar defaults |
๐งช |
B901 | return-in-generator | Using yield and return {value} in a generator function can lead to confusing behavior |
๐งช |
B904 | raise-without-from-inside-except | 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-explicit-strict | zip() without an explicit strict= parameter |
โ๏ธ ๐ ๏ธ |
B909 | loop-iterator-mutation | Mutation to loop iterable {name} during iteration |
๐งช |
flake8-builtins (A)
For more, see flake8-builtins on PyPI.
For related settings, see flake8-builtins.
Code | Name | Message | |
---|---|---|---|
A001 | builtin-variable-shadowing | Variable {name} is shadowing a Python builtin |
โ๏ธ |
A002 | builtin-argument-shadowing | Function argument {name} is shadowing a Python builtin |
โ๏ธ |
A003 | builtin-attribute-shadowing | Python builtin is shadowed by class attribute {name} from {row} |
โ๏ธ |
A004 | builtin-import-shadowing | Import {name} is shadowing a Python builtin |
๐งช |
A005 | builtin-module-shadowing | Module {name} is shadowing a Python builtin module |
๐งช |
A006 | builtin-lambda-argument-shadowing | Lambda argument {name} is shadowing a Python builtin |
๐งช |
flake8-commas (COM)
For more, see flake8-commas on PyPI.
Code | Name | Message | |
---|---|---|---|
COM812 | missing-trailing-comma | Trailing comma missing | โ๏ธ ๐ ๏ธ |
COM818 | trailing-comma-on-bare-tuple | Trailing comma on bare tuple prohibited | โ๏ธ |
COM819 | prohibited-trailing-comma | Trailing comma prohibited | โ๏ธ ๐ ๏ธ |
flake8-copyright (CPY)
For more, see flake8-copyright on PyPI.
For related settings, see flake8-copyright.
Code | Name | Message | |
---|---|---|---|
CPY001 | missing-copyright-notice | Missing copyright notice at top of file | ๐งช |
flake8-comprehensions (C4)
For more, see flake8-comprehensions on PyPI.
For related settings, see flake8-comprehensions.
Code | Name | Message | |
---|---|---|---|
C400 | unnecessary-generator-list | Unnecessary generator (rewrite using list() ) |
โ๏ธ ๐ ๏ธ |
C401 | unnecessary-generator-set | Unnecessary generator (rewrite using set() ) |
โ๏ธ ๐ ๏ธ |
C402 | unnecessary-generator-dict | Unnecessary generator (rewrite as a dict comprehension) |
โ๏ธ ๐ ๏ธ |
C403 | unnecessary-list-comprehension-set | Unnecessary list comprehension (rewrite as a set comprehension) |
โ๏ธ ๐ ๏ธ |
C404 | unnecessary-list-comprehension-dict | Unnecessary list comprehension (rewrite as a dict comprehension) |
โ๏ธ ๐ ๏ธ |
C405 | unnecessary-literal-set | Unnecessary {obj_type} literal (rewrite as a set literal) |
โ๏ธ ๐ ๏ธ |
C406 | unnecessary-literal-dict | Unnecessary {obj_type} literal (rewrite as a dict literal) |
โ๏ธ ๐ ๏ธ |
C408 | unnecessary-collection-call | Unnecessary {obj_type} call (rewrite as a literal) |
โ๏ธ ๐ ๏ธ |
C409 | unnecessary-literal-within-tuple-call | Unnecessary list literal passed to tuple() (rewrite as a tuple literal) |
โ๏ธ ๐ ๏ธ |
C410 | unnecessary-literal-within-list-call | Unnecessary {literal} literal passed to list() (remove the outer call to list() ) |
โ๏ธ ๐ ๏ธ |
C411 | unnecessary-list-call | Unnecessary list call (remove the outer call to list() ) |
โ๏ธ ๐ ๏ธ |
C413 | unnecessary-call-around-sorted | Unnecessary {func} call around sorted() |
โ๏ธ ๐ ๏ธ |
C414 | unnecessary-double-cast-or-process | Unnecessary {inner} call within {outer}() |
โ๏ธ ๐ ๏ธ |
C415 | unnecessary-subscript-reversal | Unnecessary subscript reversal of iterable within {func}() |
โ๏ธ |
C416 | unnecessary-comprehension | Unnecessary {obj_type} comprehension (rewrite using {obj_type}() ) |
โ๏ธ ๐ ๏ธ |
C417 | unnecessary-map | Unnecessary map usage (rewrite using a {object_type}) |
โ๏ธ ๐ ๏ธ |
C418 | unnecessary-literal-within-dict-call | Unnecessary dict {kind} passed to dict() (remove the outer call to dict() ) |
โ๏ธ ๐ ๏ธ |
C419 | unnecessary-comprehension-in-call | Unnecessary list comprehension | โ๏ธ ๐ ๏ธ |
C420 | unnecessary-dict-comprehension-for-iterable | Unnecessary dict comprehension for iterable; use dict.fromkeys instead |
๐งช ๐ ๏ธ |
flake8-datetimez (DTZ)
For more, see flake8-datetimez on PyPI.
Code | Name | Message | |
---|---|---|---|
DTZ001 | call-datetime-without-tzinfo | datetime.datetime() called without a tzinfo argument |
โ๏ธ |
DTZ002 | call-datetime-today | datetime.datetime.today() used |
โ๏ธ |
DTZ003 | call-datetime-utcnow | datetime.datetime.utcnow() used |
โ๏ธ |
DTZ004 | call-datetime-utcfromtimestamp | datetime.datetime.utcfromtimestamp() used |
โ๏ธ |
DTZ005 | call-datetime-now-without-tzinfo | datetime.datetime.now() called without a tz argument |
โ๏ธ |
DTZ006 | call-datetime-fromtimestamp | datetime.datetime.fromtimestamp() called without a tz argument |
โ๏ธ |
DTZ007 | call-datetime-strptime-without-zone | Naive datetime constructed using datetime.datetime.strptime() without %z |
โ๏ธ |
DTZ011 | call-date-today | datetime.date.today() used |
โ๏ธ |
DTZ012 | call-date-fromtimestamp | datetime.date.fromtimestamp() used |
โ๏ธ |
DTZ901 | datetime-min-max | Use of datetime.datetime.{min_max} without timezone information |
๐งช |
flake8-debugger (T10)
For more, see flake8-debugger on PyPI.
Code | Name | Message | |
---|---|---|---|
T100 | debugger | Trace found: {name} used |
โ๏ธ |
flake8-django (DJ)
For more, see flake8-django on PyPI.
Code | Name | Message | |
---|---|---|---|
DJ001 | django-nullable-model-string-field | Avoid using null=True on string-based fields such as {field_name} |
โ๏ธ |
DJ003 | django-locals-in-render-function | Avoid passing locals() as context to a render function |
โ๏ธ |
DJ006 | django-exclude-with-model-form | Do not use exclude with ModelForm , use fields instead |
โ๏ธ |
DJ007 | django-all-with-model-form | Do not use __all__ with ModelForm , use fields instead |
โ๏ธ |
DJ008 | django-model-without-dunder-str | Model does not define __str__ method |
โ๏ธ |
DJ012 | django-unordered-body-content-in-model | 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 | django-non-leading-receiver-decorator | @receiver decorator must be on top of all the other decorators |
โ๏ธ |
flake8-errmsg (EM)
For more, see flake8-errmsg on PyPI.
For related settings, see flake8-errmsg.
Code | Name | Message | |
---|---|---|---|
EM101 | raw-string-in-exception | Exception must not use a string literal, assign to variable first | โ๏ธ ๐ ๏ธ |
EM102 | f-string-in-exception | Exception must not use an f-string literal, assign to variable first | โ๏ธ ๐ ๏ธ |
EM103 | dot-format-in-exception | Exception must not use a .format() string directly, assign to variable first |
โ๏ธ ๐ ๏ธ |
flake8-executable (EXE)
For more, see flake8-executable on PyPI.
Code | Name | Message | |
---|---|---|---|
EXE001 | shebang-not-executable | Shebang is present but file is not executable | โ๏ธ |
EXE002 | shebang-missing-executable-file | The file is executable but no shebang is present | โ๏ธ |
EXE003 | shebang-missing-python | Shebang should contain python |
โ๏ธ |
EXE004 | shebang-leading-whitespace | Avoid whitespace before shebang | โ๏ธ ๐ ๏ธ |
EXE005 | shebang-not-first-line | Shebang should be at the beginning of the file | โ๏ธ |
flake8-future-annotations (FA)
For more, see flake8-future-annotations on PyPI.
Code | Name | Message | |
---|---|---|---|
FA100 | future-rewritable-type-annotation | Add from __future__ import annotations to simplify {name} |
โ๏ธ |
FA102 | future-required-type-annotation | Missing from __future__ import annotations , but uses {reason} |
โ๏ธ ๐ ๏ธ |
flake8-implicit-str-concat (ISC)
For more, see flake8-implicit-str-concat on PyPI.
For related settings, see flake8-implicit-str-concat.
Code | Name | Message | |
---|---|---|---|
ISC001 | single-line-implicit-string-concatenation | Implicitly concatenated string literals on one line | โ๏ธ ๐ ๏ธ |
ISC002 | multi-line-implicit-string-concatenation | Implicitly concatenated string literals over multiple lines | โ๏ธ |
ISC003 | explicit-string-concatenation | Explicitly concatenated string should be implicitly concatenated | โ๏ธ |
flake8-import-conventions (ICN)
For more, see flake8-import-conventions on GitHub.
For related settings, see flake8-import-conventions.
Code | Name | Message | |
---|---|---|---|
ICN001 | unconventional-import-alias | {name} should be imported as {asname} |
โ๏ธ ๐ ๏ธ |
ICN002 | banned-import-alias | {name} should not be imported as {asname} |
โ๏ธ |
ICN003 | banned-import-from | Members of {name} should not be imported explicitly |
โ๏ธ |
flake8-logging (LOG)
For more, see flake8-logging on PyPI.
Code | Name | Message | |
---|---|---|---|
LOG001 | direct-logger-instantiation | Use logging.getLogger() to instantiate loggers |
โ๏ธ ๐ ๏ธ |
LOG002 | invalid-get-logger-argument | Use __name__ with logging.getLogger() |
โ๏ธ ๐ ๏ธ |
LOG007 | exception-without-exc-info | Use of logging.exception with falsy exc_info |
โ๏ธ |
LOG009 | undocumented-warn | Use of undocumented logging.WARN constant |
โ๏ธ ๐ ๏ธ |
LOG015 | root-logger-call | {}() call on root logger |
๐งช |
flake8-logging-format (G)
For more, see flake8-logging-format on PyPI.
Code | Name | Message | |
---|---|---|---|
G001 | logging-string-format | Logging statement uses str.format |
โ๏ธ |
G002 | logging-percent-format | Logging statement uses % |
โ๏ธ |
G003 | logging-string-concat | Logging statement uses + |
โ๏ธ |
G004 | logging-f-string | Logging statement uses f-string | โ๏ธ |
G010 | logging-warn | Logging statement uses warn instead of warning |
โ๏ธ ๐ ๏ธ |
G101 | logging-extra-attr-clash | Logging statement uses an extra field that clashes with a LogRecord field: {key} |
โ๏ธ |
G201 | logging-exc-info | Logging .exception(...) should be used instead of .error(..., exc_info=True) |
โ๏ธ |
G202 | logging-redundant-exc-info | Logging statement has redundant exc_info |
โ๏ธ |
flake8-no-pep420 (INP)
For more, see flake8-no-pep420 on PyPI.
Code | Name | Message | |
---|---|---|---|
INP001 | implicit-namespace-package | File {filename} is part of an implicit namespace package. Add an __init__.py . |
โ๏ธ |
flake8-pie (PIE)
For more, see flake8-pie on PyPI.
Code | Name | Message | |
---|---|---|---|
PIE790 | unnecessary-placeholder | Unnecessary pass statement |
โ๏ธ ๐ ๏ธ |
PIE794 | duplicate-class-field-definition | Class field {name} is defined multiple times |
โ๏ธ ๐ ๏ธ |
PIE796 | non-unique-enums | Enum contains duplicate value: {value} |
โ๏ธ |
PIE800 | unnecessary-spread | Unnecessary spread ** |
โ๏ธ ๐ ๏ธ |
PIE804 | unnecessary-dict-kwargs | Unnecessary dict kwargs |
โ๏ธ ๐ ๏ธ |
PIE807 | reimplemented-container-builtin | Prefer {container} over useless lambda |
โ๏ธ ๐ ๏ธ |
PIE808 | unnecessary-range-start | Unnecessary start argument in range |
โ๏ธ ๐ ๏ธ |
PIE810 | multiple-starts-ends-with | Call {attr} once with a tuple |
โ๏ธ ๐ ๏ธ |
flake8-print (T20)
For more, see flake8-print on PyPI.
Code | Name | Message | |
---|---|---|---|
T201 | print found |
โ๏ธ ๐ ๏ธ | |
T203 | p-print | pprint found |
โ๏ธ ๐ ๏ธ |
flake8-pyi (PYI)
For more, see flake8-pyi on PyPI.
Code | Name | Message | |
---|---|---|---|
PYI001 | unprefixed-type-param | Name of private {kind} must start with _ |
โ๏ธ |
PYI002 | complex-if-statement-in-stub | if test must be a simple comparison against sys.platform or sys.version_info |
โ๏ธ |
PYI003 | unrecognized-version-info-check | Unrecognized sys.version_info check |
โ๏ธ |
PYI004 | patch-version-comparison | Version comparison must use only major and minor version | โ๏ธ |
PYI005 | wrong-tuple-length-version-comparison | Version comparison must be against a length-{expected_length} tuple | โ๏ธ |
PYI006 | bad-version-info-comparison | Use < or >= for sys.version_info comparisons |
โ๏ธ |
PYI007 | unrecognized-platform-check | Unrecognized sys.platform check |
โ๏ธ |
PYI008 | unrecognized-platform-name | Unrecognized platform {platform} |
โ๏ธ |
PYI009 | pass-statement-stub-body | Empty body should contain ... , not pass |
โ๏ธ ๐ ๏ธ |
PYI010 | non-empty-stub-body | Function body must contain only ... |
โ๏ธ ๐ ๏ธ |
PYI011 | typed-argument-default-in-stub | Only simple default values allowed for typed arguments | โ๏ธ ๐ ๏ธ |
PYI012 | pass-in-class-body | Class body must not contain pass |
โ๏ธ ๐ ๏ธ |
PYI013 | ellipsis-in-non-empty-class-body | Non-empty class body must not contain ... |
โ๏ธ ๐ ๏ธ |
PYI014 | argument-default-in-stub | Only simple default values allowed for arguments | โ๏ธ ๐ ๏ธ |
PYI015 | assignment-default-in-stub | Only simple default values allowed for assignments | โ๏ธ ๐ ๏ธ |
PYI016 | duplicate-union-member | Duplicate union member {} |
โ๏ธ ๐ ๏ธ |
PYI017 | complex-assignment-in-stub | Stubs should not contain assignments to attributes or multiple targets | โ๏ธ |
PYI018 | unused-private-type-var | Private {type_var_like_kind} {type_var_like_name} is never used |
โ๏ธ |
PYI019 | custom-type-var-return-type | Methods like {method_name} should return Self instead of a custom TypeVar |
โ๏ธ ๐ ๏ธ |
PYI020 | quoted-annotation-in-stub | Quoted annotations should not be included in stubs | โ๏ธ ๐ ๏ธ |
PYI021 | docstring-in-stub | Docstrings should not be included in stubs | โ๏ธ ๐ ๏ธ |
PYI024 | collections-named-tuple | Use typing.NamedTuple instead of collections.namedtuple |
โ๏ธ |
PYI025 | unaliased-collections-abc-set-import | Use from collections.abc import Set as AbstractSet to avoid confusion with the set builtin |
โ๏ธ ๐ ๏ธ |
PYI026 | type-alias-without-annotation | Use {module}.TypeAlias for type alias, e.g., {name}: TypeAlias = {value} |
โ๏ธ ๐ ๏ธ |
PYI029 | str-or-repr-defined-in-stub | Defining {name} in a stub is almost always redundant |
โ๏ธ ๐ ๏ธ |
PYI030 | unnecessary-literal-union | Multiple literal members in a union. Use a single literal, e.g. Literal[{}] |
โ๏ธ ๐ ๏ธ |
PYI032 | any-eq-ne-annotation | Prefer object to Any for the second parameter to {method_name} |
โ๏ธ ๐ ๏ธ |
PYI033 | type-comment-in-stub | Don't use type comments in stub file | โ๏ธ |
PYI034 | non-self-return-type | __new__ methods usually return self at runtime |
โ๏ธ ๐ ๏ธ |
PYI035 | unassigned-special-variable-in-stub | {name} in a stub file must have a value, as it has the same semantics as {name} at runtime |
โ๏ธ |
PYI036 | bad-exit-annotation | Star-args in {method_name} should be annotated with object |
โ๏ธ ๐ ๏ธ |
PYI041 | redundant-numeric-union | Use {supertype} instead of {subtype} | {supertype} |
โ๏ธ |
PYI042 | snake-case-type-alias | Type alias {name} should be CamelCase |
โ๏ธ |
PYI043 | t-suffixed-type-alias | Private type alias {name} should not be suffixed with T (the T suffix implies that an object is a TypeVar ) |
โ๏ธ |
PYI044 | future-annotations-in-stub | from __future__ import annotations has no effect in stub files, since type checkers automatically treat stubs as having those semantics |
โ๏ธ ๐ ๏ธ |
PYI045 | iter-method-return-iterable | __aiter__ methods should return an AsyncIterator , not an AsyncIterable |
โ๏ธ |
PYI046 | unused-private-protocol | Private protocol {name} is never used |
โ๏ธ |
PYI047 | unused-private-type-alias | Private TypeAlias {name} is never used |
โ๏ธ |
PYI048 | stub-body-multiple-statements | Function body must contain exactly one statement | โ๏ธ |
PYI049 | unused-private-typed-dict | Private TypedDict {name} is never used |
โ๏ธ |
PYI050 | no-return-argument-annotation-in-stub | Prefer {module}.Never over NoReturn for argument annotations |
โ๏ธ |
PYI051 | redundant-literal-union | Literal[{literal}] is redundant in a union with {builtin_type} |
โ๏ธ |
PYI052 | unannotated-assignment-in-stub | Need type annotation for {name} |
โ๏ธ |
PYI053 | string-or-bytes-too-long | String and bytes literals longer than 50 characters are not permitted | โ๏ธ ๐ ๏ธ |
PYI054 | numeric-literal-too-long | Numeric literals with a string representation longer than ten characters are not permitted | โ๏ธ ๐ ๏ธ |
PYI055 | unnecessary-type-union | Multiple type members in a union. Combine them into one, e.g., type[{union_str}] . |
โ๏ธ ๐ ๏ธ |
PYI056 | unsupported-method-call-on-all | Calling .{name}() on __all__ may not be supported by all type checkers (use += instead) |
โ๏ธ |
PYI057 | byte-string-usage | Do not use {origin}.ByteString , which has unclear semantics and is deprecated |
โ๏ธ |
PYI058 | generator-return-from-iter-method | Use {return_type} as the return value for simple {method} methods |
โ๏ธ ๐ ๏ธ |
PYI059 | generic-not-last-base-class | Generic[] should always be the last base class |
๐งช ๐ ๏ธ |
PYI062 | duplicate-literal-member | Duplicate literal member {} |
โ๏ธ ๐ ๏ธ |
PYI063 | pre-pep570-positional-argument | Use PEP 570 syntax for positional-only arguments | ๐งช |
PYI064 | redundant-final-literal | Final[Literal[{literal}]] can be replaced with a bare Final |
๐งช ๐ ๏ธ |
PYI066 | bad-version-info-order | Use >= when using if -else with sys.version_info comparisons |
๐งช |
flake8-pytest-style (PT)
For more, see flake8-pytest-style on PyPI.
For related settings, see flake8-pytest-style.
Code | Name | Message | |
---|---|---|---|
PT001 | pytest-fixture-incorrect-parentheses-style | Use @pytest.fixture{expected} over @pytest.fixture{actual} |
โ๏ธ ๐ ๏ธ |
PT002 | pytest-fixture-positional-args | Configuration for fixture {function} specified via positional args, use kwargs |
โ๏ธ |
PT003 | pytest-extraneous-scope-function | scope='function' is implied in @pytest.fixture() |
โ๏ธ ๐ ๏ธ |
PT004 | pytest-missing-fixture-name-underscore | Fixture {function} does not return anything, add leading underscore |
โ ๏ธ |
PT005 | pytest-incorrect-fixture-name-underscore | Fixture {function} returns a value, remove leading underscore |
โ ๏ธ |
PT006 | pytest-parametrize-names-wrong-type | Wrong type passed to first argument of @pytest.mark.parametrize ; expected {expected_string} |
โ๏ธ ๐ ๏ธ |
PT007 | pytest-parametrize-values-wrong-type | Wrong values type in @pytest.mark.parametrize expected {values} of {row} |
โ๏ธ ๐ ๏ธ |
PT008 | pytest-patch-with-lambda | Use return_value= instead of patching with lambda |
โ๏ธ |
PT009 | pytest-unittest-assertion | Use a regular assert instead of unittest-style {assertion} |
โ๏ธ ๐ ๏ธ |
PT010 | pytest-raises-without-exception | set the expected exception in pytest.raises() |
โ๏ธ |
PT011 | pytest-raises-too-broad | pytest.raises({exception}) is too broad, set the match parameter or use a more specific exception |
โ๏ธ |
PT012 | pytest-raises-with-multiple-statements | pytest.raises() block should contain a single simple statement |
โ๏ธ |
PT013 | pytest-incorrect-pytest-import | Incorrect import of pytest ; use import pytest instead |
โ๏ธ |
PT014 | pytest-duplicate-parametrize-test-cases | Duplicate of test case at index {index} in @pytest_mark.parametrize |
โ๏ธ ๐ ๏ธ |
PT015 | pytest-assert-always-false | Assertion always fails, replace with pytest.fail() |
โ๏ธ |
PT016 | pytest-fail-without-message | No message passed to pytest.fail() |
โ๏ธ |
PT017 | pytest-assert-in-except | Found assertion on exception {name} in except block, use pytest.raises() instead |
โ๏ธ |
PT018 | pytest-composite-assertion | Assertion should be broken down into multiple parts | โ๏ธ ๐ ๏ธ |
PT019 | pytest-fixture-param-without-value | Fixture {name} without value is injected as parameter, use @pytest.mark.usefixtures instead |
โ๏ธ |
PT020 | pytest-deprecated-yield-fixture | @pytest.yield_fixture is deprecated, use @pytest.fixture |
โ๏ธ |
PT021 | pytest-fixture-finalizer-callback | Use yield instead of request.addfinalizer |
โ๏ธ |
PT022 | pytest-useless-yield-fixture | No teardown in fixture {name} , use return instead of yield |
โ๏ธ ๐ ๏ธ |
PT023 | pytest-incorrect-mark-parentheses-style | Use @pytest.mark.{mark_name}{expected_parens} over @pytest.mark.{mark_name}{actual_parens} |
โ๏ธ ๐ ๏ธ |
PT024 | pytest-unnecessary-asyncio-mark-on-fixture | pytest.mark.asyncio is unnecessary for fixtures |
โ๏ธ ๐ ๏ธ |
PT025 | pytest-erroneous-use-fixtures-on-fixture | pytest.mark.usefixtures has no effect on fixtures |
โ๏ธ ๐ ๏ธ |
PT026 | pytest-use-fixtures-without-parameters | Useless pytest.mark.usefixtures without parameters |
โ๏ธ ๐ ๏ธ |
PT027 | pytest-unittest-raises-assertion | Use pytest.raises instead of unittest-style {assertion} |
โ๏ธ ๐ ๏ธ |
flake8-quotes (Q)
For more, see flake8-quotes on PyPI.
For related settings, see flake8-quotes.
Code | Name | Message | |
---|---|---|---|
Q000 | bad-quotes-inline-string | Single quotes found but double quotes preferred | โ๏ธ ๐ ๏ธ |
Q001 | bad-quotes-multiline-string | Single quote multiline found but double quotes preferred | โ๏ธ ๐ ๏ธ |
Q002 | bad-quotes-docstring | Single quote docstring found but double quotes preferred | โ๏ธ ๐ ๏ธ |
Q003 | avoidable-escaped-quote | Change outer quotes to avoid escaping inner quotes | โ๏ธ ๐ ๏ธ |
Q004 | unnecessary-escaped-quote | Unnecessary escape on inner quote character | โ๏ธ ๐ ๏ธ |
flake8-raise (RSE)
For more, see flake8-raise on PyPI.
Code | Name | Message | |
---|---|---|---|
RSE102 | unnecessary-paren-on-raise-exception | Unnecessary parentheses on raised exception | โ๏ธ ๐ ๏ธ |
flake8-return (RET)
For more, see flake8-return on PyPI.
Code | Name | Message | |
---|---|---|---|
RET501 | unnecessary-return-none | Do not explicitly return None in function if it is the only possible return value |
โ๏ธ ๐ ๏ธ |
RET502 | implicit-return-value | Do not implicitly return None in function able to return non-None value |
โ๏ธ ๐ ๏ธ |
RET503 | implicit-return | Missing explicit return at the end of function able to return non-None value |
โ๏ธ ๐ ๏ธ |
RET504 | unnecessary-assign | Unnecessary assignment to {name} before return statement |
โ๏ธ ๐ ๏ธ |
RET505 | superfluous-else-return | Unnecessary {branch} after return statement |
โ๏ธ ๐ ๏ธ |
RET506 | superfluous-else-raise | Unnecessary {branch} after raise statement |
โ๏ธ ๐ ๏ธ |
RET507 | superfluous-else-continue | Unnecessary {branch} after continue statement |
โ๏ธ ๐ ๏ธ |
RET508 | superfluous-else-break | Unnecessary {branch} after break statement |
โ๏ธ ๐ ๏ธ |
flake8-self (SLF)
For more, see flake8-self on PyPI.
For related settings, see flake8-self.
Code | Name | Message | |
---|---|---|---|
SLF001 | private-member-access | Private member accessed: {access} |
โ๏ธ |
flake8-slots (SLOT)
For more, see flake8-slots on PyPI.
Code | Name | Message | |
---|---|---|---|
SLOT000 | no-slots-in-str-subclass | Subclasses of str should define __slots__ |
โ๏ธ |
SLOT001 | no-slots-in-tuple-subclass | Subclasses of tuple should define __slots__ |
โ๏ธ |
SLOT002 | no-slots-in-namedtuple-subclass | Subclasses of {namedtuple_kind} should define __slots__ |
โ๏ธ |
flake8-simplify (SIM)
For more, see flake8-simplify on PyPI.
Code | Name | Message | |
---|---|---|---|
SIM101 | duplicate-isinstance-call | Multiple isinstance calls for {name} , merge into a single call |
โ๏ธ ๐ ๏ธ |
SIM102 | collapsible-if | Use a single if statement instead of nested if statements |
โ๏ธ ๐ ๏ธ |
SIM103 | needless-bool | Return the condition {condition} directly |
โ๏ธ ๐ ๏ธ |
SIM105 | suppressible-exception | Use contextlib.suppress({exception}) instead of try -except -pass |
โ๏ธ ๐ ๏ธ |
SIM107 | return-in-try-except-finally | Don't use return in try -except and finally |
โ๏ธ |
SIM108 | if-else-block-instead-of-if-exp | Use ternary operator {contents} instead of if -else -block |
โ๏ธ ๐ ๏ธ |
SIM109 | compare-with-tuple | Use {replacement} instead of multiple equality comparisons |
โ๏ธ ๐ ๏ธ |
SIM110 | reimplemented-builtin | Use {replacement} instead of for loop |
โ๏ธ ๐ ๏ธ |
SIM112 | uncapitalized-environment-variables | Use capitalized environment variable {expected} instead of {actual} |
โ๏ธ ๐ ๏ธ |
SIM113 | enumerate-for-loop | Use enumerate() for index variable {index} in for loop |
โ๏ธ |
SIM114 | if-with-same-arms | Combine if branches using logical or operator |
โ๏ธ ๐ ๏ธ |
SIM115 | open-file-with-context-handler | Use a context manager for opening files | โ๏ธ |
SIM116 | if-else-block-instead-of-dict-lookup | Use a dictionary instead of consecutive if statements |
โ๏ธ |
SIM117 | multiple-with-statements | Use a single with statement with multiple contexts instead of nested with statements |
โ๏ธ ๐ ๏ธ |
SIM118 | in-dict-keys | Use key {operator} dict instead of key {operator} dict.keys() |
โ๏ธ ๐ ๏ธ |
SIM201 | negate-equal-op | Use {left} != {right} instead of not {left} == {right} |
โ๏ธ ๐ ๏ธ |
SIM202 | negate-not-equal-op | Use {left} == {right} instead of not {left} != {right} |
โ๏ธ ๐ ๏ธ |
SIM208 | double-negation | Use {expr} instead of not (not {expr}) |
โ๏ธ ๐ ๏ธ |
SIM210 | if-expr-with-true-false | Remove unnecessary True if ... else False |
โ๏ธ ๐ ๏ธ |
SIM211 | if-expr-with-false-true | Use not ... instead of False if ... else True |
โ๏ธ ๐ ๏ธ |
SIM212 | if-expr-with-twisted-arms | Use {expr_else} if {expr_else} else {expr_body} instead of {expr_body} if not {expr_else} else {expr_else} |
โ๏ธ ๐ ๏ธ |
SIM220 | expr-and-not-expr | Use False instead of {name} and not {name} |
โ๏ธ ๐ ๏ธ |
SIM221 | expr-or-not-expr | Use True instead of {name} or not {name} |
โ๏ธ ๐ ๏ธ |
SIM222 | expr-or-true | Use {expr} instead of {replaced} |
โ๏ธ ๐ ๏ธ |
SIM223 | expr-and-false | Use {expr} instead of {replaced} |
โ๏ธ ๐ ๏ธ |
SIM300 | yoda-conditions | Yoda condition detected | โ๏ธ ๐ ๏ธ |
SIM401 | if-else-block-instead-of-dict-get | Use {contents} instead of an if block |
โ๏ธ ๐ ๏ธ |
SIM905 | split-static-string | Consider using a list literal instead of str.split |
๐งช ๐ ๏ธ |
SIM910 | dict-get-with-none-default | Use {expected} instead of {actual} |
โ๏ธ ๐ ๏ธ |
SIM911 | zip-dict-keys-and-values | Use {expected} instead of {actual} |
โ๏ธ ๐ ๏ธ |
flake8-tidy-imports (TID)
For more, see flake8-tidy-imports on PyPI.
For related settings, see flake8-tidy-imports.
Code | Name | Message | |
---|---|---|---|
TID251 | banned-api | {name} is banned: {message} |
โ๏ธ |
TID252 | relative-imports | Prefer absolute imports over relative imports from parent modules | โ๏ธ ๐ ๏ธ |
TID253 | banned-module-level-imports | {name} is banned at the module level |
โ๏ธ |
flake8-type-checking (TCH)
For more, see flake8-type-checking on PyPI.
For related settings, see flake8-type-checking.
Code | Name | Message | |
---|---|---|---|
TCH001 | typing-only-first-party-import | Move application import {} into a type-checking block |
โ๏ธ ๐ ๏ธ |
TCH002 | typing-only-third-party-import | Move third-party import {} into a type-checking block |
โ๏ธ ๐ ๏ธ |
TCH003 | typing-only-standard-library-import | Move standard library import {} into a type-checking block |
โ๏ธ ๐ ๏ธ |
TCH004 | runtime-import-in-type-checking-block | Move import {qualified_name} out of type-checking block. Import is used for more than type hinting. |
โ๏ธ ๐ ๏ธ |
TCH005 | empty-type-checking-block | Found empty type-checking block | โ๏ธ ๐ ๏ธ |
TCH010 | runtime-string-union | Invalid string member in X | Y -style union type |
โ๏ธ |
flake8-gettext (INT)
For more, see flake8-gettext on PyPI.
For related settings, see flake8-gettext.
Code | Name | Message | |
---|---|---|---|
INT001 | f-string-in-get-text-func-call | f-string is resolved before function call; consider _("string %s") % arg |
โ๏ธ |
INT002 | format-in-get-text-func-call | format method argument is resolved before function call; consider _("string %s") % arg |
โ๏ธ |
INT003 | printf-in-get-text-func-call | printf-style format is resolved before function call; consider _("string %s") % arg |
โ๏ธ |
flake8-unused-arguments (ARG)
For more, see flake8-unused-arguments on PyPI.
For related settings, see flake8-unused-arguments.
Code | Name | Message | |
---|---|---|---|
ARG001 | unused-function-argument | Unused function argument: {name} |
โ๏ธ |
ARG002 | unused-method-argument | Unused method argument: {name} |
โ๏ธ |
ARG003 | unused-class-method-argument | Unused class method argument: {name} |
โ๏ธ |
ARG004 | unused-static-method-argument | Unused static method argument: {name} |
โ๏ธ |
ARG005 | unused-lambda-argument | Unused lambda argument: {name} |
โ๏ธ |
flake8-use-pathlib (PTH)
For more, see flake8-use-pathlib on PyPI.
Code | Name | Message | |
---|---|---|---|
PTH100 | os-path-abspath | os.path.abspath() should be replaced by Path.resolve() |
โ๏ธ |
PTH101 | os-chmod | os.chmod() should be replaced by Path.chmod() |
โ๏ธ |
PTH102 | os-mkdir | os.mkdir() should be replaced by Path.mkdir() |
โ๏ธ |
PTH103 | os-makedirs | os.makedirs() should be replaced by Path.mkdir(parents=True) |
โ๏ธ |
PTH104 | os-rename | os.rename() should be replaced by Path.rename() |
โ๏ธ |
PTH105 | os-replace | os.replace() should be replaced by Path.replace() |
โ๏ธ |
PTH106 | os-rmdir | os.rmdir() should be replaced by Path.rmdir() |
โ๏ธ |
PTH107 | os-remove | os.remove() should be replaced by Path.unlink() |
โ๏ธ |
PTH108 | os-unlink | os.unlink() should be replaced by Path.unlink() |
โ๏ธ |
PTH109 | os-getcwd | os.getcwd() should be replaced by Path.cwd() |
โ๏ธ |
PTH110 | os-path-exists | os.path.exists() should be replaced by Path.exists() |
โ๏ธ |
PTH111 | os-path-expanduser | os.path.expanduser() should be replaced by Path.expanduser() |
โ๏ธ |
PTH112 | os-path-isdir | os.path.isdir() should be replaced by Path.is_dir() |
โ๏ธ |
PTH113 | os-path-isfile | os.path.isfile() should be replaced by Path.is_file() |
โ๏ธ |
PTH114 | os-path-islink | os.path.islink() should be replaced by Path.is_symlink() |
โ๏ธ |
PTH115 | os-readlink | os.readlink() should be replaced by Path.readlink() |
โ๏ธ |
PTH116 | os-stat | os.stat() should be replaced by Path.stat() , Path.owner() , or Path.group() |
โ๏ธ |
PTH117 | os-path-isabs | os.path.isabs() should be replaced by Path.is_absolute() |
โ๏ธ |
PTH118 | os-path-join | os.{module}.join() should be replaced by Path with / operator |
โ๏ธ |
PTH119 | os-path-basename | os.path.basename() should be replaced by Path.name |
โ๏ธ |
PTH120 | os-path-dirname | os.path.dirname() should be replaced by Path.parent |
โ๏ธ |
PTH121 | os-path-samefile | os.path.samefile() should be replaced by Path.samefile() |
โ๏ธ |
PTH122 | os-path-splitext | os.path.splitext() should be replaced by Path.suffix , Path.stem , and Path.parent |
โ๏ธ |
PTH123 | builtin-open | open() should be replaced by Path.open() |
โ๏ธ |
PTH124 | py-path | py.path is in maintenance mode, use pathlib instead |
โ๏ธ |
PTH201 | path-constructor-current-directory | Do not pass the current directory explicitly to Path |
โ๏ธ ๐ ๏ธ |
PTH202 | os-path-getsize | os.path.getsize should be replaced by Path.stat().st_size |
โ๏ธ |
PTH203 | os-path-getatime | os.path.getatime should be replaced by Path.stat().st_atime |
โ๏ธ |
PTH204 | os-path-getmtime | os.path.getmtime should be replaced by Path.stat().st_mtime |
โ๏ธ |
PTH205 | os-path-getctime | os.path.getctime should be replaced by Path.stat().st_ctime |
โ๏ธ |
PTH206 | os-sep-split | Replace .split(os.sep) with Path.parts |
โ๏ธ |
PTH207 | glob | Replace {function} with Path.glob or Path.rglob |
โ๏ธ |
flake8-todos (TD)
For more, see flake8-todos on GitHub.
Code | Name | Message | |
---|---|---|---|
TD001 | invalid-todo-tag | Invalid TODO tag: {tag} |
โ๏ธ |
TD002 | missing-todo-author | Missing author in TODO; try: # TODO(<author_name>): ... or # TODO @<author_name>: ... |
โ๏ธ |
TD003 | missing-todo-link | Missing issue link on the line following this TODO | โ๏ธ |
TD004 | missing-todo-colon | Missing colon in TODO | โ๏ธ |
TD005 | missing-todo-description | Missing issue description after TODO |
โ๏ธ |
TD006 | invalid-todo-capitalization | Invalid TODO capitalization: {tag} should be TODO |
โ๏ธ ๐ ๏ธ |
TD007 | missing-space-after-todo-colon | Missing space after colon in TODO | โ๏ธ |
flake8-fixme (FIX)
For more, see flake8-fixme on GitHub.
Code | Name | Message | |
---|---|---|---|
FIX001 | line-contains-fixme | Line contains FIXME, consider resolving the issue | โ๏ธ |
FIX002 | line-contains-todo | Line contains TODO, consider resolving the issue | โ๏ธ |
FIX003 | line-contains-xxx | Line contains XXX, consider resolving the issue | โ๏ธ |
FIX004 | line-contains-hack | Line contains HACK, consider resolving the issue | โ๏ธ |
eradicate (ERA)
For more, see eradicate on PyPI.
Code | Name | Message | |
---|---|---|---|
ERA001 | commented-out-code | Found commented-out code | โ๏ธ |
pandas-vet (PD)
For more, see pandas-vet on PyPI.
Code | Name | Message | |
---|---|---|---|
PD002 | pandas-use-of-inplace-argument | inplace=True should be avoided; it has inconsistent behavior |
โ๏ธ ๐ ๏ธ |
PD003 | pandas-use-of-dot-is-null | .isna is preferred to .isnull ; functionality is equivalent |
โ๏ธ |
PD004 | pandas-use-of-dot-not-null | .notna is preferred to .notnull ; functionality is equivalent |
โ๏ธ |
PD007 | pandas-use-of-dot-ix | .ix is deprecated; use more explicit .loc or .iloc |
โ๏ธ |
PD008 | pandas-use-of-dot-at | Use .loc instead of .at . If speed is important, use NumPy. |
โ๏ธ |
PD009 | pandas-use-of-dot-iat | Use .iloc instead of .iat . If speed is important, use NumPy. |
โ๏ธ |
PD010 | pandas-use-of-dot-pivot-or-unstack | .pivot_table is preferred to .pivot or .unstack ; provides same functionality |
โ๏ธ |
PD011 | pandas-use-of-dot-values | Use .to_numpy() instead of .values |
โ๏ธ |
PD012 | pandas-use-of-dot-read-table | Use .read_csv instead of .read_table to read CSV files |
โ๏ธ |
PD013 | pandas-use-of-dot-stack | .melt is preferred to .stack ; provides same functionality |
โ๏ธ |
PD015 | pandas-use-of-pd-merge | Use .merge method instead of pd.merge function. They have equivalent functionality. |
โ๏ธ |
PD101 | pandas-nunique-constant-series-check | Using series.nunique() for checking that a series is constant is inefficient |
โ๏ธ |
PD901 | pandas-df-variable-name | Avoid using the generic variable name df for DataFrames |
โ๏ธ |
pygrep-hooks (PGH)
For more, see pygrep-hooks on GitHub.
Code | Name | Message | |
---|---|---|---|
PGH001 | eval | No builtin eval() allowed |
โ |
PGH002 | deprecated-log-warn | warn is deprecated in favor of warning |
โ ๐ ๏ธ |
PGH003 | blanket-type-ignore | Use specific rule codes when ignoring type issues | โ๏ธ |
PGH004 | blanket-noqa | Use specific rule codes when using noqa |
โ๏ธ ๐ ๏ธ |
PGH005 | invalid-mock-access | Mock method should be called: {name} |
โ๏ธ |
Pylint (PL)
For more, see Pylint on PyPI.
Convention (C)
Code | Name | Message | |
---|---|---|---|
PLC0105 | type-name-incorrect-variance | {kind} name "{param_name}" does not reflect its {variance}; consider renaming it to "{replacement_name}" |
โ๏ธ |
PLC0131 | type-bivariance | {kind} cannot be both covariant and contravariant |
โ๏ธ |
PLC0132 | type-param-name-mismatch | {kind} name {param_name} does not match assigned variable name {var_name} |
โ๏ธ |
PLC0205 | single-string-slots | Class __slots__ should be a non-string iterable |
โ๏ธ |
PLC0206 | dict-index-missing-items | Extracting value from dictionary without calling .items() |
๐งช |
PLC0208 | iteration-over-set | Use a sequence type instead of a set when iterating over values |
โ๏ธ ๐ ๏ธ |
PLC0414 | useless-import-alias | Import alias does not rename original package | โ๏ธ ๐ ๏ธ |
PLC0415 | import-outside-top-level | import should be at the top-level of a file |
๐งช |
PLC1901 | compare-to-empty-string | {existing} can be simplified to {replacement} as an empty string is falsey |
๐งช |
PLC2401 | non-ascii-name | {kind} name {name} contains a non-ASCII character |
โ๏ธ |
PLC2403 | non-ascii-import-name | Module alias {name} contains a non-ASCII character |
โ๏ธ |
PLC2701 | import-private-name | Private name import {name} from external module {module} |
๐งช |
PLC2801 | unnecessary-dunder-call | Unnecessary dunder call to {method} . {replacement}. |
๐งช ๐ ๏ธ |
PLC3002 | unnecessary-direct-lambda-call | Lambda expression called directly. Execute the expression inline instead. | โ๏ธ |
Error (E)
Code | Name | Message | |
---|---|---|---|
PLE0100 | yield-in-init | __init__ method is a generator |
โ๏ธ |
PLE0101 | return-in-init | Explicit return in __init__ |
โ๏ธ |
PLE0115 | nonlocal-and-global | Name {name} is both nonlocal and global |
โ๏ธ |
PLE0116 | continue-in-finally | continue not supported inside finally clause |
โ๏ธ |
PLE0117 | nonlocal-without-binding | Nonlocal name {name} found without binding |
โ๏ธ |
PLE0118 | load-before-global-declaration | Name {name} is used prior to global declaration on {row} |
โ๏ธ |
PLE0237 | non-slot-assignment | Attribute {name} is not defined in class's __slots__ |
โ๏ธ |
PLE0241 | duplicate-bases | Duplicate base {base} for class {class} |
โ๏ธ ๐ ๏ธ |
PLE0302 | unexpected-special-method-signature | The special method {} expects {}, {} {} given |
โ๏ธ |
PLE0303 | invalid-length-return-type | __len__ does not return a non-negative integer |
โ๏ธ |
PLE0304 | invalid-bool-return-type | __bool__ does not return bool |
๐งช |
PLE0305 | invalid-index-return-type | __index__ does not return an integer |
โ๏ธ |
PLE0307 | invalid-str-return-type | __str__ does not return str |
โ๏ธ |
PLE0308 | invalid-bytes-return-type | __bytes__ does not return bytes |
โ๏ธ |
PLE0309 | invalid-hash-return-type | __hash__ does not return an integer |
โ๏ธ |
PLE0604 | invalid-all-object | Invalid object in __all__ , must contain only strings |
โ๏ธ |
PLE0605 | invalid-all-format | Invalid format for __all__ , must be tuple or list |
โ๏ธ |
PLE0643 | potential-index-error | Expression is likely to raise IndexError |
โ๏ธ |
PLE0704 | misplaced-bare-raise | Bare raise statement is not inside an exception handler |
โ๏ธ |
PLE1132 | repeated-keyword-argument | Repeated keyword argument: {duplicate_keyword} |
โ๏ธ |
PLE1141 | dict-iter-missing-items | Unpacking a dictionary in iteration without calling .items() |
๐งช ๐ ๏ธ |
PLE1142 | await-outside-async | await should be used within an async function |
โ๏ธ |
PLE1205 | logging-too-many-args | Too many arguments for logging format string |
โ๏ธ |
PLE1206 | logging-too-few-args | Not enough arguments for logging format string |
โ๏ธ |
PLE1300 | bad-string-format-character | Unsupported format character '{format_char}' | โ๏ธ |
PLE1307 | bad-string-format-type | Format type does not match argument type | โ๏ธ |
PLE1310 | bad-str-strip-call | String {strip} call contains duplicate characters (did you mean {removal} ?) |
โ๏ธ |
PLE1507 | invalid-envvar-value | Invalid type for initial os.getenv argument; expected str |
โ๏ธ |
PLE1519 | singledispatch-method | @singledispatch decorator should not be used on methods |
โ๏ธ ๐ ๏ธ |
PLE1520 | singledispatchmethod-function | @singledispatchmethod decorator should not be used on non-method functions |
โ๏ธ ๐ ๏ธ |
PLE1700 | yield-from-in-async-function | yield from statement in async function; use async for instead |
โ๏ธ |
PLE2502 | bidirectional-unicode | Contains control characters that can permit obfuscated code | โ๏ธ |
PLE2510 | invalid-character-backspace | Invalid unescaped character backspace, use "\b" instead | โ๏ธ ๐ ๏ธ |
PLE2512 | invalid-character-sub | Invalid unescaped character SUB, use "\x1A" instead | โ๏ธ ๐ ๏ธ |
PLE2513 | invalid-character-esc | Invalid unescaped character ESC, use "\x1B" instead | โ๏ธ ๐ ๏ธ |
PLE2514 | invalid-character-nul | Invalid unescaped character NUL, use "\0" instead | โ๏ธ ๐ ๏ธ |
PLE2515 | invalid-character-zero-width-space | Invalid unescaped character zero-width-space, use "\u200B" instead | โ๏ธ ๐ ๏ธ |
PLE4703 | modified-iterating-set | Iterated set {name} is modified within the for loop |
๐งช ๐ ๏ธ |
Refactor (R)
Code | Name | Message | |
---|---|---|---|
PLR0124 | comparison-with-itself | Name compared with itself, consider replacing {actual} |
โ๏ธ |
PLR0133 | comparison-of-constant | Two constants compared in a comparison, consider replacing {left_constant} {op} {right_constant} |
โ๏ธ |
PLR0202 | no-classmethod-decorator | Class method defined without decorator | ๐งช ๐ ๏ธ |
PLR0203 | no-staticmethod-decorator | Static method defined without decorator | ๐งช ๐ ๏ธ |
PLR0206 | property-with-parameters | Cannot have defined parameters for properties | โ๏ธ |
PLR0402 | manual-from-import | Use from {module} import {name} in lieu of alias |
โ๏ธ ๐ ๏ธ |
PLR0904 | too-many-public-methods | Too many public methods ({methods} > {max_methods}) | ๐งช |
PLR0911 | too-many-return-statements | Too many return statements ({returns} > {max_returns}) | โ๏ธ |
PLR0912 | too-many-branches | Too many branches ({branches} > {max_branches}) | โ๏ธ |
PLR0913 | too-many-arguments | Too many arguments in function definition ({c_args} > {max_args}) | โ๏ธ |
PLR0914 | too-many-locals | Too many local variables ({current_amount}/{max_amount}) | ๐งช |
PLR0915 | too-many-statements | Too many statements ({statements} > {max_statements}) | โ๏ธ |
PLR0916 | too-many-boolean-expressions | Too many Boolean expressions ({expressions} > {max_expressions}) | ๐งช |
PLR0917 | too-many-positional-arguments | Too many positional arguments ({c_pos}/{max_pos}) | ๐งช |
PLR1701 | repeated-isinstance-calls | Merge isinstance calls: {expression} |
โ ๐ ๏ธ |
PLR1702 | too-many-nested-blocks | Too many nested blocks ({nested_blocks} > {max_nested_blocks}) | ๐งช |
PLR1704 | redefined-argument-from-local | Redefining argument with the local name {name} |
โ๏ธ |
PLR1706 | and-or-ternary | Consider using if-else expression | โ |
PLR1711 | useless-return | Useless return statement at end of function |
โ๏ธ ๐ ๏ธ |
PLR1714 | repeated-equality-comparison | Consider merging multiple comparisons: {expression} . Use a set if the elements are hashable. |
โ๏ธ ๐ ๏ธ |
PLR1716 | boolean-chained-comparison | Contains chained boolean comparison that can be simplified | ๐งช ๐ ๏ธ |
PLR1722 | sys-exit-alias | Use sys.exit() instead of {name} |
โ๏ธ ๐ ๏ธ |
PLR1730 | if-stmt-min-max | Replace if statement with {replacement} |
โ๏ธ ๐ ๏ธ |
PLR1733 | unnecessary-dict-index-lookup | Unnecessary lookup of dictionary value by key | ๐งช ๐ ๏ธ |
PLR1736 | unnecessary-list-index-lookup | List index lookup in enumerate() loop |
โ๏ธ ๐ ๏ธ |
PLR2004 | magic-value-comparison | Magic value used in comparison, consider replacing {value} with a constant variable |
โ๏ธ |
PLR2044 | empty-comment | Line with empty comment | โ๏ธ ๐ ๏ธ |
PLR5501 | collapsible-else-if | Use elif instead of else then if , to reduce indentation |
โ๏ธ ๐ ๏ธ |
PLR6104 | non-augmented-assignment | Use {operator} to perform an augmented assignment directly |
๐งช ๐ ๏ธ |
PLR6201 | literal-membership | Use a set literal when testing for membership | ๐งช ๐ ๏ธ |
PLR6301 | no-self-use | Method {method_name} could be a function, class method, or static method |
๐งช |
Warning (W)
Code | Name | Message | |
---|---|---|---|
PLW0108 | unnecessary-lambda | Lambda may be unnecessary; consider inlining inner function | ๐งช ๐ ๏ธ |
PLW0120 | useless-else-on-loop | else clause on loop without a break statement; remove the else and dedent its contents |
โ๏ธ ๐ ๏ธ |
PLW0127 | self-assigning-variable | Self-assignment of variable {name} |
โ๏ธ |
PLW0128 | redeclared-assigned-name | Redeclared variable {name} in assignment |
โ๏ธ |
PLW0129 | assert-on-string-literal | Asserting on an empty string literal will never pass | โ๏ธ |
PLW0131 | named-expr-without-context | Named expression used without context | โ๏ธ |
PLW0133 | useless-exception-statement | Missing raise statement on exception |
โ๏ธ ๐ ๏ธ |
PLW0177 | nan-comparison | Comparing against a NaN value; use math.isnan instead |
๐งช |
PLW0211 | bad-staticmethod-argument | First argument of a static method should not be named {argument_name} |
โ๏ธ |
PLW0245 | super-without-brackets | super call is missing parentheses |
โ๏ธ ๐ ๏ธ |
PLW0406 | import-self | Module {name} imports itself |
โ๏ธ |
PLW0602 | global-variable-not-assigned | Using global for {name} but no assignment is done |
โ๏ธ |
PLW0603 | global-statement | Using the global statement to update {name} is discouraged |
โ๏ธ |
PLW0604 | global-at-module-level | global at module level is redundant |
โ๏ธ |
PLW0642 | self-or-cls-assignment | Reassigned {} variable in {method_type} method |
โ๏ธ |
PLW0711 | binary-op-exception | Exception to catch is the result of a binary and operation |
โ๏ธ |
PLW1501 | bad-open-mode | {mode} is not a valid mode for open |
โ๏ธ |
PLW1507 | shallow-copy-environ | Shallow copy of os.environ via copy.copy(os.environ) |
๐งช ๐ ๏ธ |
PLW1508 | invalid-envvar-default | Invalid type for environment variable default; expected str or None |
โ๏ธ |
PLW1509 | subprocess-popen-preexec-fn | preexec_fn argument is unsafe when using threads |
โ๏ธ |
PLW1510 | subprocess-run-without-check | subprocess.run without explicit check argument |
โ๏ธ ๐ ๏ธ |
PLW1514 | unspecified-encoding | {function_name} in text mode without explicit encoding argument |
๐งช ๐ ๏ธ |
PLW1641 | eq-without-hash | Object does not implement __hash__ method |
๐งช |
PLW2101 | useless-with-lock | Threading lock directly created in with statement has no effect |
โ๏ธ |
PLW2901 | redefined-loop-name | Outer {outer_kind} variable {name} overwritten by inner {inner_kind} target |
โ๏ธ |
PLW3201 | bad-dunder-method-name | Dunder method {name} has no special meaning in Python 3 |
๐งช |
PLW3301 | nested-min-max | Nested {func} calls can be flattened |
โ๏ธ ๐ ๏ธ |
tryceratops (TRY)
For more, see tryceratops on PyPI.
Code | Name | Message | |
---|---|---|---|
TRY002 | raise-vanilla-class | Create your own exception | โ๏ธ |
TRY003 | raise-vanilla-args | Avoid specifying long messages outside the exception class | โ๏ธ |
TRY004 | type-check-without-type-error | Prefer TypeError exception for invalid type |
โ๏ธ |
TRY200 | reraise-no-cause | Use raise from to specify exception cause |
โ |
TRY201 | verbose-raise | Use raise without specifying exception name |
โ๏ธ ๐ ๏ธ |
TRY203 | useless-try-except | Remove exception handler; error is immediately re-raised | โ๏ธ |
TRY300 | try-consider-else | Consider moving this statement to an else block |
โ๏ธ |
TRY301 | raise-within-try | Abstract raise to an inner function |
โ๏ธ |
TRY400 | error-instead-of-exception | Use logging.exception instead of logging.error |
โ๏ธ ๐ ๏ธ |
TRY401 | verbose-log-message | Redundant exception object included in logging.exception call |
โ๏ธ |
flynt (FLY)
For more, see flynt on PyPI.
Code | Name | Message | |
---|---|---|---|
FLY002 | static-join-to-f-string | Consider {expression} instead of string join |
โ๏ธ ๐ ๏ธ |
NumPy-specific rules (NPY)
Code | Name | Message | |
---|---|---|---|
NPY001 | numpy-deprecated-type-alias | Type alias np.{type_name} is deprecated, replace with builtin type |
โ๏ธ ๐ ๏ธ |
NPY002 | numpy-legacy-random | Replace legacy np.random.{method_name} call with np.random.Generator |
โ๏ธ |
NPY003 | numpy-deprecated-function | np.{existing} is deprecated; use np.{replacement} instead |
โ๏ธ ๐ ๏ธ |
NPY201 | numpy2-deprecation | np.{existing} will be removed in NumPy 2.0. {migration_guide} |
โ๏ธ ๐ ๏ธ |
FastAPI (FAST)
For more, see FastAPI on PyPI.
Code | Name | Message | |
---|---|---|---|
FAST001 | fast-api-redundant-response-model | FastAPI route with redundant response_model argument |
๐งช ๐ ๏ธ |
FAST002 | fast-api-non-annotated-dependency | FastAPI dependency without Annotated |
๐งช ๐ ๏ธ |
FAST003 | fast-api-unused-path-parameter | Parameter {arg_name} appears in route path, but not in {function_name} signature |
๐งช ๐ ๏ธ |
Airflow (AIR)
For more, see Airflow on PyPI.
Code | Name | Message | |
---|---|---|---|
AIR001 | airflow-variable-name-task-id-mismatch | Task variable name should match the task_id : "{task_id}" |
โ๏ธ |
Perflint (PERF)
For more, see Perflint on PyPI.
Code | Name | Message | |
---|---|---|---|
PERF101 | unnecessary-list-cast | Do not cast an iterable to list before iterating over it |
โ๏ธ ๐ ๏ธ |
PERF102 | incorrect-dict-iterator | When using only the {subset} of a dict use the {subset}() method |
โ๏ธ ๐ ๏ธ |
PERF203 | try-except-in-loop | try -except within a loop incurs performance overhead |
โ๏ธ |
PERF401 | manual-list-comprehension | Use {message_str} to create a transformed list | โ๏ธ ๐ ๏ธ |
PERF402 | manual-list-copy | Use list or list.copy to create a copy of a list |
โ๏ธ |
PERF403 | manual-dict-comprehension | Use a dictionary comprehension instead of a for-loop | โ๏ธ |
refurb (FURB)
For more, see refurb on PyPI.
Code | Name | Message | |
---|---|---|---|
FURB101 | read-whole-file | open and read should be replaced by Path({filename}).{suggestion} |
๐งช |
FURB103 | write-whole-file | open and write should be replaced by Path({filename}).{suggestion} |
๐งช |
FURB105 | print-empty-string | Unnecessary empty string passed to print |
โ๏ธ ๐ ๏ธ |
FURB110 | if-exp-instead-of-or-operator | Replace ternary if expression with or operator |
๐งช ๐ ๏ธ |
FURB113 | repeated-append | Use {suggestion} instead of repeatedly calling {name}.append() |
๐งช ๐ ๏ธ |
FURB116 | f-string-number-format | Replace {function_name} call with {display} |
๐งช ๐ ๏ธ |
FURB118 | reimplemented-operator | Use operator.{operator} instead of defining a function |
๐งช ๐ ๏ธ |
FURB129 | readlines-in-for | Instead of calling readlines() , iterate over file object directly |
โ๏ธ ๐ ๏ธ |
FURB131 | delete-full-slice | Prefer clear over deleting a full slice |
๐งช ๐ ๏ธ |
FURB132 | check-and-remove-from-set | Use {suggestion} instead of check and remove |
๐งช ๐ ๏ธ |
FURB136 | if-expr-min-max | Replace if expression with {min_max} call |
โ๏ธ ๐ ๏ธ |
FURB140 | reimplemented-starmap | Use itertools.starmap instead of the generator |
๐งช ๐ ๏ธ |
FURB142 | for-loop-set-mutations | Use of set.{}() in a for loop |
๐งช ๐ ๏ธ |
FURB145 | slice-copy | Prefer copy method over slicing |
๐งช ๐ ๏ธ |
FURB148 | unnecessary-enumerate | enumerate value is unused, use for x in range(len(y)) instead |
๐งช ๐ ๏ธ |
FURB152 | math-constant | Replace {literal} with math.{constant} |
๐งช ๐ ๏ธ |
FURB154 | repeated-global | Use of repeated consecutive {} |
๐งช ๐ ๏ธ |
FURB156 | hardcoded-string-charset | Use of hardcoded string charset | ๐งช ๐ ๏ธ |
FURB157 | verbose-decimal-constructor | Verbose expression in Decimal constructor |
๐งช ๐ ๏ธ |
FURB161 | bit-count | Use of bin({existing}).count('1') |
โ๏ธ ๐ ๏ธ |
FURB163 | redundant-log-base | Prefer math.{log_function}({arg}) over math.log with a redundant base |
โ๏ธ ๐ ๏ธ |
FURB164 | unnecessary-from-float | Verbose method {method_name} in {constructor} construction |
๐งช ๐ ๏ธ |
FURB166 | int-on-sliced-str | Use of int with explicit base={base} after removing prefix |
๐งช ๐ ๏ธ |
FURB167 | regex-flag-alias | Use of regular expression alias re.{} |
โ๏ธ ๐ ๏ธ |
FURB168 | isinstance-type-none | Prefer is operator over isinstance to check if an object is None |
โ๏ธ ๐ ๏ธ |
FURB169 | type-none-comparison | Compare the identities of {object} and None instead of their respective types |
โ๏ธ ๐ ๏ธ |
FURB171 | single-item-membership-test | Membership test against single-item container | ๐งช ๐ ๏ธ |
FURB177 | implicit-cwd | Prefer Path.cwd() over Path().resolve() for current-directory lookups |
โ๏ธ ๐ ๏ธ |
FURB180 | meta-class-abc-meta | Use of metaclass=abc.ABCMeta to define abstract base class |
๐งช ๐ ๏ธ |
FURB181 | hashlib-digest-hex | Use of hashlib's .digest().hex() |
โ๏ธ ๐ ๏ธ |
FURB187 | list-reverse-copy | Use of assignment of reversed on list {name} |
โ๏ธ ๐ ๏ธ |
FURB188 | slice-to-remove-prefix-or-suffix | Prefer removeprefix over conditionally replacing with slice. |
๐งช ๐ ๏ธ |
FURB189 | subclass-builtin | Subclassing {subclass} can be error prone, use collections.{replacement} instead |
๐งช ๐ ๏ธ |
FURB192 | sorted-min-max | Prefer min over sorted() to compute the minimum value in a sequence |
๐งช ๐ ๏ธ |
pydoclint (DOC)
For more, see pydoclint on PyPI.
Code | Name | Message | |
---|---|---|---|
DOC201 | docstring-missing-returns | return is not documented in docstring |
๐งช |
DOC202 | docstring-extraneous-returns | Docstring should not have a returns section because the function doesn't return anything | ๐งช |
DOC402 | docstring-missing-yields | yield is not documented in docstring |
๐งช |
DOC403 | docstring-extraneous-yields | Docstring has a "Yields" section but the function doesn't yield anything | ๐งช |
DOC501 | docstring-missing-exception | Raised exception {id} missing from docstring |
๐งช |
DOC502 | docstring-extraneous-exception | Raised exception is not explicitly raised: {id} |
๐งช |
Ruff-specific rules (RUF)
Code | Name | Message | |
---|---|---|---|
RUF001 | ambiguous-unicode-character-string | String contains ambiguous {}. Did you mean {}? | โ๏ธ |
RUF002 | ambiguous-unicode-character-docstring | Docstring contains ambiguous {}. Did you mean {}? | โ๏ธ |
RUF003 | ambiguous-unicode-character-comment | Comment contains ambiguous {}. Did you mean {}? | โ๏ธ |
RUF005 | collection-literal-concatenation | Consider {expression} instead of concatenation |
โ๏ธ ๐ ๏ธ |
RUF006 | asyncio-dangling-task | Store a reference to the return value of {expr}.{method} |
โ๏ธ |
RUF007 | zip-instead-of-pairwise | Prefer itertools.pairwise() over zip() when iterating over successive pairs |
โ๏ธ ๐ ๏ธ |
RUF008 | mutable-dataclass-default | Do not use mutable default values for dataclass attributes | โ๏ธ |
RUF009 | function-call-in-dataclass-default-argument | Do not perform function call {name} in dataclass defaults |
โ๏ธ |
RUF010 | explicit-f-string-type-conversion | Use explicit conversion flag | โ๏ธ ๐ ๏ธ |
RUF011 | ruff-static-key-dict-comprehension | Dictionary comprehension uses static key | โ |
RUF012 | mutable-class-default | Mutable class attributes should be annotated with typing.ClassVar |
โ๏ธ |
RUF013 | implicit-optional | PEP 484 prohibits implicit Optional |
โ๏ธ ๐ ๏ธ |
RUF015 | unnecessary-iterable-allocation-for-first-element | Prefer next({iterable}) over single element slice |
โ๏ธ ๐ ๏ธ |
RUF016 | invalid-index-type | Slice in indexed access to type {value_type} uses type {index_type} instead of an integer |
โ๏ธ |
RUF017 | quadratic-list-summation | Avoid quadratic list summation | โ๏ธ ๐ ๏ธ |
RUF018 | assignment-in-assert | Avoid assignment expressions in assert statements |
โ๏ธ |
RUF019 | unnecessary-key-check | Unnecessary key check before dictionary access | โ๏ธ ๐ ๏ธ |
RUF020 | never-union | {never_like} | T is equivalent to T |
โ๏ธ ๐ ๏ธ |
RUF021 | parenthesize-chained-operators | Parenthesize a and b expressions when chaining and and or together, to make the precedence clear |
๐งช ๐ ๏ธ |
RUF022 | unsorted-dunder-all | __all__ is not sorted |
๐งช ๐ ๏ธ |
RUF023 | unsorted-dunder-slots | {}.__slots__ is not sorted |
๐งช ๐ ๏ธ |
RUF024 | mutable-fromkeys-value | Do not pass mutable objects as values to dict.fromkeys |
โ๏ธ ๐ ๏ธ |
RUF026 | default-factory-kwarg | default_factory is a positional-only argument to defaultdict |
โ๏ธ ๐ ๏ธ |
RUF027 | missing-f-string-syntax | Possible f-string without an f prefix |
๐งช ๐ ๏ธ |
RUF028 | invalid-formatter-suppression-comment | This suppression comment is invalid because {} | ๐งช ๐ ๏ธ |
RUF029 | unused-async | Function {name} is declared async , but doesn't await or use async features. |
๐งช |
RUF030 | assert-with-print-message | print() expression in assert statement is likely unintentional |
๐งช ๐ ๏ธ |
RUF031 | incorrectly-parenthesized-tuple-in-subscript | Use parentheses for tuples in subscripts | ๐งช ๐ ๏ธ |
RUF032 | decimal-from-float-literal | Decimal() called with float literal argument |
๐งช ๐ ๏ธ |
RUF033 | post-init-default | __post_init__ method with argument defaults |
๐งช ๐ ๏ธ |
RUF034 | useless-if-else | Useless if -else condition |
๐งช |
RUF035 | unsafe-markup-use | Unsafe use of {name} detected |
๐งช |
RUF036 | none-not-at-end-of-union | None not at the end of the type annotation. |
๐งช |
RUF100 | unused-noqa | Unused noqa directive |
โ๏ธ ๐ ๏ธ |
RUF101 | redirected-noqa | {original} is a redirect to {target} |
โ๏ธ ๐ ๏ธ |
RUF200 | invalid-pyproject-toml | Failed to parse pyproject.toml: {message} | โ๏ธ |