Document the way extend-ignore/select are applied (#1839)

Closes: https://github.com/charliermarsh/ruff/issues/1838
This commit is contained in:
Jan Katins 2023-01-13 01:44:03 +01:00 committed by GitHub
parent 9aeb5df5fe
commit ef17c82998
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 2 deletions

View File

@ -1908,6 +1908,12 @@ extend-exclude = ["tests", "src/bad.py"]
A list of rule codes or prefixes to ignore, in addition to those
specified by `ignore`.
Note that `extend-ignore` is applied after resolving rules from
`ignore`/`select` and a less specific rule in `extend-ignore`
would overwrite a more specific rule in `select`. It is
recommended to only use `extend-ignore` when extending a
`pyproject.toml` file via `extend`.
**Default value**: `[]`
**Type**: `Vec<RuleCodePrefix>`
@ -1927,6 +1933,12 @@ extend-ignore = ["F841"]
A list of rule codes or prefixes to enable, in addition to those
specified by `select`.
Note that `extend-select` is applied after resolving rules from
`ignore`/`select` and a less specific rule in `extend-select`
would overwrite a more specific rule in `ignore`. It is
recommended to only use `extend-select` when extending a
`pyproject.toml` file via `extend`.
**Default value**: `[]`
**Type**: `Vec<RuleCodePrefix>`

View File

@ -67,7 +67,7 @@
}
},
"extend-ignore": {
"description": "A list of rule codes or prefixes to ignore, in addition to those specified by `ignore`.",
"description": "A list of rule codes or prefixes to ignore, in addition to those specified by `ignore`.\n\nNote that `extend-ignore` is applied after resolving rules from `ignore`/`select` and a less specific rule in `extend-ignore` would overwrite a more specific rule in `select`. It is recommended to only use `extend-ignore` when extending a `pyproject.toml` file via `extend`.",
"type": [
"array",
"null"
@ -77,7 +77,7 @@
}
},
"extend-select": {
"description": "A list of rule codes or prefixes to enable, in addition to those specified by `select`.",
"description": "A list of rule codes or prefixes to enable, in addition to those specified by `select`.\n\nNote that `extend-select` is applied after resolving rules from `ignore`/`select` and a less specific rule in `extend-select` would overwrite a more specific rule in `ignore`. It is recommended to only use `extend-select` when extending a `pyproject.toml` file via `extend`.",
"type": [
"array",
"null"

View File

@ -143,6 +143,12 @@ pub struct Options {
)]
/// A list of rule codes or prefixes to ignore, in addition to those
/// specified by `ignore`.
///
/// Note that `extend-ignore` is applied after resolving rules from
/// `ignore`/`select` and a less specific rule in `extend-ignore`
/// would overwrite a more specific rule in `select`. It is
/// recommended to only use `extend-ignore` when extending a
/// `pyproject.toml` file via `extend`.
pub extend_ignore: Option<Vec<RuleCodePrefix>>,
#[option(
default = "[]",
@ -154,6 +160,12 @@ pub struct Options {
)]
/// A list of rule codes or prefixes to enable, in addition to those
/// specified by `select`.
///
/// Note that `extend-select` is applied after resolving rules from
/// `ignore`/`select` and a less specific rule in `extend-select`
/// would overwrite a more specific rule in `ignore`. It is
/// recommended to only use `extend-select` when extending a
/// `pyproject.toml` file via `extend`.
pub extend_select: Option<Vec<RuleCodePrefix>>,
#[option(
default = "[]",