Programming Search⌘K

Python lints, page 3 of 8

The lint rules of Python, with what each one finds. This page has 1,420 cards.

Mixing named and unnamed conversion specifiers in format string. E1302

Used when a format string contains both named (e.g. '%(foo)d') and unnamed (e.g. '%d') conversion specifiers. This is also used when a named conversion specifier contains * for the minimum field width and/or precision. pylint calls it mixed-format-string.

Code
E1302
Severity
error
Message
Mixing named and unnamed conversion specifiers in format string

Source: github.com, pylint.readthedocs.io. JSON record. This entry is a card. Help write this page.

The name capture `case …` makes the remaining patterns unreachable. Use a dotted name (for example an enum) to fix this. E1901

Emitted when a name capture pattern is used in a match statement and there are case statements below it. pylint calls it bare-name-capture-pattern.

Code
E1901
Severity
error
Message
The name capture `case {}` makes the remaining patterns unreachable. Use a dotted name (for example an enum) to fix this.

Source: github.com, pylint.readthedocs.io. JSON record. This entry is a card. Help write this page.

UTF-16 and UTF-32 aren't backward compatible. Use UTF-8 instead. E2501

For compatibility use UTF-8 instead of UTF-16/UTF-32. See also https://bugs.python.org/issue1503789 for a history of this issue. And https://softwareengineering.stackexchange.com/questions/102205/ for some possible problems when using UTF-16 for instance. pylint calls it invalid-unicode-codec.

Code
E2501
Severity
error
Message
UTF-16 and UTF-32 aren't backward compatible. Use UTF-8 instead

Source: github.com, pylint.readthedocs.io. JSON record. This entry is a card. Help write this page.

Contains control characters that can permit obfuscated code executed differently than displayed. E2502

Bidirectional unicode are typically not displayed characters required to display right-to-left (RTL) script (i.e. Chinese, Japanese, Arabic, Hebrew, ...) correctly. So can you trust this code? Are you sure it displayed correctly in all editors? If you did not write it or your language is not RTL, remove the special characters, as they could be used to trick you into executing code, that does something else than what it looks like. More Information: https://en.wikipedia.org/wiki/Bidirectional_text https://trojansource.codes/. pylint calls it bidirectional-unicode.

Code
E2502
Severity
error
Message
Contains control characters that can permit obfuscated code executed differently than displayed

Source: github.com, pylint.readthedocs.io. JSON record. This entry is a card. Help write this page.

Check that functions don't have empty bodies outside stubs. empty-body

This error code is similar to the [return] code but is emitted specifically for functions and methods with empty bodies (if they are annotated with non-trivial return type). Such a distinction exists because in some contexts an empty body can be valid, for example for an abstract method or in a stub file. mypy enables this error code by default.

Code
empty-body
Severity
error

Source: github.com, mypy.readthedocs.io. JSON record. This entry is a card. Help write this page.

Check the return type of __exit__. exit-return

If mypy can determine that :py__exit__ always returns False, mypy checks that the return type is *not* bool. The boolean value of the return type affects which lines mypy thinks are reachable after a with statement, since any :py__exit__ method that can return True may swallow exceptions. mypy enables this error code by default.

Code
exit-return
Severity
error

Source: github.com, mypy.readthedocs.io. JSON record. This entry is a card. Help write this page.

Check that @override is used when overriding a base class method. explicit-override

If you use --enable-error-code explicit-override mypy generates an error if you override a base class method without using the @override decorator. An error will not be emitted for overrides of __init__ or __new__. See PEP 698. mypy does not enable this error code by default. Use --enable-error-code explicit-override to enable it.

Code
explicit-override
Severity
error

Source: github.com, mypy.readthedocs.io. JSON record. This entry is a card. Help write this page.

Checks for unused imports. F401

Unused imports add a performance overhead at runtime, and risk creating import cycles. They also increase the cognitive load of reading the code. Ruff takes this rule from Pyflakes and made it stable in v0.0.18.

Code
F401
Message
`{}` imported but unused; consider using `importlib.util.find_spec` to test for availability
Message
`{}` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
Message
`{}` imported but unused

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for import bindings that are shadowed by loop variables. F402

