mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 13:25:17 +00:00
Promote lint.
settings over top-level settings (#9476)
This commit is contained in:
parent
6996ff7b1e
commit
c3b33e9c4d
62 changed files with 389 additions and 310 deletions
|
@ -24,7 +24,7 @@ use super::super::detection::comment_contains_code;
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `task-tags`
|
||||
/// - `lint.task-tags`
|
||||
///
|
||||
/// [#4845]: https://github.com/astral-sh/ruff/issues/4845
|
||||
#[violation]
|
||||
|
|
|
@ -23,11 +23,11 @@ use crate::checkers::ast::Checker;
|
|||
/// calls to the function, which can lead to unexpected behaviour.
|
||||
///
|
||||
/// Calls can be marked as an exception to this rule with the
|
||||
/// [`flake8-bugbear.extend-immutable-calls`] configuration option.
|
||||
/// [`lint.flake8-bugbear.extend-immutable-calls`] configuration option.
|
||||
///
|
||||
/// Arguments with immutable type annotations will be ignored by this rule.
|
||||
/// Types outside of the standard library can be marked as immutable with the
|
||||
/// [`flake8-bugbear.extend-immutable-calls`] configuration option as well.
|
||||
/// [`lint.flake8-bugbear.extend-immutable-calls`] configuration option as well.
|
||||
///
|
||||
/// ## Example
|
||||
/// ```python
|
||||
|
@ -61,7 +61,7 @@ use crate::checkers::ast::Checker;
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `flake8-bugbear.extend-immutable-calls`
|
||||
/// - `lint.flake8-bugbear.extend-immutable-calls`
|
||||
#[violation]
|
||||
pub struct FunctionCallInDefaultArgument {
|
||||
name: Option<String>,
|
||||
|
|
|
@ -28,7 +28,7 @@ use crate::checkers::ast::Checker;
|
|||
///
|
||||
/// Arguments with immutable type annotations will be ignored by this rule.
|
||||
/// Types outside of the standard library can be marked as immutable with the
|
||||
/// [`flake8-bugbear.extend-immutable-calls`] configuration option.
|
||||
/// [`lint.flake8-bugbear.extend-immutable-calls`] configuration option.
|
||||
///
|
||||
/// ## Known problems
|
||||
/// Mutable argument defaults can be used intentionally to cache computation
|
||||
|
@ -61,7 +61,7 @@ use crate::checkers::ast::Checker;
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `flake8-bugbear.extend-immutable-calls`
|
||||
/// - `lint.flake8-bugbear.extend-immutable-calls`
|
||||
///
|
||||
/// ## References
|
||||
/// - [Python documentation: Default Argument Values](https://docs.python.org/3/tutorial/controlflow.html#default-argument-values)
|
||||
|
|
|
@ -19,7 +19,7 @@ use super::super::helpers::shadows_builtin;
|
|||
/// builtin and vice versa.
|
||||
///
|
||||
/// Builtins can be marked as exceptions to this rule via the
|
||||
/// [`flake8-builtins.builtins-ignorelist`] configuration option.
|
||||
/// [`lint.flake8-builtins.builtins-ignorelist`] configuration option.
|
||||
///
|
||||
/// ## Example
|
||||
/// ```python
|
||||
|
@ -44,7 +44,7 @@ use super::super::helpers::shadows_builtin;
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `flake8-builtins.builtins-ignorelist`
|
||||
/// - `lint.flake8-builtins.builtins-ignorelist`
|
||||
///
|
||||
/// ## References
|
||||
/// - [_Is it bad practice to use a built-in function name as an attribute or method identifier?_](https://stackoverflow.com/questions/9109333/is-it-bad-practice-to-use-a-built-in-function-name-as-an-attribute-or-method-ide)
|
||||
|
|
|
@ -37,7 +37,7 @@ use crate::rules::flake8_builtins::helpers::shadows_builtin;
|
|||
/// ```
|
||||
///
|
||||
/// Builtins can be marked as exceptions to this rule via the
|
||||
/// [`flake8-builtins.builtins-ignorelist`] configuration option, or
|
||||
/// [`lint.flake8-builtins.builtins-ignorelist`] configuration option, or
|
||||
/// converted to the appropriate dunder method. Methods decorated with
|
||||
/// `@typing.override` or `@typing_extensions.override` are also
|
||||
/// ignored.
|
||||
|
@ -55,7 +55,7 @@ use crate::rules::flake8_builtins::helpers::shadows_builtin;
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `flake8-builtins.builtins-ignorelist`
|
||||
/// - `lint.flake8-builtins.builtins-ignorelist`
|
||||
#[violation]
|
||||
pub struct BuiltinAttributeShadowing {
|
||||
kind: Kind,
|
||||
|
|
|
@ -18,7 +18,7 @@ use crate::rules::flake8_builtins::helpers::shadows_builtin;
|
|||
/// builtin and vice versa.
|
||||
///
|
||||
/// Builtins can be marked as exceptions to this rule via the
|
||||
/// [`flake8-builtins.builtins-ignorelist`] configuration option.
|
||||
/// [`lint.flake8-builtins.builtins-ignorelist`] configuration option.
|
||||
///
|
||||
/// ## Example
|
||||
/// ```python
|
||||
|
@ -41,7 +41,7 @@ use crate::rules::flake8_builtins::helpers::shadows_builtin;
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `flake8-builtins.builtins-ignorelist`
|
||||
/// - `lint.flake8-builtins.builtins-ignorelist`
|
||||
///
|
||||
/// ## References
|
||||
/// - [_Why is it a bad idea to name a variable `id` in Python?_](https://stackoverflow.com/questions/77552/id-is-a-bad-variable-name-in-python)
|
||||
|
|
|
@ -59,7 +59,7 @@ impl Violation for SingleLineImplicitStringConcatenation {
|
|||
///
|
||||
/// By default, this rule will only trigger if the string literal is
|
||||
/// concatenated via a backslash. To disallow implicit string concatenation
|
||||
/// altogether, set the [`flake8-implicit-str-concat.allow-multiline`] option
|
||||
/// altogether, set the [`lint.flake8-implicit-str-concat.allow-multiline`] option
|
||||
/// to `false`.
|
||||
///
|
||||
/// ## Example
|
||||
|
@ -77,7 +77,7 @@ impl Violation for SingleLineImplicitStringConcatenation {
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `flake8-implicit-str-concat.allow-multiline`
|
||||
/// - `lint.flake8-implicit-str-concat.allow-multiline`
|
||||
///
|
||||
/// [PEP 8]: https://peps.python.org/pep-0008/#maximum-line-length
|
||||
#[violation]
|
||||
|
|
|
@ -29,7 +29,7 @@ use ruff_text_size::Ranged;
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `flake8-import-conventions.banned-aliases`
|
||||
/// - `lint.flake8-import-conventions.banned-aliases`
|
||||
#[violation]
|
||||
pub struct BannedImportAlias {
|
||||
name: String,
|
||||
|
|
|
@ -30,7 +30,7 @@ use ruff_text_size::Ranged;
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `flake8-import-conventions.banned-from`
|
||||
/// - `lint.flake8-import-conventions.banned-from`
|
||||
#[violation]
|
||||
pub struct BannedImportFrom {
|
||||
name: String,
|
||||
|
|
|
@ -32,8 +32,8 @@ use crate::renamer::Renamer;
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `flake8-import-conventions.aliases`
|
||||
/// - `flake8-import-conventions.extend-aliases`
|
||||
/// - `lint.flake8-import-conventions.aliases`
|
||||
/// - `lint.flake8-import-conventions.extend-aliases`
|
||||
#[violation]
|
||||
pub struct UnconventionalImportAlias {
|
||||
name: String,
|
||||
|
|
|
@ -30,9 +30,9 @@ use ruff_macros::{derive_message_formats, violation};
|
|||
/// - Uses of `flask.current_app.logger` (e.g., `from flask import current_app; current_app.logger.info(...)`).
|
||||
/// - Objects whose name starts with `log` or ends with `logger` or `logging`,
|
||||
/// when used in the same file in which they are defined (e.g., `logger = logging.getLogger(); logger.info(...)`).
|
||||
/// - Imported objects marked as loggers via the [`logger-objects`] setting, which can be
|
||||
/// - Imported objects marked as loggers via the [`lint.logger-objects`] setting, which can be
|
||||
/// used to enforce these rules against shared logger objects (e.g., `from module import logger; logger.info(...)`,
|
||||
/// when [`logger-objects`] is set to `["module.logger"]`).
|
||||
/// when [`lint.logger-objects`] is set to `["module.logger"]`).
|
||||
///
|
||||
/// ## Example
|
||||
/// ```python
|
||||
|
@ -68,7 +68,7 @@ use ruff_macros::{derive_message_formats, violation};
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `logger-objects`
|
||||
/// - `lint.logger-objects`
|
||||
///
|
||||
/// ## References
|
||||
/// - [Python documentation: `logging`](https://docs.python.org/3/library/logging.html)
|
||||
|
@ -114,9 +114,9 @@ impl Violation for LoggingStringFormat {
|
|||
/// - Uses of `flask.current_app.logger` (e.g., `from flask import current_app; current_app.logger.info(...)`).
|
||||
/// - Objects whose name starts with `log` or ends with `logger` or `logging`,
|
||||
/// when used in the same file in which they are defined (e.g., `logger = logging.getLogger(); logger.info(...)`).
|
||||
/// - Imported objects marked as loggers via the [`logger-objects`] setting, which can be
|
||||
/// - Imported objects marked as loggers via the [`lint.logger-objects`] setting, which can be
|
||||
/// used to enforce these rules against shared logger objects (e.g., `from module import logger; logger.info(...)`,
|
||||
/// when [`logger-objects`] is set to `["module.logger"]`).
|
||||
/// when [`lint.logger-objects`] is set to `["module.logger"]`).
|
||||
///
|
||||
/// ## Example
|
||||
/// ```python
|
||||
|
@ -152,7 +152,7 @@ impl Violation for LoggingStringFormat {
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `logger-objects`
|
||||
/// - `lint.logger-objects`
|
||||
///
|
||||
/// ## References
|
||||
/// - [Python documentation: `logging`](https://docs.python.org/3/library/logging.html)
|
||||
|
@ -197,9 +197,9 @@ impl Violation for LoggingPercentFormat {
|
|||
/// - Uses of `flask.current_app.logger` (e.g., `from flask import current_app; current_app.logger.info(...)`).
|
||||
/// - Objects whose name starts with `log` or ends with `logger` or `logging`,
|
||||
/// when used in the same file in which they are defined (e.g., `logger = logging.getLogger(); logger.info(...)`).
|
||||
/// - Imported objects marked as loggers via the [`logger-objects`] setting, which can be
|
||||
/// - Imported objects marked as loggers via the [`lint.logger-objects`] setting, which can be
|
||||
/// used to enforce these rules against shared logger objects (e.g., `from module import logger; logger.info(...)`,
|
||||
/// when [`logger-objects`] is set to `["module.logger"]`).
|
||||
/// when [`lint.logger-objects`] is set to `["module.logger"]`).
|
||||
///
|
||||
/// ## Example
|
||||
/// ```python
|
||||
|
@ -235,7 +235,7 @@ impl Violation for LoggingPercentFormat {
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `logger-objects`
|
||||
/// - `lint.logger-objects`
|
||||
///
|
||||
/// ## References
|
||||
/// - [Python documentation: `logging`](https://docs.python.org/3/library/logging.html)
|
||||
|
@ -279,9 +279,9 @@ impl Violation for LoggingStringConcat {
|
|||
/// - Uses of `flask.current_app.logger` (e.g., `from flask import current_app; current_app.logger.info(...)`).
|
||||
/// - Objects whose name starts with `log` or ends with `logger` or `logging`,
|
||||
/// when used in the same file in which they are defined (e.g., `logger = logging.getLogger(); logger.info(...)`).
|
||||
/// - Imported objects marked as loggers via the [`logger-objects`] setting, which can be
|
||||
/// - Imported objects marked as loggers via the [`lint.logger-objects`] setting, which can be
|
||||
/// used to enforce these rules against shared logger objects (e.g., `from module import logger; logger.info(...)`,
|
||||
/// when [`logger-objects`] is set to `["module.logger"]`).
|
||||
/// when [`lint.logger-objects`] is set to `["module.logger"]`).
|
||||
///
|
||||
/// ## Example
|
||||
/// ```python
|
||||
|
@ -317,7 +317,7 @@ impl Violation for LoggingStringConcat {
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `logger-objects`
|
||||
/// - `lint.logger-objects`
|
||||
///
|
||||
/// ## References
|
||||
/// - [Python documentation: `logging`](https://docs.python.org/3/library/logging.html)
|
||||
|
@ -349,9 +349,9 @@ impl Violation for LoggingFString {
|
|||
/// - Uses of `flask.current_app.logger` (e.g., `from flask import current_app; current_app.logger.info(...)`).
|
||||
/// - Objects whose name starts with `log` or ends with `logger` or `logging`,
|
||||
/// when used in the same file in which they are defined (e.g., `logger = logging.getLogger(); logger.info(...)`).
|
||||
/// - Imported objects marked as loggers via the [`logger-objects`] setting, which can be
|
||||
/// - Imported objects marked as loggers via the [`lint.logger-objects`] setting, which can be
|
||||
/// used to enforce these rules against shared logger objects (e.g., `from module import logger; logger.info(...)`,
|
||||
/// when [`logger-objects`] is set to `["module.logger"]`).
|
||||
/// when [`lint.logger-objects`] is set to `["module.logger"]`).
|
||||
///
|
||||
/// ## Example
|
||||
/// ```python
|
||||
|
@ -368,7 +368,7 @@ impl Violation for LoggingFString {
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `logger-objects`
|
||||
/// - `lint.logger-objects`
|
||||
///
|
||||
/// ## References
|
||||
/// - [Python documentation: `logging.warning`](https://docs.python.org/3/library/logging.html#logging.warning)
|
||||
|
@ -409,9 +409,9 @@ impl AlwaysFixableViolation for LoggingWarn {
|
|||
/// - Uses of `flask.current_app.logger` (e.g., `from flask import current_app; current_app.logger.info(...)`).
|
||||
/// - Objects whose name starts with `log` or ends with `logger` or `logging`,
|
||||
/// when used in the same file in which they are defined (e.g., `logger = logging.getLogger(); logger.info(...)`).
|
||||
/// - Imported objects marked as loggers via the [`logger-objects`] setting, which can be
|
||||
/// - Imported objects marked as loggers via the [`lint.logger-objects`] setting, which can be
|
||||
/// used to enforce these rules against shared logger objects (e.g., `from module import logger; logger.info(...)`,
|
||||
/// when [`logger-objects`] is set to `["module.logger"]`).
|
||||
/// when [`lint.logger-objects`] is set to `["module.logger"]`).
|
||||
///
|
||||
/// ## Example
|
||||
/// ```python
|
||||
|
@ -436,7 +436,7 @@ impl AlwaysFixableViolation for LoggingWarn {
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `logger-objects`
|
||||
/// - `lint.logger-objects`
|
||||
///
|
||||
/// ## References
|
||||
/// - [Python documentation: LogRecord attributes](https://docs.python.org/3/library/logging.html#logrecord-attributes)
|
||||
|
@ -470,9 +470,9 @@ impl Violation for LoggingExtraAttrClash {
|
|||
/// - Uses of `flask.current_app.logger` (e.g., `from flask import current_app; current_app.logger.info(...)`).
|
||||
/// - Objects whose name starts with `log` or ends with `logger` or `logging`,
|
||||
/// when used in the same file in which they are defined (e.g., `logger = logging.getLogger(); logger.info(...)`).
|
||||
/// - Imported objects marked as loggers via the [`logger-objects`] setting, which can be
|
||||
/// - Imported objects marked as loggers via the [`lint.logger-objects`] setting, which can be
|
||||
/// used to enforce these rules against shared logger objects (e.g., `from module import logger; logger.info(...)`,
|
||||
/// when [`logger-objects`] is set to `["module.logger"]`).
|
||||
/// when [`lint.logger-objects`] is set to `["module.logger"]`).
|
||||
///
|
||||
/// ## Example
|
||||
/// ```python
|
||||
|
@ -495,7 +495,7 @@ impl Violation for LoggingExtraAttrClash {
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `logger-objects`
|
||||
/// - `lint.logger-objects`
|
||||
///
|
||||
/// ## References
|
||||
/// - [Python documentation: `logging.exception`](https://docs.python.org/3/library/logging.html#logging.exception)
|
||||
|
@ -531,9 +531,9 @@ impl Violation for LoggingExcInfo {
|
|||
/// - Uses of `flask.current_app.logger` (e.g., `from flask import current_app; current_app.logger.info(...)`).
|
||||
/// - Objects whose name starts with `log` or ends with `logger` or `logging`,
|
||||
/// when used in the same file in which they are defined (e.g., `logger = logging.getLogger(); logger.info(...)`).
|
||||
/// - Imported objects marked as loggers via the [`logger-objects`] setting, which can be
|
||||
/// - Imported objects marked as loggers via the [`lint.logger-objects`] setting, which can be
|
||||
/// used to enforce these rules against shared logger objects (e.g., `from module import logger; logger.info(...)`,
|
||||
/// when [`logger-objects`] is set to `["module.logger"]`).
|
||||
/// when [`lint.logger-objects`] is set to `["module.logger"]`).
|
||||
///
|
||||
/// ## Example
|
||||
/// ```python
|
||||
|
@ -556,7 +556,7 @@ impl Violation for LoggingExcInfo {
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `logger-objects`
|
||||
/// - `lint.logger-objects`
|
||||
///
|
||||
/// ## References
|
||||
/// - [Python documentation: `logging.exception`](https://docs.python.org/3/library/logging.html#logging.exception)
|
||||
|
|
|
@ -24,7 +24,7 @@ use super::helpers::{
|
|||
|
||||
/// ## What it does
|
||||
/// Checks for argument-free `@pytest.fixture()` decorators with or without
|
||||
/// parentheses, depending on the `flake8-pytest-style.fixture-parentheses`
|
||||
/// parentheses, depending on the [`lint.flake8-pytest-style.fixture-parentheses`]
|
||||
/// setting.
|
||||
///
|
||||
/// ## Why is this bad?
|
||||
|
@ -55,7 +55,7 @@ use super::helpers::{
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `flake8-pytest-style.fixture-parentheses`
|
||||
/// - `lint.flake8-pytest-style.fixture-parentheses`
|
||||
///
|
||||
/// ## References
|
||||
/// - [`pytest` documentation: API Reference: Fixtures](https://docs.pytest.org/en/latest/reference/reference.html#fixtures-api)
|
||||
|
|
|
@ -11,7 +11,7 @@ use super::helpers::get_mark_decorators;
|
|||
|
||||
/// ## What it does
|
||||
/// Checks for argument-free `@pytest.mark.<marker>()` decorators with or
|
||||
/// without parentheses, depending on the `flake8-pytest-style.mark-parentheses`
|
||||
/// without parentheses, depending on the [`lint.flake8-pytest-style.mark-parentheses`]
|
||||
/// setting.
|
||||
///
|
||||
/// ## Why is this bad?
|
||||
|
@ -42,7 +42,7 @@ use super::helpers::get_mark_decorators;
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `flake8-pytest-style.mark-parentheses`
|
||||
/// - `lint.flake8-pytest-style.mark-parentheses`
|
||||
///
|
||||
/// ## References
|
||||
/// - [`pytest` documentation: Marks](https://docs.pytest.org/en/latest/reference/reference.html#marks)
|
||||
|
|
|
@ -26,7 +26,7 @@ use super::helpers::{is_pytest_parametrize, split_names};
|
|||
/// The `argnames` argument of `pytest.mark.parametrize` takes a string or
|
||||
/// a sequence of strings. For a single parameter, it's preferable to use a
|
||||
/// string. For multiple parameters, it's preferable to use the style
|
||||
/// configured via the [`flake8-pytest-style.parametrize-names-type`] setting.
|
||||
/// configured via the [`lint.flake8-pytest-style.parametrize-names-type`] setting.
|
||||
///
|
||||
/// ## Example
|
||||
/// ```python
|
||||
|
@ -67,7 +67,7 @@ use super::helpers::{is_pytest_parametrize, split_names};
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `flake8-pytest-style.parametrize-names-type`
|
||||
/// - `lint.flake8-pytest-style.parametrize-names-type`
|
||||
///
|
||||
/// ## References
|
||||
/// - [`pytest` documentation: How to parametrize fixtures and test functions](https://docs.pytest.org/en/latest/how-to/parametrize.html#pytest-mark-parametrize)
|
||||
|
@ -103,17 +103,17 @@ impl Violation for PytestParametrizeNamesWrongType {
|
|||
/// of values.
|
||||
///
|
||||
/// The style for the list of values rows can be configured via the
|
||||
/// the [`flake8-pytest-style.parametrize-values-type`] setting, while the
|
||||
/// the [`lint.flake8-pytest-style.parametrize-values-type`] setting, while the
|
||||
/// style for each row of values can be configured via the
|
||||
/// the [`flake8-pytest-style.parametrize-values-row-type`] setting.
|
||||
/// the [`lint.flake8-pytest-style.parametrize-values-row-type`] setting.
|
||||
///
|
||||
/// For example, [`flake8-pytest-style.parametrize-values-type`] will lead to
|
||||
/// For example, [`lint.flake8-pytest-style.parametrize-values-type`] will lead to
|
||||
/// the following expectations:
|
||||
///
|
||||
/// - `tuple`: `@pytest.mark.parametrize("value", ("a", "b", "c"))`
|
||||
/// - `list`: `@pytest.mark.parametrize("value", ["a", "b", "c"])`
|
||||
///
|
||||
/// Similarly, [`flake8-pytest-style.parametrize-values-row-type`] will lead to
|
||||
/// Similarly, [`lint.flake8-pytest-style.parametrize-values-row-type`] will lead to
|
||||
/// the following expectations:
|
||||
///
|
||||
/// - `tuple`: `@pytest.mark.parametrize(("key", "value"), [("a", "b"), ("c", "d")])`
|
||||
|
@ -170,8 +170,8 @@ impl Violation for PytestParametrizeNamesWrongType {
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `flake8-pytest-style.parametrize-values-type`
|
||||
/// - `flake8-pytest-style.parametrize-values-row-type`
|
||||
/// - `lint.flake8-pytest-style.parametrize-values-type`
|
||||
/// - `lint.flake8-pytest-style.parametrize-values-row-type`
|
||||
///
|
||||
/// ## References
|
||||
/// - [`pytest` documentation: How to parametrize fixtures and test functions](https://docs.pytest.org/en/latest/how-to/parametrize.html#pytest-mark-parametrize)
|
||||
|
|
|
@ -64,8 +64,8 @@ impl Violation for PytestRaisesWithMultipleStatements {
|
|||
/// unrelated to the code under test. To avoid this, `pytest.raises` should be
|
||||
/// called with a `match` parameter. The exception names that require a `match`
|
||||
/// parameter can be configured via the
|
||||
/// `flake8-pytest-style.raises-require-match-for` and
|
||||
/// `flake8-pytest-style.raises-extend-require-match-for` settings.
|
||||
/// [`lint.flake8-pytest-style.raises-require-match-for`] and
|
||||
/// [`lint.flake8-pytest-style.raises-extend-require-match-for`] settings.
|
||||
///
|
||||
/// ## Example
|
||||
/// ```python
|
||||
|
@ -92,8 +92,8 @@ impl Violation for PytestRaisesWithMultipleStatements {
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `flake8-pytest-style.raises-require-match-for`
|
||||
/// - `flake8-pytest-style.raises-extend-require-match-for`
|
||||
/// - `lint.flake8-pytest-style.raises-require-match-for`
|
||||
/// - `lint.flake8-pytest-style.raises-extend-require-match-for`
|
||||
///
|
||||
/// ## References
|
||||
/// - [`pytest` documentation: `pytest.raises`](https://docs.pytest.org/en/latest/reference/reference.html#pytest-raises)
|
||||
|
|
|
@ -14,7 +14,7 @@ use super::super::settings::Quote;
|
|||
|
||||
/// ## What it does
|
||||
/// Checks for inline strings that use single quotes or double quotes,
|
||||
/// depending on the value of the [`flake8-quotes.inline-quotes`] option.
|
||||
/// depending on the value of the [`lint.flake8-quotes.inline-quotes`] option.
|
||||
///
|
||||
/// ## Why is this bad?
|
||||
/// Consistency is good. Use either single or double quotes for inline
|
||||
|
@ -31,7 +31,7 @@ use super::super::settings::Quote;
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `flake8-quotes.inline-quotes`
|
||||
/// - `lint.flake8-quotes.inline-quotes`
|
||||
///
|
||||
/// ## Formatter compatibility
|
||||
/// We recommend against using this rule alongside the [formatter]. The
|
||||
|
@ -65,7 +65,7 @@ impl AlwaysFixableViolation for BadQuotesInlineString {
|
|||
|
||||
/// ## What it does
|
||||
/// Checks for multiline strings that use single quotes or double quotes,
|
||||
/// depending on the value of the [`flake8-quotes.multiline-quotes`]
|
||||
/// depending on the value of the [`lint.flake8-quotes.multiline-quotes`]
|
||||
/// setting.
|
||||
///
|
||||
/// ## Why is this bad?
|
||||
|
@ -87,7 +87,7 @@ impl AlwaysFixableViolation for BadQuotesInlineString {
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `flake8-quotes.multiline-quotes`
|
||||
/// - `lint.flake8-quotes.multiline-quotes`
|
||||
///
|
||||
/// ## Formatter compatibility
|
||||
/// We recommend against using this rule alongside the [formatter]. The
|
||||
|
@ -121,7 +121,7 @@ impl AlwaysFixableViolation for BadQuotesMultilineString {
|
|||
|
||||
/// ## What it does
|
||||
/// Checks for docstrings that use single quotes or double quotes, depending
|
||||
/// on the value of the [`flake8-quotes.docstring-quotes`] setting.
|
||||
/// on the value of the [`lint.flake8-quotes.docstring-quotes`] setting.
|
||||
///
|
||||
/// ## Why is this bad?
|
||||
/// Consistency is good. Use either single or double quotes for docstring
|
||||
|
@ -142,7 +142,7 @@ impl AlwaysFixableViolation for BadQuotesMultilineString {
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `flake8-quotes.docstring-quotes`
|
||||
/// - `lint.flake8-quotes.docstring-quotes`
|
||||
///
|
||||
/// ## Formatter compatibility
|
||||
/// We recommend against using this rule alongside the [formatter]. The
|
||||
|
|
|
@ -43,7 +43,7 @@ use crate::checkers::ast::Checker;
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `flake8-self.ignore-names`
|
||||
/// - `lint.flake8-self.ignore-names`
|
||||
///
|
||||
/// ## References
|
||||
/// - [_What is the meaning of single or double underscores before an object name?_](https://stackoverflow.com/questions/1301346/what-is-the-meaning-of-single-and-double-underscore-before-an-object-name)
|
||||
|
|
|
@ -24,7 +24,7 @@ use crate::rules::flake8_tidy_imports::matchers::NameMatchPolicy;
|
|||
/// automatic way.
|
||||
///
|
||||
/// ## Options
|
||||
/// - `flake8-tidy-imports.banned-api`
|
||||
/// - `lint.flake8-tidy-imports.banned-api`
|
||||
#[violation]
|
||||
pub struct BannedApi {
|
||||
name: String,
|
||||
|
|
|
@ -38,7 +38,7 @@ use crate::rules::flake8_tidy_imports::matchers::NameMatchPolicy;
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `flake8-tidy-imports.banned-module-level-imports`
|
||||
/// - `lint.flake8-tidy-imports.banned-module-level-imports`
|
||||
#[violation]
|
||||
pub struct BannedModuleLevelImports {
|
||||
name: String,
|
||||
|
|
|
@ -42,7 +42,7 @@ use crate::rules::flake8_tidy_imports::settings::Strictness;
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `flake8-tidy-imports.ban-relative-imports`
|
||||
/// - `lint.flake8-tidy-imports.ban-relative-imports`
|
||||
///
|
||||
/// [PEP 8]: https://peps.python.org/pep-0008/#imports
|
||||
#[violation]
|
||||
|
|
|
@ -22,7 +22,7 @@ use crate::rules::flake8_type_checking::imports::ImportBinding;
|
|||
/// The type-checking block is not executed at runtime, so the import will not
|
||||
/// be available at runtime.
|
||||
///
|
||||
/// If [`flake8-type-checking.quote-annotations`] is set to `true`,
|
||||
/// If [`lint.flake8-type-checking.quote-annotations`] is set to `true`,
|
||||
/// annotations will be wrapped in quotes if doing so would enable the
|
||||
/// corresponding import to remain in the type-checking block.
|
||||
///
|
||||
|
@ -48,7 +48,7 @@ use crate::rules::flake8_type_checking::imports::ImportBinding;
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `flake8-type-checking.quote-annotations`
|
||||
/// - `lint.flake8-type-checking.quote-annotations`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 535](https://peps.python.org/pep-0563/#runtime-annotation-resolution-and-type-checking)
|
||||
|
|
|
@ -28,14 +28,14 @@ use crate::rules::isort::{categorize, ImportSection, ImportType};
|
|||
/// instead be imported conditionally under an `if TYPE_CHECKING:` block to
|
||||
/// minimize runtime overhead.
|
||||
///
|
||||
/// If [`flake8-type-checking.quote-annotations`] is set to `true`,
|
||||
/// If [`lint.flake8-type-checking.quote-annotations`] is set to `true`,
|
||||
/// annotations will be wrapped in quotes if doing so would enable the
|
||||
/// corresponding import to be moved into an `if TYPE_CHECKING:` block.
|
||||
///
|
||||
/// If a class _requires_ that type annotations be available at runtime (as is
|
||||
/// the case for Pydantic, SQLAlchemy, and other libraries), consider using
|
||||
/// the [`flake8-type-checking.runtime-evaluated-base-classes`] and
|
||||
/// [`flake8-type-checking.runtime-evaluated-decorators`] settings to mark them
|
||||
/// the [`lint.flake8-type-checking.runtime-evaluated-base-classes`] and
|
||||
/// [`lint.flake8-type-checking.runtime-evaluated-decorators`] settings to mark them
|
||||
/// as such.
|
||||
///
|
||||
/// ## Example
|
||||
|
@ -64,9 +64,9 @@ use crate::rules::isort::{categorize, ImportSection, ImportType};
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `flake8-type-checking.quote-annotations`
|
||||
/// - `flake8-type-checking.runtime-evaluated-base-classes`
|
||||
/// - `flake8-type-checking.runtime-evaluated-decorators`
|
||||
/// - `lint.flake8-type-checking.quote-annotations`
|
||||
/// - `lint.flake8-type-checking.runtime-evaluated-base-classes`
|
||||
/// - `lint.flake8-type-checking.runtime-evaluated-decorators`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 536](https://peps.python.org/pep-0563/#runtime-annotation-resolution-and-type-checking)
|
||||
|
@ -101,14 +101,14 @@ impl Violation for TypingOnlyFirstPartyImport {
|
|||
/// instead be imported conditionally under an `if TYPE_CHECKING:` block to
|
||||
/// minimize runtime overhead.
|
||||
///
|
||||
/// If [`flake8-type-checking.quote-annotations`] is set to `true`,
|
||||
/// If [`lint.flake8-type-checking.quote-annotations`] is set to `true`,
|
||||
/// annotations will be wrapped in quotes if doing so would enable the
|
||||
/// corresponding import to be moved into an `if TYPE_CHECKING:` block.
|
||||
///
|
||||
/// If a class _requires_ that type annotations be available at runtime (as is
|
||||
/// the case for Pydantic, SQLAlchemy, and other libraries), consider using
|
||||
/// the [`flake8-type-checking.runtime-evaluated-base-classes`] and
|
||||
/// [`flake8-type-checking.runtime-evaluated-decorators`] settings to mark them
|
||||
/// the [`lint.flake8-type-checking.runtime-evaluated-base-classes`] and
|
||||
/// [`lint.flake8-type-checking.runtime-evaluated-decorators`] settings to mark them
|
||||
/// as such.
|
||||
///
|
||||
/// ## Example
|
||||
|
@ -137,9 +137,9 @@ impl Violation for TypingOnlyFirstPartyImport {
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `flake8-type-checking.quote-annotations`
|
||||
/// - `flake8-type-checking.runtime-evaluated-base-classes`
|
||||
/// - `flake8-type-checking.runtime-evaluated-decorators`
|
||||
/// - `lint.flake8-type-checking.quote-annotations`
|
||||
/// - `lint.flake8-type-checking.runtime-evaluated-base-classes`
|
||||
/// - `lint.flake8-type-checking.runtime-evaluated-decorators`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 536](https://peps.python.org/pep-0563/#runtime-annotation-resolution-and-type-checking)
|
||||
|
@ -174,14 +174,14 @@ impl Violation for TypingOnlyThirdPartyImport {
|
|||
/// instead be imported conditionally under an `if TYPE_CHECKING:` block to
|
||||
/// minimize runtime overhead.
|
||||
///
|
||||
/// If [`flake8-type-checking.quote-annotations`] is set to `true`,
|
||||
/// If [`lint.flake8-type-checking.quote-annotations`] is set to `true`,
|
||||
/// annotations will be wrapped in quotes if doing so would enable the
|
||||
/// corresponding import to be moved into an `if TYPE_CHECKING:` block.
|
||||
///
|
||||
/// If a class _requires_ that type annotations be available at runtime (as is
|
||||
/// the case for Pydantic, SQLAlchemy, and other libraries), consider using
|
||||
/// the [`flake8-type-checking.runtime-evaluated-base-classes`] and
|
||||
/// [`flake8-type-checking.runtime-evaluated-decorators`] settings to mark them
|
||||
/// the [`lint.flake8-type-checking.runtime-evaluated-base-classes`] and
|
||||
/// [`lint.flake8-type-checking.runtime-evaluated-decorators`] settings to mark them
|
||||
/// as such.
|
||||
///
|
||||
/// ## Example
|
||||
|
@ -210,9 +210,9 @@ impl Violation for TypingOnlyThirdPartyImport {
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `flake8-type-checking.quote-annotations`
|
||||
/// - `flake8-type-checking.runtime-evaluated-base-classes`
|
||||
/// - `flake8-type-checking.runtime-evaluated-decorators`
|
||||
/// - `lint.flake8-type-checking.quote-annotations`
|
||||
/// - `lint.flake8-type-checking.runtime-evaluated-base-classes`
|
||||
/// - `lint.flake8-type-checking.runtime-evaluated-decorators`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 536](https://peps.python.org/pep-0563/#runtime-annotation-resolution-and-type-checking)
|
||||
|
|
|
@ -44,7 +44,7 @@ use ruff_python_ast::identifier::Identifier;
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `mccabe.max-complexity`
|
||||
/// - `lint.mccabe.max-complexity`
|
||||
#[violation]
|
||||
pub struct ComplexStructure {
|
||||
name: String,
|
||||
|
|
|
@ -22,10 +22,10 @@ use crate::checkers::ast::Checker;
|
|||
/// > append a single trailing underscore rather than use an abbreviation or spelling corruption.
|
||||
/// > Thus `class_` is better than `clss`. (Perhaps better is to avoid such clashes by using a synonym.)
|
||||
///
|
||||
/// Names can be excluded from this rule using the [`pep8-naming.ignore-names`]
|
||||
/// or [`pep8-naming.extend-ignore-names`] configuration options. For example,
|
||||
/// Names can be excluded from this rule using the [`lint.pep8-naming.ignore-names`]
|
||||
/// or [`lint.pep8-naming.extend-ignore-names`] configuration options. For example,
|
||||
/// to allow the use of `klass` as the first argument to class methods, set
|
||||
/// the [`pep8-naming.extend-ignore-names`] option to `["klass"]`.
|
||||
/// the [`lint.pep8-naming.extend-ignore-names`] option to `["klass"]`.
|
||||
///
|
||||
/// ## Example
|
||||
/// ```python
|
||||
|
@ -44,10 +44,10 @@ use crate::checkers::ast::Checker;
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `pep8-naming.classmethod-decorators`
|
||||
/// - `pep8-naming.staticmethod-decorators`
|
||||
/// - `pep8-naming.ignore-names`
|
||||
/// - `pep8-naming.extend-ignore-names`
|
||||
/// - `lint.pep8-naming.classmethod-decorators`
|
||||
/// - `lint.pep8-naming.staticmethod-decorators`
|
||||
/// - `lint.pep8-naming.ignore-names`
|
||||
/// - `lint.pep8-naming.extend-ignore-names`
|
||||
///
|
||||
/// [PEP 8]: https://peps.python.org/pep-0008/#function-and-method-arguments
|
||||
#[violation]
|
||||
|
|
|
@ -22,10 +22,10 @@ use crate::checkers::ast::Checker;
|
|||
/// > append a single trailing underscore rather than use an abbreviation or spelling corruption.
|
||||
/// > Thus `class_` is better than `clss`. (Perhaps better is to avoid such clashes by using a synonym.)
|
||||
///
|
||||
/// Names can be excluded from this rule using the [`pep8-naming.ignore-names`]
|
||||
/// or [`pep8-naming.extend-ignore-names`] configuration options. For example,
|
||||
/// Names can be excluded from this rule using the [`lint.pep8-naming.ignore-names`]
|
||||
/// or [`lint.pep8-naming.extend-ignore-names`] configuration options. For example,
|
||||
/// to allow the use of `this` as the first argument to instance methods, set
|
||||
/// the [`pep8-naming.extend-ignore-names`] option to `["this"]`.
|
||||
/// the [`lint.pep8-naming.extend-ignore-names`] option to `["this"]`.
|
||||
///
|
||||
/// ## Example
|
||||
/// ```python
|
||||
|
@ -42,10 +42,10 @@ use crate::checkers::ast::Checker;
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `pep8-naming.classmethod-decorators`
|
||||
/// - `pep8-naming.staticmethod-decorators`
|
||||
/// - `pep8-naming.ignore-names`
|
||||
/// - `pep8-naming.extend-ignore-names`
|
||||
/// - `lint.pep8-naming.classmethod-decorators`
|
||||
/// - `lint.pep8-naming.staticmethod-decorators`
|
||||
/// - `lint.pep8-naming.ignore-names`
|
||||
/// - `lint.pep8-naming.extend-ignore-names`
|
||||
///
|
||||
/// [PEP 8]: https://peps.python.org/pep-0008/#function-and-method-arguments
|
||||
#[violation]
|
||||
|
|
|
@ -20,10 +20,10 @@ use crate::settings::types::IdentifierPattern;
|
|||
/// > improve readability. mixedCase is allowed only in contexts where that’s already the
|
||||
/// > prevailing style (e.g. threading.py), to retain backwards compatibility.
|
||||
///
|
||||
/// Names can be excluded from this rule using the [`pep8-naming.ignore-names`]
|
||||
/// or [`pep8-naming.extend-ignore-names`] configuration options. For example,
|
||||
/// Names can be excluded from this rule using the [`lint.pep8-naming.ignore-names`]
|
||||
/// or [`lint.pep8-naming.extend-ignore-names`] configuration options. For example,
|
||||
/// to ignore all functions starting with `test_` from this rule, set the
|
||||
/// [`pep8-naming.extend-ignore-names`] option to `["test_*"]`.
|
||||
/// [`lint.pep8-naming.extend-ignore-names`] option to `["test_*"]`.
|
||||
///
|
||||
/// ## Example
|
||||
/// ```python
|
||||
|
@ -38,8 +38,8 @@ use crate::settings::types::IdentifierPattern;
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `pep8-naming.ignore-names`
|
||||
/// - `pep8-naming.extend-ignore-names`
|
||||
/// - `lint.pep8-naming.ignore-names`
|
||||
/// - `lint.pep8-naming.extend-ignore-names`
|
||||
///
|
||||
/// [PEP 8]: https://peps.python.org/pep-0008/#function-and-variable-names
|
||||
#[violation]
|
||||
|
|
|
@ -34,8 +34,8 @@ use crate::rules::pep8_naming::helpers;
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `pep8-naming.ignore-names`
|
||||
/// - `pep8-naming.extend-ignore-names`
|
||||
/// - `lint.pep8-naming.ignore-names`
|
||||
/// - `lint.pep8-naming.extend-ignore-names`
|
||||
///
|
||||
/// [PEP 8]: https://peps.python.org/pep-0008/#function-and-variable-names
|
||||
#[violation]
|
||||
|
|
|
@ -13,7 +13,7 @@ use crate::settings::LinterSettings;
|
|||
/// For flowing long blocks of text (docstrings or comments), overlong lines
|
||||
/// can hurt readability. [PEP 8], for example, recommends that such lines be
|
||||
/// limited to 72 characters, while this rule enforces the limit specified by
|
||||
/// the [`pycodestyle.max-doc-length`] setting. (If no value is provided, this
|
||||
/// the [`lint.pycodestyle.max-doc-length`] setting. (If no value is provided, this
|
||||
/// rule will be ignored, even if it's added to your `--select` list.)
|
||||
///
|
||||
/// In the context of this rule, a "doc line" is defined as a line consisting
|
||||
|
@ -32,8 +32,8 @@ use crate::settings::LinterSettings;
|
|||
/// overlong if a pragma comment _causes_ it to exceed the line length.
|
||||
/// (This behavior aligns with that of the Ruff formatter.)
|
||||
///
|
||||
/// If [`pycodestyle.ignore-overlong-task-comments`] is `true`, this rule will
|
||||
/// also ignore comments that start with any of the specified [`task-tags`]
|
||||
/// If [`lint.pycodestyle.ignore-overlong-task-comments`] is `true`, this rule will
|
||||
/// also ignore comments that start with any of the specified [`lint.task-tags`]
|
||||
/// (e.g., `# TODO:`).
|
||||
///
|
||||
/// ## Example
|
||||
|
@ -65,9 +65,9 @@ use crate::settings::LinterSettings;
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `task-tags`
|
||||
/// - `pycodestyle.max-doc-length`
|
||||
/// - `pycodestyle.ignore-overlong-task-comments`
|
||||
/// - `lint.task-tags`
|
||||
/// - `lint.pycodestyle.max-doc-length`
|
||||
/// - `lint.pycodestyle.ignore-overlong-task-comments`
|
||||
///
|
||||
/// [PEP 8]: https://peps.python.org/pep-0008/#maximum-line-length
|
||||
#[violation]
|
||||
|
|
|
@ -28,8 +28,8 @@ use crate::settings::LinterSettings;
|
|||
/// overlong if a pragma comment _causes_ it to exceed the line length.
|
||||
/// (This behavior aligns with that of the Ruff formatter.)
|
||||
///
|
||||
/// If [`pycodestyle.ignore-overlong-task-comments`] is `true`, this rule will
|
||||
/// also ignore comments that start with any of the specified [`task-tags`]
|
||||
/// If [`lint.pycodestyle.ignore-overlong-task-comments`] is `true`, this rule will
|
||||
/// also ignore comments that start with any of the specified [`lint.task-tags`]
|
||||
/// (e.g., `# TODO:`).
|
||||
///
|
||||
/// ## Example
|
||||
|
@ -60,9 +60,9 @@ use crate::settings::LinterSettings;
|
|||
///
|
||||
/// ## Options
|
||||
/// - `line-length`
|
||||
/// - `task-tags`
|
||||
/// - `pycodestyle.ignore-overlong-task-comments`
|
||||
/// - `pycodestyle.max-line-length`
|
||||
/// - `lint.task-tags`
|
||||
/// - `lint.pycodestyle.ignore-overlong-task-comments`
|
||||
/// - `lint.pycodestyle.max-line-length`
|
||||
///
|
||||
/// [PEP 8]: https://peps.python.org/pep-0008/#maximum-line-length
|
||||
#[violation]
|
||||
|
|
|
@ -37,7 +37,7 @@ use crate::registry::Rule;
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `pydocstyle.convention`
|
||||
/// - `lint.pydocstyle.convention`
|
||||
///
|
||||
/// [D211]: https://docs.astral.sh/ruff/rules/blank-line-before-class
|
||||
#[violation]
|
||||
|
@ -84,7 +84,7 @@ impl AlwaysFixableViolation for OneBlankLineBeforeClass {
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `pydocstyle.convention`
|
||||
/// - `lint.pydocstyle.convention`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
|
@ -134,7 +134,7 @@ impl AlwaysFixableViolation for OneBlankLineAfterClass {
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `pydocstyle.convention`
|
||||
/// - `lint.pydocstyle.convention`
|
||||
///
|
||||
/// [D203]: https://docs.astral.sh/ruff/rules/one-blank-line-before-class
|
||||
#[violation]
|
||||
|
|
|
@ -36,7 +36,7 @@ use crate::rules::pydocstyle::helpers::logical_line;
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `pydocstyle.convention`
|
||||
/// - `lint.pydocstyle.convention`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
|
|
|
@ -37,7 +37,7 @@ use crate::rules::pydocstyle::helpers::logical_line;
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `pydocstyle.convention`
|
||||
/// - `lint.pydocstyle.convention`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
|
|
|
@ -32,7 +32,7 @@ use crate::docstrings::Docstring;
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `pydocstyle.convention`
|
||||
/// - `lint.pydocstyle.convention`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
|
|
|
@ -43,7 +43,7 @@ static MOOD: Lazy<Mood> = Lazy::new(Mood::new);
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `pydocstyle.convention`
|
||||
/// - `lint.pydocstyle.convention`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
|
|
|
@ -76,7 +76,7 @@ use crate::rules::pydocstyle::settings::Convention;
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `pydocstyle.convention`
|
||||
/// - `lint.pydocstyle.convention`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
|
@ -175,7 +175,7 @@ impl AlwaysFixableViolation for SectionNotOverIndented {
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `pydocstyle.convention`
|
||||
/// - `lint.pydocstyle.convention`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
|
@ -253,7 +253,7 @@ impl AlwaysFixableViolation for SectionUnderlineNotOverIndented {
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `pydocstyle.convention`
|
||||
/// - `lint.pydocstyle.convention`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
|
@ -350,7 +350,7 @@ impl AlwaysFixableViolation for CapitalizeSectionName {
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `pydocstyle.convention`
|
||||
/// - `lint.pydocstyle.convention`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
|
@ -446,7 +446,7 @@ impl AlwaysFixableViolation for NewLineAfterSectionName {
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `pydocstyle.convention`
|
||||
/// - `lint.pydocstyle.convention`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
|
@ -548,7 +548,7 @@ impl AlwaysFixableViolation for DashedUnderlineAfterSection {
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `pydocstyle.convention`
|
||||
/// - `lint.pydocstyle.convention`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
|
@ -647,7 +647,7 @@ impl AlwaysFixableViolation for SectionUnderlineAfterName {
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `pydocstyle.convention`
|
||||
/// - `lint.pydocstyle.convention`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
|
@ -741,7 +741,7 @@ impl AlwaysFixableViolation for SectionUnderlineMatchesSectionLength {
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `pydocstyle.convention`
|
||||
/// - `lint.pydocstyle.convention`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
|
@ -835,7 +835,7 @@ impl AlwaysFixableViolation for NoBlankLineAfterSection {
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `pydocstyle.convention`
|
||||
/// - `lint.pydocstyle.convention`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
|
@ -931,7 +931,7 @@ impl AlwaysFixableViolation for NoBlankLineBeforeSection {
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `pydocstyle.convention`
|
||||
/// - `lint.pydocstyle.convention`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
|
@ -1021,7 +1021,7 @@ impl AlwaysFixableViolation for BlankLineAfterLastSection {
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `pydocstyle.convention`
|
||||
/// - `lint.pydocstyle.convention`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
|
@ -1098,7 +1098,7 @@ impl Violation for EmptyDocstringSection {
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `pydocstyle.convention`
|
||||
/// - `lint.pydocstyle.convention`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
|
@ -1180,7 +1180,7 @@ impl AlwaysFixableViolation for SectionNameEndsInColon {
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `pydocstyle.convention`
|
||||
/// - `lint.pydocstyle.convention`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
|
@ -1264,7 +1264,7 @@ impl Violation for UndocumentedParam {
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `pydocstyle.convention`
|
||||
/// - `lint.pydocstyle.convention`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
|
|
|
@ -33,7 +33,7 @@ use crate::rules::pydocstyle::helpers::normalize_word;
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `pydocstyle.convention`
|
||||
/// - `lint.pydocstyle.convention`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
|
|
|
@ -54,7 +54,7 @@ enum UnusedImportContext {
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `pyflakes.extend-generics`
|
||||
/// - `lint.pyflakes.extend-generics`
|
||||
///
|
||||
/// ## References
|
||||
/// - [Python documentation: `import`](https://docs.python.org/3/reference/simple_stmts.html#the-import-statement)
|
||||
|
|
|
@ -22,7 +22,7 @@ use crate::fix::edits::delete_stmt;
|
|||
///
|
||||
/// If a variable is intentionally defined-but-not-used, it should be
|
||||
/// prefixed with an underscore, or some other value that adheres to the
|
||||
/// [`dummy-variable-rgx`] pattern.
|
||||
/// [`lint.dummy-variable-rgx`] pattern.
|
||||
///
|
||||
/// Under [preview mode](https://docs.astral.sh/ruff/preview), this rule also
|
||||
/// triggers on unused unpacked assignments (for example, `x, y = foo()`).
|
||||
|
@ -43,7 +43,7 @@ use crate::fix::edits::delete_stmt;
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `dummy-variable-rgx`
|
||||
/// - `lint.dummy-variable-rgx`
|
||||
#[violation]
|
||||
pub struct UnusedVariable {
|
||||
pub name: String,
|
||||
|
|
|
@ -24,7 +24,7 @@ use crate::rules::pylint::helpers::is_known_dunder_method;
|
|||
/// `__init__`), as well as methods that are marked with `@override`.
|
||||
///
|
||||
/// Additional dunder methods names can be allowed via the
|
||||
/// [`pylint.allow-dunder-method-names`] setting.
|
||||
/// [`lint.pylint.allow-dunder-method-names`] setting.
|
||||
///
|
||||
/// ## Example
|
||||
/// ```python
|
||||
|
@ -41,7 +41,7 @@ use crate::rules::pylint::helpers::is_known_dunder_method;
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `pylint.allow-dunder-method-names`
|
||||
/// - `lint.pylint.allow-dunder-method-names`
|
||||
#[violation]
|
||||
pub struct BadDunderMethodName {
|
||||
name: String,
|
||||
|
|
|
@ -10,7 +10,7 @@ use crate::checkers::ast::Checker;
|
|||
/// Checks for function definitions that include too many arguments.
|
||||
///
|
||||
/// By default, this rule allows up to five arguments, as configured by the
|
||||
/// [`pylint.max-args`] option.
|
||||
/// [`lint.pylint.max-args`] option.
|
||||
///
|
||||
/// ## Why is this bad?
|
||||
/// Functions with many arguments are harder to understand, maintain, and call.
|
||||
|
@ -42,7 +42,7 @@ use crate::checkers::ast::Checker;
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `pylint.max-args`
|
||||
/// - `lint.pylint.max-args`
|
||||
#[violation]
|
||||
pub struct TooManyArguments {
|
||||
c_args: usize,
|
||||
|
|
|
@ -10,7 +10,7 @@ use crate::checkers::ast::Checker;
|
|||
/// Checks for too many Boolean expressions in an `if` statement.
|
||||
///
|
||||
/// By default, this rule allows up to 5 expressions. This can be configured
|
||||
/// using the [`pylint.max-bool-expr`] option.
|
||||
/// using the [`lint.pylint.max-bool-expr`] option.
|
||||
///
|
||||
/// ## Why is this bad?
|
||||
/// `if` statements with many Boolean expressions are harder to understand
|
||||
|
@ -24,7 +24,7 @@ use crate::checkers::ast::Checker;
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `pylint.max-bool-expr`
|
||||
/// - `lint.pylint.max-bool-expr`
|
||||
#[violation]
|
||||
pub struct TooManyBooleanExpressions {
|
||||
expressions: usize,
|
||||
|
|
|
@ -8,7 +8,7 @@ use ruff_python_ast::identifier::Identifier;
|
|||
/// Checks for functions or methods with too many branches.
|
||||
///
|
||||
/// By default, this rule allows up to 12 branches. This can be configured
|
||||
/// using the [`pylint.max-branches`] option.
|
||||
/// using the [`lint.pylint.max-branches`] option.
|
||||
///
|
||||
/// ## Why is this bad?
|
||||
/// Functions or methods with many branches are harder to understand
|
||||
|
@ -67,7 +67,7 @@ use ruff_python_ast::identifier::Identifier;
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `pylint.max-branches`
|
||||
/// - `lint.pylint.max-branches`
|
||||
#[violation]
|
||||
pub struct TooManyBranches {
|
||||
branches: usize,
|
||||
|
|
|
@ -9,7 +9,7 @@ use crate::checkers::ast::Checker;
|
|||
/// Checks for functions that include too many local variables.
|
||||
///
|
||||
/// By default, this rule allows up to fifteen locals, as configured by the
|
||||
/// [`pylint.max-locals`] option.
|
||||
/// [`lint.pylint.max-locals`] option.
|
||||
///
|
||||
/// ## Why is this bad?
|
||||
/// Functions with many local variables are harder to understand and maintain.
|
||||
|
@ -18,7 +18,7 @@ use crate::checkers::ast::Checker;
|
|||
/// functions with fewer assignments.
|
||||
///
|
||||
/// ## Options
|
||||
/// - `pylint.max-locals`
|
||||
/// - `lint.pylint.max-locals`
|
||||
#[violation]
|
||||
pub struct TooManyLocals {
|
||||
current_amount: usize,
|
||||
|
|
|
@ -10,14 +10,14 @@ use crate::checkers::ast::Checker;
|
|||
/// Checks for functions or methods with too many nested blocks.
|
||||
///
|
||||
/// By default, this rule allows up to five nested blocks.
|
||||
/// This can be configured using the [`pylint.max-nested-blocks`] option.
|
||||
/// This can be configured using the [`lint.pylint.max-nested-blocks`] option.
|
||||
///
|
||||
/// ## Why is this bad?
|
||||
/// Functions or methods with too many nested blocks are harder to understand
|
||||
/// and maintain.
|
||||
///
|
||||
/// ## Options
|
||||
/// - `pylint.max-nested-blocks`
|
||||
/// - `lint.pylint.max-nested-blocks`
|
||||
#[violation]
|
||||
pub struct TooManyNestedBlocks {
|
||||
nested_blocks: usize,
|
||||
|
|
|
@ -9,7 +9,7 @@ use crate::checkers::ast::Checker;
|
|||
/// Checks for function definitions that include too many positional arguments.
|
||||
///
|
||||
/// By default, this rule allows up to five arguments, as configured by the
|
||||
/// [`pylint.max-positional-args`] option.
|
||||
/// [`lint.pylint.max-positional-args`] option.
|
||||
///
|
||||
/// ## Why is this bad?
|
||||
/// Functions with many arguments are harder to understand, maintain, and call.
|
||||
|
@ -40,7 +40,7 @@ use crate::checkers::ast::Checker;
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `pylint.max-positional-args`
|
||||
/// - `lint.pylint.max-positional-args`
|
||||
#[violation]
|
||||
pub struct TooManyPositional {
|
||||
c_pos: usize,
|
||||
|
|
|
@ -10,7 +10,7 @@ use crate::checkers::ast::Checker;
|
|||
/// Checks for classes with too many public methods
|
||||
///
|
||||
/// By default, this rule allows up to 20 public methods, as configured by
|
||||
/// the [`pylint.max-public-methods`] option.
|
||||
/// the [`lint.pylint.max-public-methods`] option.
|
||||
///
|
||||
/// ## Why is this bad?
|
||||
/// Classes with many public methods are harder to understand
|
||||
|
@ -81,7 +81,7 @@ use crate::checkers::ast::Checker;
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `pylint.max-public-methods`
|
||||
/// - `lint.pylint.max-public-methods`
|
||||
#[violation]
|
||||
pub struct TooManyPublicMethods {
|
||||
methods: usize,
|
||||
|
|
|
@ -10,7 +10,7 @@ use ruff_python_ast::visitor::Visitor;
|
|||
/// Checks for functions or methods with too many return statements.
|
||||
///
|
||||
/// By default, this rule allows up to six return statements, as configured by
|
||||
/// the [`pylint.max-returns`] option.
|
||||
/// the [`lint.pylint.max-returns`] option.
|
||||
///
|
||||
/// ## Why is this bad?
|
||||
/// Functions or methods with many return statements are harder to understand
|
||||
|
@ -50,7 +50,7 @@ use ruff_python_ast::visitor::Visitor;
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `pylint.max-returns`
|
||||
/// - `lint.pylint.max-returns`
|
||||
#[violation]
|
||||
pub struct TooManyReturnStatements {
|
||||
returns: usize,
|
||||
|
|
|
@ -8,7 +8,7 @@ use ruff_python_ast::identifier::Identifier;
|
|||
/// Checks for functions or methods with too many statements.
|
||||
///
|
||||
/// By default, this rule allows up to 50 statements, as configured by the
|
||||
/// [`pylint.max-statements`] option.
|
||||
/// [`lint.pylint.max-statements`] option.
|
||||
///
|
||||
/// ## Why is this bad?
|
||||
/// Functions or methods with many statements are harder to understand
|
||||
|
@ -44,7 +44,7 @@ use ruff_python_ast::identifier::Identifier;
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `pylint.max-statements`
|
||||
/// - `lint.pylint.max-statements`
|
||||
#[violation]
|
||||
pub struct TooManyStatements {
|
||||
statements: usize,
|
||||
|
|
|
@ -30,7 +30,7 @@ use crate::settings::types::PythonVersion;
|
|||
/// `__future__` annotations are not evaluated at runtime. If your code relies
|
||||
/// on runtime type annotations (either directly or via a library like
|
||||
/// Pydantic), you can disable this behavior for Python versions prior to 3.9
|
||||
/// by setting [`pyupgrade.keep-runtime-typing`] to `true`.
|
||||
/// by setting [`lint.pyupgrade.keep-runtime-typing`] to `true`.
|
||||
///
|
||||
/// ## Example
|
||||
/// ```python
|
||||
|
@ -51,7 +51,7 @@ use crate::settings::types::PythonVersion;
|
|||
///
|
||||
/// ## Options
|
||||
/// - `target-version`
|
||||
/// - `pyupgrade.keep-runtime-typing`
|
||||
/// - `lint.pyupgrade.keep-runtime-typing`
|
||||
///
|
||||
/// [PEP 585]: https://peps.python.org/pep-0585/
|
||||
#[violation]
|
||||
|
|
|
@ -23,7 +23,7 @@ use crate::settings::types::PythonVersion;
|
|||
/// `__future__` annotations are not evaluated at runtime. If your code relies
|
||||
/// on runtime type annotations (either directly or via a library like
|
||||
/// Pydantic), you can disable this behavior for Python versions prior to 3.10
|
||||
/// by setting [`pyupgrade.keep-runtime-typing`] to `true`.
|
||||
/// by setting [`lint.pyupgrade.keep-runtime-typing`] to `true`.
|
||||
///
|
||||
/// ## Example
|
||||
/// ```python
|
||||
|
@ -46,7 +46,7 @@ use crate::settings::types::PythonVersion;
|
|||
///
|
||||
/// ## Options
|
||||
/// - `target-version`
|
||||
/// - `pyupgrade.keep-runtime-typing`
|
||||
/// - `lint.pyupgrade.keep-runtime-typing`
|
||||
///
|
||||
/// [PEP 604]: https://peps.python.org/pep-0604/
|
||||
#[violation]
|
||||
|
|
|
@ -28,7 +28,7 @@ use crate::settings::LinterSettings;
|
|||
/// spec recommends `GREEK CAPITAL LETTER OMEGA` over `OHM SIGN`.
|
||||
///
|
||||
/// You can omit characters from being flagged as ambiguous via the
|
||||
/// [`allowed-confusables`] setting.
|
||||
/// [`lint.allowed-confusables`] setting.
|
||||
///
|
||||
/// ## Example
|
||||
/// ```python
|
||||
|
@ -41,7 +41,7 @@ use crate::settings::LinterSettings;
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `allowed-confusables`
|
||||
/// - `lint.allowed-confusables`
|
||||
///
|
||||
/// [preview]: https://docs.astral.sh/ruff/preview/
|
||||
#[violation]
|
||||
|
@ -94,7 +94,7 @@ impl Violation for AmbiguousUnicodeCharacterString {
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `allowed-confusables`
|
||||
/// - `lint.allowed-confusables`
|
||||
///
|
||||
/// [preview]: https://docs.astral.sh/ruff/preview/
|
||||
#[violation]
|
||||
|
@ -147,7 +147,7 @@ impl Violation for AmbiguousUnicodeCharacterDocstring {
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `allowed-confusables`
|
||||
/// - `lint.allowed-confusables`
|
||||
///
|
||||
/// [preview]: https://docs.astral.sh/ruff/preview/
|
||||
#[violation]
|
||||
|
|
|
@ -53,7 +53,7 @@ use crate::rules::ruff::rules::helpers::{
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `flake8-bugbear.extend-immutable-calls`
|
||||
/// - `lint.flake8-bugbear.extend-immutable-calls`
|
||||
#[violation]
|
||||
pub struct FunctionCallInDataclassDefaultArgument {
|
||||
name: Option<String>,
|
||||
|
|
|
@ -30,7 +30,7 @@ use crate::checkers::ast::Checker;
|
|||
/// ...
|
||||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// ## References
|
||||
/// - [Python documentation: `typing.Never`](https://docs.python.org/3/library/typing.html#typing.Never)
|
||||
/// - [Python documentation: `typing.NoReturn`](https://docs.python.org/3/library/typing.html#typing.NoReturn)
|
||||
#[violation]
|
||||
|
|
|
@ -36,7 +36,7 @@ pub struct UnusedCodes {
|
|||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
/// - `external`
|
||||
/// - `lint.external`
|
||||
///
|
||||
/// ## References
|
||||
/// - [Ruff error suppression](https://docs.astral.sh/ruff/linter/#error-suppression)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue