- Rules
- Rules
- Legend
- Airflow (AIR)
- eradicate (ERA)
- FastAPI (FAST)
- flake8-2020 (YTT)
- flake8-annotations (ANN)
- flake8-async (ASYNC)
- flake8-bandit (S)
- flake8-blind-except (BLE)
- flake8-boolean-trap (FBT)
- flake8-bugbear (B)
- flake8-builtins (A)
- flake8-commas (COM)
- flake8-comprehensions (C4)
- flake8-copyright (CPY)
- flake8-datetimez (DTZ)
- flake8-debugger (T10)
- flake8-django (DJ)
- flake8-errmsg (EM)
- flake8-executable (EXE)
- flake8-fixme (FIX)
- flake8-future-annotations (FA)
Rules
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"]($28e14343565b71a4.md#what-is-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.
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}”| ✔️ 🛠️
AIR002| airflow-dag-no-schedule-argument| DAG should have an explicit schedule argument| 🧪 🛠️
AIR301| airflow3-removal| {deprecated} is removed in Airflow 3.0| 🧪 🛠️
AIR302| airflow3-moved-to-provider| {deprecated} is removed in Airflow 3.0| 🧪 🛠️
AIR311| airflow3-suggested-update| {deprecated} is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.| 🧪 🛠️
AIR312| airflow3-suggested-to-move-to-provider| {deprecated} is removed in Airflow 3.0| 🧪 🛠️
eradicate (ERA)
For more, see eradicate on PyPI.
Code| Name| Message|
---|---|---|---
ERA001| commented-out-code| Found commented-out code| ✔️ 🛠️
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| ✔️ 🛠️
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 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](<https://docs.astral.sh/ruff/rules/weak-cryptographic-key>)| {cryptographic_key} key sizes below {minimum_key_size} bits are considered breakable| ✔️ 🛠️
S506| [unsafe-yaml-load](<https://docs.astral.sh/ruff/rules/unsafe-yaml-load>)| Probable use of unsafe loader{name}withyaml.load. Allows instantiation of arbitrary objects. Consideryaml.safe_load.| ✔️ 🛠️
S507| [ssh-no-host-key-verification](<https://docs.astral.sh/ruff/rules/ssh-no-host-key-verification>)| Paramiko call with policy set to automatically trust the unknown host key| ✔️ 🛠️
S508| [snmp-insecure-version](<https://docs.astral.sh/ruff/rules/snmp-insecure-version>)| The use of SNMPv1 and SNMPv2 is insecure. Use SNMPv3 if able.| ✔️ 🛠️
S509| [snmp-weak-cryptography](<https://docs.astral.sh/ruff/rules/snmp-weak-cryptography>)| You should not use SNMPv3 without encryption.noAuthNoPriv&authNoPrivis insecure.| ✔️ 🛠️
S601| [paramiko-call](<https://docs.astral.sh/ruff/rules/paramiko-call>)| Possible shell injection via Paramiko call; check inputs are properly sanitized| ✔️ 🛠️
S602| [subprocess-popen-with-shell-equals-true](<https://docs.astral.sh/ruff/rules/subprocess-popen-with-shell-equals-true>)|subprocesscall withshell=Trueseems safe, but may be changed in the future; consider rewriting withoutshell| ✔️ 🛠️
S603| [subprocess-without-shell-equals-true](<https://docs.astral.sh/ruff/rules/subprocess-without-shell-equals-true>)|subprocesscall: check for execution of untrusted input| ✔️ 🛠️
S604| [call-with-shell-equals-true](<https://docs.astral.sh/ruff/rules/call-with-shell-equals-true>)| Function call withshell=Trueparameter identified, security issue| ✔️ 🛠️
S605| [start-process-with-a-shell](<https://docs.astral.sh/ruff/rules/start-process-with-a-shell>)| Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting withoutshell| ✔️ 🛠️
S606| [start-process-with-no-shell](<https://docs.astral.sh/ruff/rules/start-process-with-no-shell>)| Starting a process without a shell| ✔️ 🛠️
S607| [start-process-with-partial-path](<https://docs.astral.sh/ruff/rules/start-process-with-partial-path>)| Starting a process with a partial executable path| ✔️ 🛠️
S608| [hardcoded-sql-expression](<https://docs.astral.sh/ruff/rules/hardcoded-sql-expression>)| Possible SQL injection vector through string-based query construction| ✔️ 🛠️
S609| [unix-command-wildcard-injection](<https://docs.astral.sh/ruff/rules/unix-command-wildcard-injection>)| Possible wildcard injection in call due to*usage| ✔️ 🛠️
S610| [django-extra](<https://docs.astral.sh/ruff/rules/django-extra>)| Use of Djangoextracan lead to SQL injection vulnerabilities| ✔️ 🛠️
S611| [django-raw-sql](<https://docs.astral.sh/ruff/rules/django-raw-sql>)| Use ofRawSQLcan lead to SQL injection vulnerabilities| ✔️ 🛠️
S612| [logging-config-insecure-listen](<https://docs.astral.sh/ruff/rules/logging-config-insecure-listen>)| Use of insecurelogging.config.listendetected| ✔️ 🛠️
S701| [jinja2-autoescape-false](<https://docs.astral.sh/ruff/rules/jinja2-autoescape-false>)| Using jinja2 templates withautoescape=Falseis dangerous and can lead to XSS. Ensureautoescape=Trueor use theselect_autoescapefunction.| ✔️ 🛠️
S702| [mako-templates](<https://docs.astral.sh/ruff/rules/mako-templates>)| Mako templates allow HTML and JavaScript rendering by default and are inherently open to XSS attacks| ✔️ 🛠️
S704| [unsafe-markup-use](<https://docs.astral.sh/ruff/rules/unsafe-markup-use>)| Unsafe use of{name}` detected| ✔️ 🛠️
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| Do not assert blind exception: {exception}| ✔️ 🛠️
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 or properties| ✔️ 🛠️
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| 🧪 🛠️
B903| class-as-data-structure| Class could be dataclass or namedtuple| 🧪 🛠️
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| 🧪 🛠️
B911| batched-without-explicit-strict| itertools.batched() without an explicit strict parameter| ✔️ 🛠️
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| stdlib-module-shadowing| Module {name} shadows a Python standard-library 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-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 {kind} literal (rewrite as a set literal)| ✔️ 🛠️
C406| unnecessary-literal-dict| Unnecessary {obj_type} literal (rewrite as a dict literal)| ✔️ 🛠️
C408| unnecessary-collection-call| Unnecessary {kind}() 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 list 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 {kind} comprehension (rewrite using {kind}())| ✔️ 🛠️
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-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-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, pytest, or uv run| ✔️ 🛠️
EXE004| shebang-leading-whitespace| Avoid whitespace before shebang| ✔️ 🛠️
EXE005| shebang-not-first-line| Shebang should be at the beginning of the file| ✔️ 🛠️
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| ✔️ 🛠️
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}| ✔️ 🛠️
(本文超出站点单文档体积上限,已按小节截断)