Shadowing an import with loop variables makes the code harder to read and reason about, as the identify of the imported binding is no longer clear. It's also often indicative of a mistake, as it's unlikely that the loop variable is intended to be used as the imported binding. Ruff takes this rule from Pyflakes and made it stable in v0.0.44.

Code
F402
Message
Import `{}` from {} shadowed by loop variable

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for the use of wildcard imports. F403

Wildcard imports (e.g., from module import *) make it hard to determine which symbols are available in the current namespace, and from which module they were imported. They're also discouraged by PEP 8. Ruff takes this rule from Pyflakes and made it stable in v0.0.18.

Code
F403
Message
`from {} import *` used; unable to detect undefined names

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for __future__ imports that are not located at the beginning of a file. F404

Imports from __future__ must be placed the beginning of the file, before any other statements (apart from docstrings). The use of __future__ imports elsewhere is invalid and will result in a SyntaxError. Ruff takes this rule from Pyflakes and made it stable in v0.0.34.

Code
F404
Message
`from __future__` imports must occur at the beginning of the file

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for names that might be undefined, but may also be defined in a wildcard import. F405

Wildcard imports (e.g., from module import *) make it hard to determine which symbols are available in the current namespace. If a module contains a wildcard import, and a name in the current namespace has not been explicitly defined or imported, then it's unclear whether the name is undefined or was imported by the wildcard import. Ruff takes this rule from Pyflakes and made it stable in v0.0.44.

Code
F405
Message
`{}` may be undefined, or defined from star imports

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for printf-style format strings that have a mismatch between the number of positional placeholders and the number of substitution values. F507

When a printf-style format string is provided with too many or too few substitution values, it will raise a TypeError at runtime. Ruff takes this rule from Pyflakes and made it stable in v0.0.142.

Code
F507
Message
`%`-format string has {} placeholder(s) but {} substitution(s)

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for f-strings that do not contain any placeholder expressions. F541

f-strings are a convenient way to format strings, but they are not necessary if there are no placeholder expressions to format. In this case, a regular string should be used instead, as an f-string without placeholders can be confusing for readers, who may expect such a placeholder to be present. Ruff takes this rule from Pyflakes and made it stable in v0.0.18.

Code
F541
Message
f-string without any placeholders

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for dictionary literals that associate multiple values with the same key. F601

Dictionary keys should be unique. If a key is associated with multiple values, the earlier values will be overwritten. Including multiple values for the same key in a dictionary literal is likely a mistake. Ruff takes this rule from Pyflakes and made it stable in v0.0.30.

Code
F601
Message
Dictionary key literal `{}` repeated
Message
Dictionary key literal `{}` repeated
Message
Dictionary key literal `{}` repeated (`{}` hashes to the same value as `{}`)
Message
Dictionary key literal repeated

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for the use of multiple starred expressions in assignment statements. F622

In assignment statements, starred expressions can be used to unpack iterables. Including more than one starred expression on the left-hand-side of an assignment will cause a SyntaxError, as it is unclear which expression should receive the remaining values. Ruff takes this rule from Pyflakes and made it stable in v0.0.32.

Code
F622
Message
Two starred expressions in assignment

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for is and is not comparisons against literals, like integers, strings, or lists. F632

The is and is not comparators operate on identity, in that they check whether two objects are the same object. If the objects are not the same object, the comparison will always be False. Using is and is not with constant literals often works "by accident", but are not guaranteed to produce the expected result. Ruff takes this rule from Pyflakes and made it stable in v0.0.39.

Code
F632
Message
Use `==` to compare constant literals
Message
Use `!=` to compare constant literals

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for except blocks that handle all exceptions, but are not the last except block in a try statement. F707

When an exception is raised within a try block, the except blocks are evaluated in order, and the first matching block is executed. If an except block handles all exceptions, but isn't the last block, Python will raise a SyntaxError, as the following blocks would never be executed. Ruff takes this rule from Pyflakes and made it stable in v0.0.28.

Code
F707
Message
An `except` block as not the last exception handler

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for undefined names in __all__. F822

In Python, the __all__ variable is used to define the names that are exported when a module is imported as a wildcard (e.g., from foo import *). The names in __all__ must be defined in the module, but are included as strings. Ruff takes this rule from Pyflakes and made it stable in v0.0.25.

Code
F822
Message
Undefined name `{}` in `__all__`

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for missing from __future__ import annotations imports upon detecting type annotations that can be written more succinctly under PEP 563. FA100

PEP 585 enabled the use of a number of convenient type annotations, such as liststr instead of Liststr. However, these annotations are only available on Python 3.9 and higher, _unless_ the from __future__ import annotations import is present. Ruff takes this rule from flake8-future-annotations and made it stable in v0.0.269.

Code
FA100
Message
Add `from __future__ import annotations` to simplify `{}`

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for uses of PEP 585- and PEP 604-style type annotations in Python modules that lack the required from __future__ import annotations import for compatibility with older Python versions. FA102

Using PEP 585 and PEP 604 style annotations without a from __future__ import annotations import will cause runtime errors on Python versions prior to 3.9 and 3.10, respectively. Ruff takes this rule from flake8-future-annotations and made it stable in v0.0.271.

Code
FA102
Message
Missing `from __future__ import annotations`, but uses {}

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Identifies FastAPI routes with deprecated uses of Depends or similar. FAST002

The FastAPI documentation recommends the use of typing.Annotated for defining route dependencies and parameters, rather than using Depends, Query or similar as a default value for a parameter. Using this approach everywhere helps ensure consistency and clarity in defining dependencies and parameters. Ruff takes this rule from FastAPI and made it stable in 0.8.0.

Code
FAST002
Message
FastAPI dependency without `Annotated`

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Identifies FastAPI routes that declare path parameters in the route path that are not included in the function signature. FAST003

Path parameters are used to extract values from the URL path. Ruff takes this rule from FastAPI and made it stable in 0.10.0.

Code
FAST003
Message
Parameter `{}` appears in route path, but not in `{}` signature
Message
Parameter `{}` appears in route path, but only as a positional-only argument in `{}` signature

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for the use of boolean positional arguments in function definitions, as determined by the presence of a type hint containing bool as an evident subtype - e.g. FBT001

bool, bool | int, typing.Optionalbool, etc. Calling a function with boolean positional arguments is confusing as the meaning of the boolean value is not clear to the caller and to future readers of the code. Ruff takes this rule from flake8-boolean-trap and made it stable in v0.0.127.

Code
FBT001
Message
Boolean-typed positional argument in function definition

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for the use of boolean positional arguments in function definitions, as determined by the presence of a boolean default value. FBT002

Calling a function with boolean positional arguments is confusing as the meaning of the boolean value is not clear to the caller and to future readers of the code. Ruff takes this rule from flake8-boolean-trap and made it stable in v0.0.127.

Code
FBT002
Message
Boolean default positional argument in function definition

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for "FIXME" comments. FIX001

"FIXME" comments are used to describe an issue that should be resolved (usually, a bug or unexpected behavior). Ruff takes this rule from flake8-fixme and made it stable in v0.0.272.

Code
FIX001
Message
Line contains FIXME, consider resolving the issue

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for "TODO" comments. FIX002

"TODO" comments are used to describe an issue that should be resolved (usually, a missing feature, optimization, or refactoring opportunity). Ruff takes this rule from flake8-fixme and made it stable in v0.0.272.

Code
FIX002
Message
Line contains TODO, consider resolving the issue

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for "HACK" comments. FIX004

"HACK" comments are used to describe an issue that should be resolved (usually, a suboptimal solution or temporary workaround). Ruff takes this rule from flake8-fixme and made it stable in v0.0.272.

Code
FIX004
Message
Line contains HACK, consider resolving the issue

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for uses of open and read that can be replaced by pathlib methods, like Path.read_text and Path.read_bytes. FURB101

When reading the entire contents of a file into a variable, it's simpler and more concise to use pathlib methods like Path.read_text and Path.read_bytes instead of open and read calls via with statements. Ruff takes this rule from refurb. It is in preview.

Code
FURB101
Message
`Path.open()` followed by `read()` can be replaced by `{}.{}`
Message
`open` and `read` should be replaced by `Path({}).{}`

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for uses of open and write that can be replaced by pathlib methods, like Path.write_text and Path.write_bytes. FURB103

When writing a single string to a file, it's simpler and more concise to use pathlib methods like Path.write_text and Path.write_bytes instead of open and write calls via with statements. Ruff takes this rule from refurb. It is in preview.

Code
FURB103
Message
`Path.open()` followed by `write()` can be replaced by `{}.{}`
Message
`open` and `write` should be replaced by `Path({}).{}`

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for print calls with unnecessary empty strings as positional arguments and unnecessary sep keyword arguments. FURB105

Prefer calling print without any positional arguments, which is equivalent and more concise. Ruff takes this rule from refurb and made it stable in 0.5.0.

Code
FURB105
Message
Unnecessary empty string passed to `print`
Message
Unnecessary separator passed to `print`
Message
Unnecessary empty string and separator passed to `print`

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for consecutive calls to append. FURB113

Consecutive calls to append can be less efficient than batching them into a single extend. Each append resizes the list individually, whereas an extend can resize the list once for all elements. Ruff takes this rule from refurb. It is in preview.

Code
FURB113
Message
Use `{}` instead of repeatedly calling `{}.append()`

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for uses of bin(...)2: (or hex, or oct) to convert an integer into a string. FURB116

When converting an integer to a baseless binary, hexadecimal, or octal string, using f-strings is more concise and readable than using the bin, hex, or oct functions followed by a slice. Ruff takes this rule from refurb and made it stable in 0.13.0.

Code
FURB116
Message
Replace `{}` call with `{}`
Message
Replace `{}` call with f-string

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for lambda expressions and function definitions that can be replaced with a function from the operator module. FURB118

The operator module provides functions that implement the same functionality as the corresponding operators. For example, operator.add is often equivalent to lambda x, y: x + y. Using the functions from the operator module is more concise and communicates the intent of the code more clearly. Ruff takes this rule from refurb. It is in preview.

Code
FURB118
Message
Use `operator.{}` instead of defining a {}

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for if expressions that can be replaced with min() or max() calls. FURB136

An if expression that selects the lesser or greater of two sub-expressions can be replaced with a min() or max() call respectively. When possible, prefer min() and max(), as they're more concise and readable than the equivalent if expression. Ruff takes this rule from refurb and made it stable in 0.5.0.

Code
FURB136
Message
Replace `if` expression with `{}` call
Message
Replace `if` expression with `{}`
Message
Replace `{}` with `{}`

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for unnecessary from_float and from_decimal usages to construct Decimal and Fraction instances. FURB164

Since Python 3.2, the Fraction and Decimal classes can be constructed by passing float or decimal instances to the constructor directly. As such, the use of from_float and from_decimal methods is unnecessary, and should be avoided in favor of the more concise constructor syntax. Ruff takes this rule from refurb and made it stable in 0.16.0.

Code
FURB164
Message
Verbose method `{}` in `{}` construction

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for uses of int with an explicit base in which a string expression is stripped of its leading prefix (i.e., 0b, 0o, or 0x). FURB166

Given an integer string with a prefix (e.g., 0xABC), Python can automatically determine the base of the integer by the prefix without needing to specify it explicitly. Ruff takes this rule from refurb and made it stable in 0.12.0.

Code
FURB166
Message
Use of `int` with explicit `base={}` after removing prefix

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for the use of shorthand aliases for regular expression flags (e.g., re.I instead of re.IGNORECASE). FURB167

The regular expression module provides descriptive names for each flag, along with single-letter aliases. Prefer the descriptive names, as they are more readable and self-documenting. Ruff takes this rule from refurb and made it stable in 0.5.0.

Code
FURB167
Message
Use of regular expression alias `re.{}`

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for uses of metaclass=abc.ABCMeta to define abstract base classes (ABCs). FURB180

Instead of class C(metaclass=abc.ABCMeta): ..., use class C(ABC): ... to define an abstract base class. Inheriting from the ABC wrapper class is semantically identical to setting metaclass=abc.ABCMeta, but more succinct. Ruff takes this rule from refurb. It is in preview.

Code
FURB180
Message
Use of `metaclass=abc.ABCMeta` to define abstract base class

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for code that could be written more idiomatically using str.removeprefix() or str.removesuffix(). FURB188

The methods str.removeprefix() and str.removesuffix(), introduced in Python 3.9, have the same behavior while being more readable and efficient. Ruff takes this rule from refurb and made it stable in 0.9.0.

Code
FURB188
Message
Prefer `str.removeprefix()` over conditionally replacing with slice.
Message
Prefer `str.removesuffix()` over conditionally replacing with slice.

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for uses of sorted() to retrieve the minimum or maximum value in a sequence. FURB192

Using sorted() to compute the minimum or maximum value in a sequence is inefficient and less readable than using min() or max() directly. Ruff takes this rule from refurb and made it stable in 0.16.0.

Code
FURB192
Message
Prefer `min` over `sorted()` to compute the minimum value in a sequence
Message
Prefer `max` over `sorted()` to compute the maximum value in a sequence

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for uses string concatenation via the + operator to format logging messages. G003

The logging module provides a mechanism for passing additional values to be logged using the extra keyword argument. This is more consistent, more efficient, and less error-prone than formatting the string directly. Ruff takes this rule from flake8-logging-format and made it stable in v0.0.236.

Code
G003
Message
Logging statement uses `+`

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for extra keywords in logging statements that clash with LogRecord attributes. G101

The logging module provides a mechanism for passing additional values to be logged using the extra keyword argument. These values are then passed to the LogRecord constructor. Ruff takes this rule from flake8-logging-format and made it stable in v0.0.236.

Code
G101
Message
Logging statement uses an `extra` field that clashes with a `LogRecord` field: `{}`

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for uses of logging.error that pass exc_info=True. G201

Calling logging.error with exc_info=True is equivalent to calling logging.exception. Using logging.exception is more concise, more readable, and conveys the intent of the logging statement more clearly. Ruff takes this rule from flake8-logging-format and made it stable in v0.0.236.

Code
G201
Message
Logging `.exception(...)` should be used instead of `.error(..., exc_info=True)`

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Adds any required imports, as specified by the user, to the top of the file. I002

In some projects, certain imports are required to be present in all files. For example, some projects assume that from __future__ import annotations is enabled, and thus require that import to be present in all files. Omitting a "required" import (as specified by the user) can cause errors or unexpected behavior. Ruff takes this rule from isort and made it stable in v0.0.218.

Code
I002
Message
Missing required import: `{}`

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

… … has no … member…, but source is unavailable. Consider adding this module to extension-pkg-allow-list if you want to perform analysis based on run-time introspection of living objects. I1101

Used when a variable is accessed for non-existent member of C extension. Due to unavailability of source static analysis is impossible, but it may be performed by introspecting living objects in run-time. pylint calls it c-extension-no-member.

Code
I1101
Severity
info
Message
{} {} has no {} member{}, but source is unavailable. Consider adding this module to extension-pkg-allow-list if you want to perform analysis based on run-time introspection of living objects.

Source: github.com, pylint.readthedocs.io. JSON record. This entry is a card. Help write this page.

Checks for packages that are missing an __init__.py file. INP001

Python packages are directories that contain a file named __init__.py. The existence of this file indicates that the directory is a Python package, and so it can be imported the same way a module can be imported. Ruff takes this rule from flake8-no-pep420 and made it stable in v0.0.225.

Code
INP001
Message
File `{}` is part of an implicit namespace package. Add an `__init__.py`.
Message
File `{}` declares a package, but is nested under an implicit namespace package. Add an `__init__.py` to `{}`.

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for f-strings in gettext function calls. INT001

In the gettext API, the gettext function (often aliased to _) returns a translation of its input argument by looking it up in a translation catalog. Ruff takes this rule from flake8-gettext and made it stable in v0.0.260.

Code
INT001
Message
f-string in plural argument is resolved before function call
Message
f-string is resolved before function call; consider `_("string %s") % arg`

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for str.format calls in gettext function calls. INT002

In the gettext API, the gettext function (often aliased to _) returns a translation of its input argument by looking it up in a translation catalog. Ruff takes this rule from flake8-gettext and made it stable in v0.0.260.

Code
INT002
Message
`format` method in plural argument is resolved before function call
Message
`format` method argument is resolved before function call; consider `_("string %s") % arg`

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for printf-style formatted strings in gettext function calls. INT003

In the gettext API, the gettext function (often aliased to _) returns a translation of its input argument by looking it up in a translation catalog. Ruff takes this rule from flake8-gettext and made it stable in v0.0.260.

Code
INT003
Message
printf-style format in plural argument is resolved before function call
Message
printf-style format is resolved before function call; consider `_("string %s") % arg`

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for implicitly concatenated strings that span multiple lines. ISC002

For string literals that wrap across multiple lines, PEP 8 recommends the use of implicit string concatenation within parentheses instead of using a backslash for line continuation, as the former is more readable than the latter. Ruff takes this rule from flake8-implicit-str-concat and made it stable in v0.0.201.

Code
ISC002
Message
Implicitly concatenated string literals over multiple lines

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for string literals that are explicitly concatenated (using the + operator). ISC003

For string literals that wrap across multiple lines, implicit string concatenation within parentheses is preferred over explicit concatenation using the + operator, as the former is more readable. Ruff takes this rule from flake8-implicit-str-concat and made it stable in v0.0.201.

Code
ISC003
Message
Explicitly concatenated string should be implicitly concatenated

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for uses of logging.exception() with exc_info set to False. LOG007

The logging.exception() method captures the exception automatically, but accepts an optional exc_info argument to override this behavior. Setting exc_info to False disables the automatic capture of the exception and stack trace. Ruff takes this rule from flake8-logging and made it stable in v0.2.0.

Code
LOG007
Message
Use of `logging.exception` with falsy `exc_info`

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Check that overrides of mutable attributes are safe. mutable-override

mutable-override will enable the check for unsafe overrides of mutable attributes. For historical reasons, and because this is a relatively common pattern in Python, this check is not enabled by default. mypy does not enable this error code by default. Use --enable-error-code mutable-override to enable it.

Code
mutable-override
Severity
error

Source: github.com, mypy.readthedocs.io. JSON record. This entry is a card. Help write this page.

Checks for constant imports that are aliased to non-constant-style names. N811

PEP 8 recommends naming conventions for classes, functions, constants, and more. The use of inconsistent naming styles between import and alias names may lead readers to expect an import to be of another type (e.g., confuse a Python class with a constant). Ruff takes this rule from pep8-naming and made it stable in v0.0.82.

Code
N811
Message
Constant `{}` imported as non-constant `{}`

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for lowercase imports that are aliased to non-lowercase names. N812

PEP 8 recommends naming conventions for classes, functions, constants, and more. The use of inconsistent naming styles between import and alias names may lead readers to expect an import to be of another type (e.g., confuse a Python class with a constant). Ruff takes this rule from pep8-naming and made it stable in v0.0.82.

Code
N812
Message
Lowercase `{}` imported as non-lowercase `{}`

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for CamelCase imports that are aliased to lowercase names. N813

PEP 8 recommends naming conventions for classes, functions, constants, and more. The use of inconsistent naming styles between import and alias names may lead readers to expect an import to be of another type (e.g., confuse a Python class with a constant). Ruff takes this rule from pep8-naming and made it stable in v0.0.82.

Code
N813
Message
Camelcase `{}` imported as lowercase `{}`

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.

Checks for CamelCase imports that are aliased to constant-style names. N814

PEP 8 recommends naming conventions for classes, functions, constants, and more. The use of inconsistent naming styles between import and alias names may lead readers to expect an import to be of another type (e.g., confuse a Python class with a constant). Ruff takes this rule from pep8-naming and made it stable in v0.0.82.

Code
N814
Message
Camelcase `{}` imported as constant `{}`

Source: docs.astral.sh. JSON record. This entry is a card. Help write this page.