Promote lint. settings over top-level settings (#9476)

This commit is contained in:
Micha Reiser 2024-01-29 18:42:30 +01:00 committed by Zanie Blue
parent 6996ff7b1e
commit c3b33e9c4d
62 changed files with 389 additions and 310 deletions

View file

@ -51,7 +51,7 @@ else:
``` ```
## Options ## Options
- `pyflakes.extend-generics` - `lint.pyflakes.extend-generics`
## References ## References
- [Python documentation: `import`](https://docs.python.org/3/reference/simple_stmts.html#the-import-statement) - [Python documentation: `import`](https://docs.python.org/3/reference/simple_stmts.html#the-import-statement)

View file

@ -116,7 +116,7 @@ fn process_documentation(documentation: &str, out: &mut String, rule_name: &str)
} }
} }
let anchor = option.replace('.', "-"); let anchor = option.replace('.', "_");
out.push_str(&format!("- [`{option}`][{option}]\n")); out.push_str(&format!("- [`{option}`][{option}]\n"));
after.push_str(&format!("[{option}]: ../settings.md#{anchor}\n")); after.push_str(&format!("[{option}]: ../settings.md#{anchor}\n"));
@ -142,13 +142,13 @@ mod tests {
let mut output = String::new(); let mut output = String::new();
process_documentation( process_documentation(
" "
See also [`mccabe.max-complexity`] and [`task-tags`]. See also [`lint.mccabe.max-complexity`] and [`lint.task-tags`].
Something [`else`][other]. Something [`else`][other].
## Options ## Options
- `task-tags` - `lint.task-tags`
- `mccabe.max-complexity` - `lint.mccabe.max-complexity`
[other]: http://example.com.", [other]: http://example.com.",
&mut output, &mut output,
@ -157,18 +157,18 @@ Something [`else`][other].
assert_eq!( assert_eq!(
output, output,
" "
See also [`mccabe.max-complexity`][mccabe.max-complexity] and [`task-tags`][task-tags]. See also [`lint.mccabe.max-complexity`][lint.mccabe.max-complexity] and [`lint.task-tags`][lint.task-tags].
Something [`else`][other]. Something [`else`][other].
## Options ## Options
- [`task-tags`][task-tags] - [`lint.task-tags`][lint.task-tags]
- [`mccabe.max-complexity`][mccabe.max-complexity] - [`lint.mccabe.max-complexity`][lint.mccabe.max-complexity]
[other]: http://example.com. [other]: http://example.com.
[task-tags]: ../settings.md#task-tags [lint.task-tags]: ../settings.md#lint_task-tags
[mccabe.max-complexity]: ../settings.md#mccabe-max-complexity [lint.mccabe.max-complexity]: ../settings.md#lint_mccabe_max-complexity
" "
); );
} }

View file

@ -1,6 +1,7 @@
//! Generate a Markdown-compatible listing of configuration options for `pyproject.toml`. //! Generate a Markdown-compatible listing of configuration options for `pyproject.toml`.
//! //!
//! Used for <https://docs.astral.sh/ruff/settings/>. //! Used for <https://docs.astral.sh/ruff/settings/>.
use itertools::Itertools;
use std::fmt::Write; use std::fmt::Write;
use ruff_python_trivia::textwrap; use ruff_python_trivia::textwrap;
@ -9,16 +10,29 @@ use ruff_workspace::options_base::{OptionField, OptionSet, OptionsMetadata, Visi
pub(crate) fn generate() -> String { pub(crate) fn generate() -> String {
let mut output = String::new(); let mut output = String::new();
generate_set(&mut output, &Set::Toplevel(Options::metadata()));
generate_set(
&mut output,
Set::Toplevel(Options::metadata()),
&mut Vec::new(),
);
output output
} }
fn generate_set(output: &mut String, set: &Set) { fn generate_set(output: &mut String, set: Set, parents: &mut Vec<Set>) {
if set.level() < 2 { match &set {
writeln!(output, "### {title}\n", title = set.title()).unwrap(); Set::Toplevel(_) => {
} else { output.push_str("### Top-level\n");
writeln!(output, "#### {title}\n", title = set.title()).unwrap(); }
Set::Named { name, .. } => {
let title = parents
.iter()
.filter_map(|set| set.name())
.chain(std::iter::once(name.as_str()))
.join(".");
writeln!(output, "#### `{title}`\n",).unwrap();
}
} }
if let Some(documentation) = set.metadata().documentation() { if let Some(documentation) = set.metadata().documentation() {
@ -35,72 +49,68 @@ fn generate_set(output: &mut String, set: &Set) {
fields.sort_unstable_by(|(name, _), (name2, _)| name.cmp(name2)); fields.sort_unstable_by(|(name, _), (name2, _)| name.cmp(name2));
sets.sort_unstable_by(|(name, _), (name2, _)| name.cmp(name2)); sets.sort_unstable_by(|(name, _), (name2, _)| name.cmp(name2));
parents.push(set);
// Generate the fields. // Generate the fields.
for (name, field) in &fields { for (name, field) in &fields {
emit_field(output, name, field, set); emit_field(output, name, field, parents.as_slice());
output.push_str("---\n\n"); output.push_str("---\n\n");
} }
// Generate all the sub-sets. // Generate all the sub-sets.
for (set_name, sub_set) in &sets { for (set_name, sub_set) in &sets {
generate_set(output, &Set::Named(set_name, *sub_set, set.level() + 1)); generate_set(
output,
Set::Named {
name: set_name.to_string(),
set: *sub_set,
},
parents,
);
} }
parents.pop();
} }
enum Set<'a> { enum Set {
Toplevel(OptionSet), Toplevel(OptionSet),
Named(&'a str, OptionSet, u32), Named { name: String, set: OptionSet },
} }
impl<'a> Set<'a> { impl Set {
fn name(&self) -> Option<&'a str> { fn name(&self) -> Option<&str> {
match self { match self {
Set::Toplevel(_) => None, Set::Toplevel(_) => None,
Set::Named(name, _, _) => Some(name), Set::Named { name, .. } => Some(name),
}
}
fn title(&self) -> &'a str {
match self {
Set::Toplevel(_) => "Top-level",
Set::Named(name, _, _) => name,
} }
} }
fn metadata(&self) -> &OptionSet { fn metadata(&self) -> &OptionSet {
match self { match self {
Set::Toplevel(set) => set, Set::Toplevel(set) => set,
Set::Named(_, set, _) => set, Set::Named { set, .. } => set,
}
}
fn level(&self) -> u32 {
match self {
Set::Toplevel(_) => 0,
Set::Named(_, _, level) => *level,
} }
} }
} }
fn emit_field(output: &mut String, name: &str, field: &OptionField, parent_set: &Set) { fn emit_field(output: &mut String, name: &str, field: &OptionField, parents: &[Set]) {
let header_level = if parent_set.level() < 2 { let header_level = if parents.is_empty() { "####" } else { "#####" };
"####" let parents_anchor = parents.iter().filter_map(|parent| parent.name()).join("_");
} else {
"#####" if parents_anchor.is_empty() {
}; output.push_str(&format!(
"{header_level} [`{name}`](#{name}) {{: #{name} }}\n"
));
} else {
output.push_str(&format!(
"{header_level} [`{name}`](#{parents_anchor}_{name}) {{: #{parents_anchor}_{name} }}\n"
));
// if there's a set name, we need to add it to the anchor
if let Some(set_name) = parent_set.name() {
// the anchor used to just be the name, but now it's the group name // the anchor used to just be the name, but now it's the group name
// for backwards compatibility, we need to keep the old anchor // for backwards compatibility, we need to keep the old anchor
output.push_str(&format!("<span id=\"{name}\"></span>\n")); output.push_str(&format!("<span id=\"{name}\"></span>\n"));
output.push_str(&format!(
"{header_level} [`{name}`](#{set_name}-{name}) {{: #{set_name}-{name} }}\n"
));
} else {
output.push_str(&format!("{header_level} [`{name}`](#{name})\n"));
} }
output.push('\n'); output.push('\n');
if let Some(deprecated) = &field.deprecated { if let Some(deprecated) = &field.deprecated {
@ -129,12 +139,12 @@ fn emit_field(output: &mut String, name: &str, field: &OptionField, parent_set:
output.push_str("**Example usage**:\n\n"); output.push_str("**Example usage**:\n\n");
output.push_str(&format_tab( output.push_str(&format_tab(
"pyproject.toml", "pyproject.toml",
&format_header(field.scope, parent_set, ConfigurationFile::PyprojectToml), &format_header(field.scope, parents, ConfigurationFile::PyprojectToml),
field.example, field.example,
)); ));
output.push_str(&format_tab( output.push_str(&format_tab(
"ruff.toml", "ruff.toml",
&format_header(field.scope, parent_set, ConfigurationFile::RuffToml), &format_header(field.scope, parents, ConfigurationFile::RuffToml),
field.example, field.example,
)); ));
output.push('\n'); output.push('\n');
@ -152,52 +162,22 @@ fn format_tab(tab_name: &str, header: &str, content: &str) -> String {
/// Format the TOML header for the example usage for a given option. /// Format the TOML header for the example usage for a given option.
/// ///
/// For example: `[tool.ruff.format]` or `[tool.ruff.lint.isort]`. /// For example: `[tool.ruff.format]` or `[tool.ruff.lint.isort]`.
fn format_header( fn format_header(scope: Option<&str>, parents: &[Set], configuration: ConfigurationFile) -> String {
scope: Option<&str>, let tool_parent = match configuration {
parent_set: &Set, ConfigurationFile::PyprojectToml => Some("tool.ruff"),
configuration: ConfigurationFile, ConfigurationFile::RuffToml => None,
) -> String { };
match configuration {
ConfigurationFile::PyprojectToml => { let header = tool_parent
let mut header = if let Some(set_name) = parent_set.name() { .into_iter()
if set_name == "format" { .chain(parents.iter().filter_map(|parent| parent.name()))
String::from("tool.ruff.format") .chain(scope)
} else { .join(".");
format!("tool.ruff.lint.{set_name}")
} if header.is_empty() {
} else { String::new()
"tool.ruff".to_string() } else {
}; format!("[{header}]")
if let Some(scope) = scope {
if !header.is_empty() {
header.push('.');
}
header.push_str(scope);
}
format!("[{header}]")
}
ConfigurationFile::RuffToml => {
let mut header = if let Some(set_name) = parent_set.name() {
if set_name == "format" {
String::from("format")
} else {
format!("lint.{set_name}")
}
} else {
String::new()
};
if let Some(scope) = scope {
if !header.is_empty() {
header.push('.');
}
header.push_str(scope);
}
if header.is_empty() {
String::new()
} else {
format!("[{header}]")
}
}
} }
} }

View file

@ -24,7 +24,7 @@ use super::super::detection::comment_contains_code;
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `task-tags` /// - `lint.task-tags`
/// ///
/// [#4845]: https://github.com/astral-sh/ruff/issues/4845 /// [#4845]: https://github.com/astral-sh/ruff/issues/4845
#[violation] #[violation]

View file

@ -23,11 +23,11 @@ use crate::checkers::ast::Checker;
/// calls to the function, which can lead to unexpected behaviour. /// calls to the function, which can lead to unexpected behaviour.
/// ///
/// Calls can be marked as an exception to this rule with the /// 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. /// Arguments with immutable type annotations will be ignored by this rule.
/// Types outside of the standard library can be marked as immutable with the /// 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 /// ## Example
/// ```python /// ```python
@ -61,7 +61,7 @@ use crate::checkers::ast::Checker;
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `flake8-bugbear.extend-immutable-calls` /// - `lint.flake8-bugbear.extend-immutable-calls`
#[violation] #[violation]
pub struct FunctionCallInDefaultArgument { pub struct FunctionCallInDefaultArgument {
name: Option<String>, name: Option<String>,

View file

@ -28,7 +28,7 @@ use crate::checkers::ast::Checker;
/// ///
/// Arguments with immutable type annotations will be ignored by this rule. /// Arguments with immutable type annotations will be ignored by this rule.
/// Types outside of the standard library can be marked as immutable with the /// 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 /// ## Known problems
/// Mutable argument defaults can be used intentionally to cache computation /// Mutable argument defaults can be used intentionally to cache computation
@ -61,7 +61,7 @@ use crate::checkers::ast::Checker;
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `flake8-bugbear.extend-immutable-calls` /// - `lint.flake8-bugbear.extend-immutable-calls`
/// ///
/// ## References /// ## References
/// - [Python documentation: Default Argument Values](https://docs.python.org/3/tutorial/controlflow.html#default-argument-values) /// - [Python documentation: Default Argument Values](https://docs.python.org/3/tutorial/controlflow.html#default-argument-values)

View file

@ -19,7 +19,7 @@ use super::super::helpers::shadows_builtin;
/// builtin and vice versa. /// builtin and vice versa.
/// ///
/// Builtins can be marked as exceptions to this rule via the /// 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 /// ## Example
/// ```python /// ```python
@ -44,7 +44,7 @@ use super::super::helpers::shadows_builtin;
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `flake8-builtins.builtins-ignorelist` /// - `lint.flake8-builtins.builtins-ignorelist`
/// ///
/// ## References /// ## 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) /// - [_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)

View file

@ -37,7 +37,7 @@ use crate::rules::flake8_builtins::helpers::shadows_builtin;
/// ``` /// ```
/// ///
/// Builtins can be marked as exceptions to this rule via the /// 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 /// converted to the appropriate dunder method. Methods decorated with
/// `@typing.override` or `@typing_extensions.override` are also /// `@typing.override` or `@typing_extensions.override` are also
/// ignored. /// ignored.
@ -55,7 +55,7 @@ use crate::rules::flake8_builtins::helpers::shadows_builtin;
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `flake8-builtins.builtins-ignorelist` /// - `lint.flake8-builtins.builtins-ignorelist`
#[violation] #[violation]
pub struct BuiltinAttributeShadowing { pub struct BuiltinAttributeShadowing {
kind: Kind, kind: Kind,

View file

@ -18,7 +18,7 @@ use crate::rules::flake8_builtins::helpers::shadows_builtin;
/// builtin and vice versa. /// builtin and vice versa.
/// ///
/// Builtins can be marked as exceptions to this rule via the /// 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 /// ## Example
/// ```python /// ```python
@ -41,7 +41,7 @@ use crate::rules::flake8_builtins::helpers::shadows_builtin;
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `flake8-builtins.builtins-ignorelist` /// - `lint.flake8-builtins.builtins-ignorelist`
/// ///
/// ## References /// ## 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) /// - [_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)

View file

@ -59,7 +59,7 @@ impl Violation for SingleLineImplicitStringConcatenation {
/// ///
/// By default, this rule will only trigger if the string literal is /// By default, this rule will only trigger if the string literal is
/// concatenated via a backslash. To disallow implicit string concatenation /// 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`. /// to `false`.
/// ///
/// ## Example /// ## Example
@ -77,7 +77,7 @@ impl Violation for SingleLineImplicitStringConcatenation {
/// ``` /// ```
/// ///
/// ## Options /// ## 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 /// [PEP 8]: https://peps.python.org/pep-0008/#maximum-line-length
#[violation] #[violation]

View file

@ -29,7 +29,7 @@ use ruff_text_size::Ranged;
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `flake8-import-conventions.banned-aliases` /// - `lint.flake8-import-conventions.banned-aliases`
#[violation] #[violation]
pub struct BannedImportAlias { pub struct BannedImportAlias {
name: String, name: String,

View file

@ -30,7 +30,7 @@ use ruff_text_size::Ranged;
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `flake8-import-conventions.banned-from` /// - `lint.flake8-import-conventions.banned-from`
#[violation] #[violation]
pub struct BannedImportFrom { pub struct BannedImportFrom {
name: String, name: String,

View file

@ -32,8 +32,8 @@ use crate::renamer::Renamer;
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `flake8-import-conventions.aliases` /// - `lint.flake8-import-conventions.aliases`
/// - `flake8-import-conventions.extend-aliases` /// - `lint.flake8-import-conventions.extend-aliases`
#[violation] #[violation]
pub struct UnconventionalImportAlias { pub struct UnconventionalImportAlias {
name: String, name: String,

View file

@ -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(...)`). /// - 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`, /// - 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(...)`). /// 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(...)`, /// 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 /// ## Example
/// ```python /// ```python
@ -68,7 +68,7 @@ use ruff_macros::{derive_message_formats, violation};
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `logger-objects` /// - `lint.logger-objects`
/// ///
/// ## References /// ## References
/// - [Python documentation: `logging`](https://docs.python.org/3/library/logging.html) /// - [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(...)`). /// - 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`, /// - 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(...)`). /// 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(...)`, /// 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 /// ## Example
/// ```python /// ```python
@ -152,7 +152,7 @@ impl Violation for LoggingStringFormat {
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `logger-objects` /// - `lint.logger-objects`
/// ///
/// ## References /// ## References
/// - [Python documentation: `logging`](https://docs.python.org/3/library/logging.html) /// - [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(...)`). /// - 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`, /// - 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(...)`). /// 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(...)`, /// 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 /// ## Example
/// ```python /// ```python
@ -235,7 +235,7 @@ impl Violation for LoggingPercentFormat {
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `logger-objects` /// - `lint.logger-objects`
/// ///
/// ## References /// ## References
/// - [Python documentation: `logging`](https://docs.python.org/3/library/logging.html) /// - [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(...)`). /// - 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`, /// - 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(...)`). /// 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(...)`, /// 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 /// ## Example
/// ```python /// ```python
@ -317,7 +317,7 @@ impl Violation for LoggingStringConcat {
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `logger-objects` /// - `lint.logger-objects`
/// ///
/// ## References /// ## References
/// - [Python documentation: `logging`](https://docs.python.org/3/library/logging.html) /// - [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(...)`). /// - 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`, /// - 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(...)`). /// 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(...)`, /// 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 /// ## Example
/// ```python /// ```python
@ -368,7 +368,7 @@ impl Violation for LoggingFString {
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `logger-objects` /// - `lint.logger-objects`
/// ///
/// ## References /// ## References
/// - [Python documentation: `logging.warning`](https://docs.python.org/3/library/logging.html#logging.warning) /// - [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(...)`). /// - 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`, /// - 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(...)`). /// 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(...)`, /// 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 /// ## Example
/// ```python /// ```python
@ -436,7 +436,7 @@ impl AlwaysFixableViolation for LoggingWarn {
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `logger-objects` /// - `lint.logger-objects`
/// ///
/// ## References /// ## References
/// - [Python documentation: LogRecord attributes](https://docs.python.org/3/library/logging.html#logrecord-attributes) /// - [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(...)`). /// - 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`, /// - 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(...)`). /// 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(...)`, /// 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 /// ## Example
/// ```python /// ```python
@ -495,7 +495,7 @@ impl Violation for LoggingExtraAttrClash {
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `logger-objects` /// - `lint.logger-objects`
/// ///
/// ## References /// ## References
/// - [Python documentation: `logging.exception`](https://docs.python.org/3/library/logging.html#logging.exception) /// - [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(...)`). /// - 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`, /// - 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(...)`). /// 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(...)`, /// 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 /// ## Example
/// ```python /// ```python
@ -556,7 +556,7 @@ impl Violation for LoggingExcInfo {
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `logger-objects` /// - `lint.logger-objects`
/// ///
/// ## References /// ## References
/// - [Python documentation: `logging.exception`](https://docs.python.org/3/library/logging.html#logging.exception) /// - [Python documentation: `logging.exception`](https://docs.python.org/3/library/logging.html#logging.exception)

View file

@ -24,7 +24,7 @@ use super::helpers::{
/// ## What it does /// ## What it does
/// Checks for argument-free `@pytest.fixture()` decorators with or without /// 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. /// setting.
/// ///
/// ## Why is this bad? /// ## Why is this bad?
@ -55,7 +55,7 @@ use super::helpers::{
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `flake8-pytest-style.fixture-parentheses` /// - `lint.flake8-pytest-style.fixture-parentheses`
/// ///
/// ## References /// ## References
/// - [`pytest` documentation: API Reference: Fixtures](https://docs.pytest.org/en/latest/reference/reference.html#fixtures-api) /// - [`pytest` documentation: API Reference: Fixtures](https://docs.pytest.org/en/latest/reference/reference.html#fixtures-api)

View file

@ -11,7 +11,7 @@ use super::helpers::get_mark_decorators;
/// ## What it does /// ## What it does
/// Checks for argument-free `@pytest.mark.<marker>()` decorators with or /// 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. /// setting.
/// ///
/// ## Why is this bad? /// ## Why is this bad?
@ -42,7 +42,7 @@ use super::helpers::get_mark_decorators;
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `flake8-pytest-style.mark-parentheses` /// - `lint.flake8-pytest-style.mark-parentheses`
/// ///
/// ## References /// ## References
/// - [`pytest` documentation: Marks](https://docs.pytest.org/en/latest/reference/reference.html#marks) /// - [`pytest` documentation: Marks](https://docs.pytest.org/en/latest/reference/reference.html#marks)

View file

@ -26,7 +26,7 @@ use super::helpers::{is_pytest_parametrize, split_names};
/// The `argnames` argument of `pytest.mark.parametrize` takes a string or /// 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 /// 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 /// 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 /// ## Example
/// ```python /// ```python
@ -67,7 +67,7 @@ use super::helpers::{is_pytest_parametrize, split_names};
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `flake8-pytest-style.parametrize-names-type` /// - `lint.flake8-pytest-style.parametrize-names-type`
/// ///
/// ## References /// ## References
/// - [`pytest` documentation: How to parametrize fixtures and test functions](https://docs.pytest.org/en/latest/how-to/parametrize.html#pytest-mark-parametrize) /// - [`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. /// of values.
/// ///
/// The style for the list of values rows can be configured via the /// 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 /// 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: /// the following expectations:
/// ///
/// - `tuple`: `@pytest.mark.parametrize("value", ("a", "b", "c"))` /// - `tuple`: `@pytest.mark.parametrize("value", ("a", "b", "c"))`
/// - `list`: `@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: /// the following expectations:
/// ///
/// - `tuple`: `@pytest.mark.parametrize(("key", "value"), [("a", "b"), ("c", "d")])` /// - `tuple`: `@pytest.mark.parametrize(("key", "value"), [("a", "b"), ("c", "d")])`
@ -170,8 +170,8 @@ impl Violation for PytestParametrizeNamesWrongType {
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `flake8-pytest-style.parametrize-values-type` /// - `lint.flake8-pytest-style.parametrize-values-type`
/// - `flake8-pytest-style.parametrize-values-row-type` /// - `lint.flake8-pytest-style.parametrize-values-row-type`
/// ///
/// ## References /// ## References
/// - [`pytest` documentation: How to parametrize fixtures and test functions](https://docs.pytest.org/en/latest/how-to/parametrize.html#pytest-mark-parametrize) /// - [`pytest` documentation: How to parametrize fixtures and test functions](https://docs.pytest.org/en/latest/how-to/parametrize.html#pytest-mark-parametrize)

View file

@ -64,8 +64,8 @@ impl Violation for PytestRaisesWithMultipleStatements {
/// unrelated to the code under test. To avoid this, `pytest.raises` should be /// 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` /// called with a `match` parameter. The exception names that require a `match`
/// parameter can be configured via the /// parameter can be configured via the
/// `flake8-pytest-style.raises-require-match-for` and /// [`lint.flake8-pytest-style.raises-require-match-for`] and
/// `flake8-pytest-style.raises-extend-require-match-for` settings. /// [`lint.flake8-pytest-style.raises-extend-require-match-for`] settings.
/// ///
/// ## Example /// ## Example
/// ```python /// ```python
@ -92,8 +92,8 @@ impl Violation for PytestRaisesWithMultipleStatements {
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `flake8-pytest-style.raises-require-match-for` /// - `lint.flake8-pytest-style.raises-require-match-for`
/// - `flake8-pytest-style.raises-extend-require-match-for` /// - `lint.flake8-pytest-style.raises-extend-require-match-for`
/// ///
/// ## References /// ## References
/// - [`pytest` documentation: `pytest.raises`](https://docs.pytest.org/en/latest/reference/reference.html#pytest-raises) /// - [`pytest` documentation: `pytest.raises`](https://docs.pytest.org/en/latest/reference/reference.html#pytest-raises)

View file

@ -14,7 +14,7 @@ use super::super::settings::Quote;
/// ## What it does /// ## What it does
/// Checks for inline strings that use single quotes or double quotes, /// 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? /// ## Why is this bad?
/// Consistency is good. Use either single or double quotes for inline /// Consistency is good. Use either single or double quotes for inline
@ -31,7 +31,7 @@ use super::super::settings::Quote;
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `flake8-quotes.inline-quotes` /// - `lint.flake8-quotes.inline-quotes`
/// ///
/// ## Formatter compatibility /// ## Formatter compatibility
/// We recommend against using this rule alongside the [formatter]. The /// We recommend against using this rule alongside the [formatter]. The
@ -65,7 +65,7 @@ impl AlwaysFixableViolation for BadQuotesInlineString {
/// ## What it does /// ## What it does
/// Checks for multiline strings that use single quotes or double quotes, /// 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. /// setting.
/// ///
/// ## Why is this bad? /// ## Why is this bad?
@ -87,7 +87,7 @@ impl AlwaysFixableViolation for BadQuotesInlineString {
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `flake8-quotes.multiline-quotes` /// - `lint.flake8-quotes.multiline-quotes`
/// ///
/// ## Formatter compatibility /// ## Formatter compatibility
/// We recommend against using this rule alongside the [formatter]. The /// We recommend against using this rule alongside the [formatter]. The
@ -121,7 +121,7 @@ impl AlwaysFixableViolation for BadQuotesMultilineString {
/// ## What it does /// ## What it does
/// Checks for docstrings that use single quotes or double quotes, depending /// 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? /// ## Why is this bad?
/// Consistency is good. Use either single or double quotes for docstring /// Consistency is good. Use either single or double quotes for docstring
@ -142,7 +142,7 @@ impl AlwaysFixableViolation for BadQuotesMultilineString {
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `flake8-quotes.docstring-quotes` /// - `lint.flake8-quotes.docstring-quotes`
/// ///
/// ## Formatter compatibility /// ## Formatter compatibility
/// We recommend against using this rule alongside the [formatter]. The /// We recommend against using this rule alongside the [formatter]. The

View file

@ -43,7 +43,7 @@ use crate::checkers::ast::Checker;
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `flake8-self.ignore-names` /// - `lint.flake8-self.ignore-names`
/// ///
/// ## References /// ## 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) /// - [_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)

View file

@ -24,7 +24,7 @@ use crate::rules::flake8_tidy_imports::matchers::NameMatchPolicy;
/// automatic way. /// automatic way.
/// ///
/// ## Options /// ## Options
/// - `flake8-tidy-imports.banned-api` /// - `lint.flake8-tidy-imports.banned-api`
#[violation] #[violation]
pub struct BannedApi { pub struct BannedApi {
name: String, name: String,

View file

@ -38,7 +38,7 @@ use crate::rules::flake8_tidy_imports::matchers::NameMatchPolicy;
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `flake8-tidy-imports.banned-module-level-imports` /// - `lint.flake8-tidy-imports.banned-module-level-imports`
#[violation] #[violation]
pub struct BannedModuleLevelImports { pub struct BannedModuleLevelImports {
name: String, name: String,

View file

@ -42,7 +42,7 @@ use crate::rules::flake8_tidy_imports::settings::Strictness;
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `flake8-tidy-imports.ban-relative-imports` /// - `lint.flake8-tidy-imports.ban-relative-imports`
/// ///
/// [PEP 8]: https://peps.python.org/pep-0008/#imports /// [PEP 8]: https://peps.python.org/pep-0008/#imports
#[violation] #[violation]

View file

@ -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 /// The type-checking block is not executed at runtime, so the import will not
/// be available at runtime. /// 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 /// annotations will be wrapped in quotes if doing so would enable the
/// corresponding import to remain in the type-checking block. /// corresponding import to remain in the type-checking block.
/// ///
@ -48,7 +48,7 @@ use crate::rules::flake8_type_checking::imports::ImportBinding;
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `flake8-type-checking.quote-annotations` /// - `lint.flake8-type-checking.quote-annotations`
/// ///
/// ## References /// ## References
/// - [PEP 535](https://peps.python.org/pep-0563/#runtime-annotation-resolution-and-type-checking) /// - [PEP 535](https://peps.python.org/pep-0563/#runtime-annotation-resolution-and-type-checking)

View file

@ -28,14 +28,14 @@ use crate::rules::isort::{categorize, ImportSection, ImportType};
/// instead be imported conditionally under an `if TYPE_CHECKING:` block to /// instead be imported conditionally under an `if TYPE_CHECKING:` block to
/// minimize runtime overhead. /// 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 /// annotations will be wrapped in quotes if doing so would enable the
/// corresponding import to be moved into an `if TYPE_CHECKING:` block. /// corresponding import to be moved into an `if TYPE_CHECKING:` block.
/// ///
/// If a class _requires_ that type annotations be available at runtime (as is /// If a class _requires_ that type annotations be available at runtime (as is
/// the case for Pydantic, SQLAlchemy, and other libraries), consider using /// the case for Pydantic, SQLAlchemy, and other libraries), consider using
/// the [`flake8-type-checking.runtime-evaluated-base-classes`] and /// the [`lint.flake8-type-checking.runtime-evaluated-base-classes`] and
/// [`flake8-type-checking.runtime-evaluated-decorators`] settings to mark them /// [`lint.flake8-type-checking.runtime-evaluated-decorators`] settings to mark them
/// as such. /// as such.
/// ///
/// ## Example /// ## Example
@ -64,9 +64,9 @@ use crate::rules::isort::{categorize, ImportSection, ImportType};
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `flake8-type-checking.quote-annotations` /// - `lint.flake8-type-checking.quote-annotations`
/// - `flake8-type-checking.runtime-evaluated-base-classes` /// - `lint.flake8-type-checking.runtime-evaluated-base-classes`
/// - `flake8-type-checking.runtime-evaluated-decorators` /// - `lint.flake8-type-checking.runtime-evaluated-decorators`
/// ///
/// ## References /// ## References
/// - [PEP 536](https://peps.python.org/pep-0563/#runtime-annotation-resolution-and-type-checking) /// - [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 /// instead be imported conditionally under an `if TYPE_CHECKING:` block to
/// minimize runtime overhead. /// 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 /// annotations will be wrapped in quotes if doing so would enable the
/// corresponding import to be moved into an `if TYPE_CHECKING:` block. /// corresponding import to be moved into an `if TYPE_CHECKING:` block.
/// ///
/// If a class _requires_ that type annotations be available at runtime (as is /// If a class _requires_ that type annotations be available at runtime (as is
/// the case for Pydantic, SQLAlchemy, and other libraries), consider using /// the case for Pydantic, SQLAlchemy, and other libraries), consider using
/// the [`flake8-type-checking.runtime-evaluated-base-classes`] and /// the [`lint.flake8-type-checking.runtime-evaluated-base-classes`] and
/// [`flake8-type-checking.runtime-evaluated-decorators`] settings to mark them /// [`lint.flake8-type-checking.runtime-evaluated-decorators`] settings to mark them
/// as such. /// as such.
/// ///
/// ## Example /// ## Example
@ -137,9 +137,9 @@ impl Violation for TypingOnlyFirstPartyImport {
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `flake8-type-checking.quote-annotations` /// - `lint.flake8-type-checking.quote-annotations`
/// - `flake8-type-checking.runtime-evaluated-base-classes` /// - `lint.flake8-type-checking.runtime-evaluated-base-classes`
/// - `flake8-type-checking.runtime-evaluated-decorators` /// - `lint.flake8-type-checking.runtime-evaluated-decorators`
/// ///
/// ## References /// ## References
/// - [PEP 536](https://peps.python.org/pep-0563/#runtime-annotation-resolution-and-type-checking) /// - [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 /// instead be imported conditionally under an `if TYPE_CHECKING:` block to
/// minimize runtime overhead. /// 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 /// annotations will be wrapped in quotes if doing so would enable the
/// corresponding import to be moved into an `if TYPE_CHECKING:` block. /// corresponding import to be moved into an `if TYPE_CHECKING:` block.
/// ///
/// If a class _requires_ that type annotations be available at runtime (as is /// If a class _requires_ that type annotations be available at runtime (as is
/// the case for Pydantic, SQLAlchemy, and other libraries), consider using /// the case for Pydantic, SQLAlchemy, and other libraries), consider using
/// the [`flake8-type-checking.runtime-evaluated-base-classes`] and /// the [`lint.flake8-type-checking.runtime-evaluated-base-classes`] and
/// [`flake8-type-checking.runtime-evaluated-decorators`] settings to mark them /// [`lint.flake8-type-checking.runtime-evaluated-decorators`] settings to mark them
/// as such. /// as such.
/// ///
/// ## Example /// ## Example
@ -210,9 +210,9 @@ impl Violation for TypingOnlyThirdPartyImport {
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `flake8-type-checking.quote-annotations` /// - `lint.flake8-type-checking.quote-annotations`
/// - `flake8-type-checking.runtime-evaluated-base-classes` /// - `lint.flake8-type-checking.runtime-evaluated-base-classes`
/// - `flake8-type-checking.runtime-evaluated-decorators` /// - `lint.flake8-type-checking.runtime-evaluated-decorators`
/// ///
/// ## References /// ## References
/// - [PEP 536](https://peps.python.org/pep-0563/#runtime-annotation-resolution-and-type-checking) /// - [PEP 536](https://peps.python.org/pep-0563/#runtime-annotation-resolution-and-type-checking)

View file

@ -44,7 +44,7 @@ use ruff_python_ast::identifier::Identifier;
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `mccabe.max-complexity` /// - `lint.mccabe.max-complexity`
#[violation] #[violation]
pub struct ComplexStructure { pub struct ComplexStructure {
name: String, name: String,

View file

@ -22,10 +22,10 @@ use crate::checkers::ast::Checker;
/// > append a single trailing underscore rather than use an abbreviation or spelling corruption. /// > 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.) /// > 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`] /// Names can be excluded from this rule using the [`lint.pep8-naming.ignore-names`]
/// or [`pep8-naming.extend-ignore-names`] configuration options. For example, /// 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 /// 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 /// ## Example
/// ```python /// ```python
@ -44,10 +44,10 @@ use crate::checkers::ast::Checker;
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `pep8-naming.classmethod-decorators` /// - `lint.pep8-naming.classmethod-decorators`
/// - `pep8-naming.staticmethod-decorators` /// - `lint.pep8-naming.staticmethod-decorators`
/// - `pep8-naming.ignore-names` /// - `lint.pep8-naming.ignore-names`
/// - `pep8-naming.extend-ignore-names` /// - `lint.pep8-naming.extend-ignore-names`
/// ///
/// [PEP 8]: https://peps.python.org/pep-0008/#function-and-method-arguments /// [PEP 8]: https://peps.python.org/pep-0008/#function-and-method-arguments
#[violation] #[violation]

View file

@ -22,10 +22,10 @@ use crate::checkers::ast::Checker;
/// > append a single trailing underscore rather than use an abbreviation or spelling corruption. /// > 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.) /// > 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`] /// Names can be excluded from this rule using the [`lint.pep8-naming.ignore-names`]
/// or [`pep8-naming.extend-ignore-names`] configuration options. For example, /// 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 /// 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 /// ## Example
/// ```python /// ```python
@ -42,10 +42,10 @@ use crate::checkers::ast::Checker;
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `pep8-naming.classmethod-decorators` /// - `lint.pep8-naming.classmethod-decorators`
/// - `pep8-naming.staticmethod-decorators` /// - `lint.pep8-naming.staticmethod-decorators`
/// - `pep8-naming.ignore-names` /// - `lint.pep8-naming.ignore-names`
/// - `pep8-naming.extend-ignore-names` /// - `lint.pep8-naming.extend-ignore-names`
/// ///
/// [PEP 8]: https://peps.python.org/pep-0008/#function-and-method-arguments /// [PEP 8]: https://peps.python.org/pep-0008/#function-and-method-arguments
#[violation] #[violation]

View file

@ -20,10 +20,10 @@ use crate::settings::types::IdentifierPattern;
/// > improve readability. mixedCase is allowed only in contexts where thats already the /// > improve readability. mixedCase is allowed only in contexts where thats already the
/// > prevailing style (e.g. threading.py), to retain backwards compatibility. /// > prevailing style (e.g. threading.py), to retain backwards compatibility.
/// ///
/// Names can be excluded from this rule using the [`pep8-naming.ignore-names`] /// Names can be excluded from this rule using the [`lint.pep8-naming.ignore-names`]
/// or [`pep8-naming.extend-ignore-names`] configuration options. For example, /// or [`lint.pep8-naming.extend-ignore-names`] configuration options. For example,
/// to ignore all functions starting with `test_` from this rule, set the /// 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 /// ## Example
/// ```python /// ```python
@ -38,8 +38,8 @@ use crate::settings::types::IdentifierPattern;
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `pep8-naming.ignore-names` /// - `lint.pep8-naming.ignore-names`
/// - `pep8-naming.extend-ignore-names` /// - `lint.pep8-naming.extend-ignore-names`
/// ///
/// [PEP 8]: https://peps.python.org/pep-0008/#function-and-variable-names /// [PEP 8]: https://peps.python.org/pep-0008/#function-and-variable-names
#[violation] #[violation]

View file

@ -34,8 +34,8 @@ use crate::rules::pep8_naming::helpers;
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `pep8-naming.ignore-names` /// - `lint.pep8-naming.ignore-names`
/// - `pep8-naming.extend-ignore-names` /// - `lint.pep8-naming.extend-ignore-names`
/// ///
/// [PEP 8]: https://peps.python.org/pep-0008/#function-and-variable-names /// [PEP 8]: https://peps.python.org/pep-0008/#function-and-variable-names
#[violation] #[violation]

View file

@ -13,7 +13,7 @@ use crate::settings::LinterSettings;
/// For flowing long blocks of text (docstrings or comments), overlong lines /// For flowing long blocks of text (docstrings or comments), overlong lines
/// can hurt readability. [PEP 8], for example, recommends that such lines be /// can hurt readability. [PEP 8], for example, recommends that such lines be
/// limited to 72 characters, while this rule enforces the limit specified by /// 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.) /// 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 /// 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. /// overlong if a pragma comment _causes_ it to exceed the line length.
/// (This behavior aligns with that of the Ruff formatter.) /// (This behavior aligns with that of the Ruff formatter.)
/// ///
/// If [`pycodestyle.ignore-overlong-task-comments`] is `true`, this rule will /// If [`lint.pycodestyle.ignore-overlong-task-comments`] is `true`, this rule will
/// also ignore comments that start with any of the specified [`task-tags`] /// also ignore comments that start with any of the specified [`lint.task-tags`]
/// (e.g., `# TODO:`). /// (e.g., `# TODO:`).
/// ///
/// ## Example /// ## Example
@ -65,9 +65,9 @@ use crate::settings::LinterSettings;
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `task-tags` /// - `lint.task-tags`
/// - `pycodestyle.max-doc-length` /// - `lint.pycodestyle.max-doc-length`
/// - `pycodestyle.ignore-overlong-task-comments` /// - `lint.pycodestyle.ignore-overlong-task-comments`
/// ///
/// [PEP 8]: https://peps.python.org/pep-0008/#maximum-line-length /// [PEP 8]: https://peps.python.org/pep-0008/#maximum-line-length
#[violation] #[violation]

View file

@ -28,8 +28,8 @@ use crate::settings::LinterSettings;
/// overlong if a pragma comment _causes_ it to exceed the line length. /// overlong if a pragma comment _causes_ it to exceed the line length.
/// (This behavior aligns with that of the Ruff formatter.) /// (This behavior aligns with that of the Ruff formatter.)
/// ///
/// If [`pycodestyle.ignore-overlong-task-comments`] is `true`, this rule will /// If [`lint.pycodestyle.ignore-overlong-task-comments`] is `true`, this rule will
/// also ignore comments that start with any of the specified [`task-tags`] /// also ignore comments that start with any of the specified [`lint.task-tags`]
/// (e.g., `# TODO:`). /// (e.g., `# TODO:`).
/// ///
/// ## Example /// ## Example
@ -60,9 +60,9 @@ use crate::settings::LinterSettings;
/// ///
/// ## Options /// ## Options
/// - `line-length` /// - `line-length`
/// - `task-tags` /// - `lint.task-tags`
/// - `pycodestyle.ignore-overlong-task-comments` /// - `lint.pycodestyle.ignore-overlong-task-comments`
/// - `pycodestyle.max-line-length` /// - `lint.pycodestyle.max-line-length`
/// ///
/// [PEP 8]: https://peps.python.org/pep-0008/#maximum-line-length /// [PEP 8]: https://peps.python.org/pep-0008/#maximum-line-length
#[violation] #[violation]

View file

@ -37,7 +37,7 @@ use crate::registry::Rule;
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `pydocstyle.convention` /// - `lint.pydocstyle.convention`
/// ///
/// [D211]: https://docs.astral.sh/ruff/rules/blank-line-before-class /// [D211]: https://docs.astral.sh/ruff/rules/blank-line-before-class
#[violation] #[violation]
@ -84,7 +84,7 @@ impl AlwaysFixableViolation for OneBlankLineBeforeClass {
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `pydocstyle.convention` /// - `lint.pydocstyle.convention`
/// ///
/// ## References /// ## References
/// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/) /// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/)
@ -134,7 +134,7 @@ impl AlwaysFixableViolation for OneBlankLineAfterClass {
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `pydocstyle.convention` /// - `lint.pydocstyle.convention`
/// ///
/// [D203]: https://docs.astral.sh/ruff/rules/one-blank-line-before-class /// [D203]: https://docs.astral.sh/ruff/rules/one-blank-line-before-class
#[violation] #[violation]

View file

@ -36,7 +36,7 @@ use crate::rules::pydocstyle::helpers::logical_line;
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `pydocstyle.convention` /// - `lint.pydocstyle.convention`
/// ///
/// ## References /// ## References
/// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/) /// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/)

View file

@ -37,7 +37,7 @@ use crate::rules::pydocstyle::helpers::logical_line;
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `pydocstyle.convention` /// - `lint.pydocstyle.convention`
/// ///
/// ## References /// ## References
/// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/) /// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/)

View file

@ -32,7 +32,7 @@ use crate::docstrings::Docstring;
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `pydocstyle.convention` /// - `lint.pydocstyle.convention`
/// ///
/// ## References /// ## References
/// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/) /// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/)

View file

@ -43,7 +43,7 @@ static MOOD: Lazy<Mood> = Lazy::new(Mood::new);
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `pydocstyle.convention` /// - `lint.pydocstyle.convention`
/// ///
/// ## References /// ## References
/// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/) /// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/)

View file

@ -76,7 +76,7 @@ use crate::rules::pydocstyle::settings::Convention;
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `pydocstyle.convention` /// - `lint.pydocstyle.convention`
/// ///
/// ## References /// ## References
/// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/) /// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/)
@ -175,7 +175,7 @@ impl AlwaysFixableViolation for SectionNotOverIndented {
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `pydocstyle.convention` /// - `lint.pydocstyle.convention`
/// ///
/// ## References /// ## References
/// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/) /// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/)
@ -253,7 +253,7 @@ impl AlwaysFixableViolation for SectionUnderlineNotOverIndented {
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `pydocstyle.convention` /// - `lint.pydocstyle.convention`
/// ///
/// ## References /// ## References
/// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/) /// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/)
@ -350,7 +350,7 @@ impl AlwaysFixableViolation for CapitalizeSectionName {
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `pydocstyle.convention` /// - `lint.pydocstyle.convention`
/// ///
/// ## References /// ## References
/// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/) /// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/)
@ -446,7 +446,7 @@ impl AlwaysFixableViolation for NewLineAfterSectionName {
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `pydocstyle.convention` /// - `lint.pydocstyle.convention`
/// ///
/// ## References /// ## References
/// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/) /// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/)
@ -548,7 +548,7 @@ impl AlwaysFixableViolation for DashedUnderlineAfterSection {
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `pydocstyle.convention` /// - `lint.pydocstyle.convention`
/// ///
/// ## References /// ## References
/// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/) /// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/)
@ -647,7 +647,7 @@ impl AlwaysFixableViolation for SectionUnderlineAfterName {
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `pydocstyle.convention` /// - `lint.pydocstyle.convention`
/// ///
/// ## References /// ## References
/// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/) /// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/)
@ -741,7 +741,7 @@ impl AlwaysFixableViolation for SectionUnderlineMatchesSectionLength {
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `pydocstyle.convention` /// - `lint.pydocstyle.convention`
/// ///
/// ## References /// ## References
/// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/) /// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/)
@ -835,7 +835,7 @@ impl AlwaysFixableViolation for NoBlankLineAfterSection {
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `pydocstyle.convention` /// - `lint.pydocstyle.convention`
/// ///
/// ## References /// ## References
/// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/) /// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/)
@ -931,7 +931,7 @@ impl AlwaysFixableViolation for NoBlankLineBeforeSection {
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `pydocstyle.convention` /// - `lint.pydocstyle.convention`
/// ///
/// ## References /// ## References
/// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/) /// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/)
@ -1021,7 +1021,7 @@ impl AlwaysFixableViolation for BlankLineAfterLastSection {
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `pydocstyle.convention` /// - `lint.pydocstyle.convention`
/// ///
/// ## References /// ## References
/// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/) /// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/)
@ -1098,7 +1098,7 @@ impl Violation for EmptyDocstringSection {
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `pydocstyle.convention` /// - `lint.pydocstyle.convention`
/// ///
/// ## References /// ## References
/// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/) /// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/)
@ -1180,7 +1180,7 @@ impl AlwaysFixableViolation for SectionNameEndsInColon {
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `pydocstyle.convention` /// - `lint.pydocstyle.convention`
/// ///
/// ## References /// ## References
/// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/) /// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/)
@ -1264,7 +1264,7 @@ impl Violation for UndocumentedParam {
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `pydocstyle.convention` /// - `lint.pydocstyle.convention`
/// ///
/// ## References /// ## References
/// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/) /// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/)

View file

@ -33,7 +33,7 @@ use crate::rules::pydocstyle::helpers::normalize_word;
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `pydocstyle.convention` /// - `lint.pydocstyle.convention`
/// ///
/// ## References /// ## References
/// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/) /// - [PEP 257 Docstring Conventions](https://peps.python.org/pep-0257/)

View file

@ -54,7 +54,7 @@ enum UnusedImportContext {
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `pyflakes.extend-generics` /// - `lint.pyflakes.extend-generics`
/// ///
/// ## References /// ## References
/// - [Python documentation: `import`](https://docs.python.org/3/reference/simple_stmts.html#the-import-statement) /// - [Python documentation: `import`](https://docs.python.org/3/reference/simple_stmts.html#the-import-statement)

View file

@ -22,7 +22,7 @@ use crate::fix::edits::delete_stmt;
/// ///
/// If a variable is intentionally defined-but-not-used, it should be /// If a variable is intentionally defined-but-not-used, it should be
/// prefixed with an underscore, or some other value that adheres to the /// 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 /// Under [preview mode](https://docs.astral.sh/ruff/preview), this rule also
/// triggers on unused unpacked assignments (for example, `x, y = foo()`). /// triggers on unused unpacked assignments (for example, `x, y = foo()`).
@ -43,7 +43,7 @@ use crate::fix::edits::delete_stmt;
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `dummy-variable-rgx` /// - `lint.dummy-variable-rgx`
#[violation] #[violation]
pub struct UnusedVariable { pub struct UnusedVariable {
pub name: String, pub name: String,

View file

@ -24,7 +24,7 @@ use crate::rules::pylint::helpers::is_known_dunder_method;
/// `__init__`), as well as methods that are marked with `@override`. /// `__init__`), as well as methods that are marked with `@override`.
/// ///
/// Additional dunder methods names can be allowed via the /// Additional dunder methods names can be allowed via the
/// [`pylint.allow-dunder-method-names`] setting. /// [`lint.pylint.allow-dunder-method-names`] setting.
/// ///
/// ## Example /// ## Example
/// ```python /// ```python
@ -41,7 +41,7 @@ use crate::rules::pylint::helpers::is_known_dunder_method;
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `pylint.allow-dunder-method-names` /// - `lint.pylint.allow-dunder-method-names`
#[violation] #[violation]
pub struct BadDunderMethodName { pub struct BadDunderMethodName {
name: String, name: String,

View file

@ -10,7 +10,7 @@ use crate::checkers::ast::Checker;
/// Checks for function definitions that include too many arguments. /// Checks for function definitions that include too many arguments.
/// ///
/// By default, this rule allows up to five arguments, as configured by the /// 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? /// ## Why is this bad?
/// Functions with many arguments are harder to understand, maintain, and call. /// Functions with many arguments are harder to understand, maintain, and call.
@ -42,7 +42,7 @@ use crate::checkers::ast::Checker;
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `pylint.max-args` /// - `lint.pylint.max-args`
#[violation] #[violation]
pub struct TooManyArguments { pub struct TooManyArguments {
c_args: usize, c_args: usize,

View file

@ -10,7 +10,7 @@ use crate::checkers::ast::Checker;
/// Checks for too many Boolean expressions in an `if` statement. /// Checks for too many Boolean expressions in an `if` statement.
/// ///
/// By default, this rule allows up to 5 expressions. This can be configured /// 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? /// ## Why is this bad?
/// `if` statements with many Boolean expressions are harder to understand /// `if` statements with many Boolean expressions are harder to understand
@ -24,7 +24,7 @@ use crate::checkers::ast::Checker;
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `pylint.max-bool-expr` /// - `lint.pylint.max-bool-expr`
#[violation] #[violation]
pub struct TooManyBooleanExpressions { pub struct TooManyBooleanExpressions {
expressions: usize, expressions: usize,

View file

@ -8,7 +8,7 @@ use ruff_python_ast::identifier::Identifier;
/// Checks for functions or methods with too many branches. /// Checks for functions or methods with too many branches.
/// ///
/// By default, this rule allows up to 12 branches. This can be configured /// 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? /// ## Why is this bad?
/// Functions or methods with many branches are harder to understand /// Functions or methods with many branches are harder to understand
@ -67,7 +67,7 @@ use ruff_python_ast::identifier::Identifier;
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `pylint.max-branches` /// - `lint.pylint.max-branches`
#[violation] #[violation]
pub struct TooManyBranches { pub struct TooManyBranches {
branches: usize, branches: usize,

View file

@ -9,7 +9,7 @@ use crate::checkers::ast::Checker;
/// Checks for functions that include too many local variables. /// Checks for functions that include too many local variables.
/// ///
/// By default, this rule allows up to fifteen locals, as configured by the /// 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? /// ## Why is this bad?
/// Functions with many local variables are harder to understand and maintain. /// Functions with many local variables are harder to understand and maintain.
@ -18,7 +18,7 @@ use crate::checkers::ast::Checker;
/// functions with fewer assignments. /// functions with fewer assignments.
/// ///
/// ## Options /// ## Options
/// - `pylint.max-locals` /// - `lint.pylint.max-locals`
#[violation] #[violation]
pub struct TooManyLocals { pub struct TooManyLocals {
current_amount: usize, current_amount: usize,

View file

@ -10,14 +10,14 @@ use crate::checkers::ast::Checker;
/// Checks for functions or methods with too many nested blocks. /// Checks for functions or methods with too many nested blocks.
/// ///
/// By default, this rule allows up to five 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? /// ## Why is this bad?
/// Functions or methods with too many nested blocks are harder to understand /// Functions or methods with too many nested blocks are harder to understand
/// and maintain. /// and maintain.
/// ///
/// ## Options /// ## Options
/// - `pylint.max-nested-blocks` /// - `lint.pylint.max-nested-blocks`
#[violation] #[violation]
pub struct TooManyNestedBlocks { pub struct TooManyNestedBlocks {
nested_blocks: usize, nested_blocks: usize,

View file

@ -9,7 +9,7 @@ use crate::checkers::ast::Checker;
/// Checks for function definitions that include too many positional arguments. /// Checks for function definitions that include too many positional arguments.
/// ///
/// By default, this rule allows up to five arguments, as configured by the /// 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? /// ## Why is this bad?
/// Functions with many arguments are harder to understand, maintain, and call. /// Functions with many arguments are harder to understand, maintain, and call.
@ -40,7 +40,7 @@ use crate::checkers::ast::Checker;
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `pylint.max-positional-args` /// - `lint.pylint.max-positional-args`
#[violation] #[violation]
pub struct TooManyPositional { pub struct TooManyPositional {
c_pos: usize, c_pos: usize,

View file

@ -10,7 +10,7 @@ use crate::checkers::ast::Checker;
/// Checks for classes with too many public methods /// Checks for classes with too many public methods
/// ///
/// By default, this rule allows up to 20 public methods, as configured by /// 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? /// ## Why is this bad?
/// Classes with many public methods are harder to understand /// Classes with many public methods are harder to understand
@ -81,7 +81,7 @@ use crate::checkers::ast::Checker;
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `pylint.max-public-methods` /// - `lint.pylint.max-public-methods`
#[violation] #[violation]
pub struct TooManyPublicMethods { pub struct TooManyPublicMethods {
methods: usize, methods: usize,

View file

@ -10,7 +10,7 @@ use ruff_python_ast::visitor::Visitor;
/// Checks for functions or methods with too many return statements. /// Checks for functions or methods with too many return statements.
/// ///
/// By default, this rule allows up to six return statements, as configured by /// 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? /// ## Why is this bad?
/// Functions or methods with many return statements are harder to understand /// Functions or methods with many return statements are harder to understand
@ -50,7 +50,7 @@ use ruff_python_ast::visitor::Visitor;
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `pylint.max-returns` /// - `lint.pylint.max-returns`
#[violation] #[violation]
pub struct TooManyReturnStatements { pub struct TooManyReturnStatements {
returns: usize, returns: usize,

View file

@ -8,7 +8,7 @@ use ruff_python_ast::identifier::Identifier;
/// Checks for functions or methods with too many statements. /// Checks for functions or methods with too many statements.
/// ///
/// By default, this rule allows up to 50 statements, as configured by the /// 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? /// ## Why is this bad?
/// Functions or methods with many statements are harder to understand /// Functions or methods with many statements are harder to understand
@ -44,7 +44,7 @@ use ruff_python_ast::identifier::Identifier;
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `pylint.max-statements` /// - `lint.pylint.max-statements`
#[violation] #[violation]
pub struct TooManyStatements { pub struct TooManyStatements {
statements: usize, statements: usize,

View file

@ -30,7 +30,7 @@ use crate::settings::types::PythonVersion;
/// `__future__` annotations are not evaluated at runtime. If your code relies /// `__future__` annotations are not evaluated at runtime. If your code relies
/// on runtime type annotations (either directly or via a library like /// on runtime type annotations (either directly or via a library like
/// Pydantic), you can disable this behavior for Python versions prior to 3.9 /// 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 /// ## Example
/// ```python /// ```python
@ -51,7 +51,7 @@ use crate::settings::types::PythonVersion;
/// ///
/// ## Options /// ## Options
/// - `target-version` /// - `target-version`
/// - `pyupgrade.keep-runtime-typing` /// - `lint.pyupgrade.keep-runtime-typing`
/// ///
/// [PEP 585]: https://peps.python.org/pep-0585/ /// [PEP 585]: https://peps.python.org/pep-0585/
#[violation] #[violation]

View file

@ -23,7 +23,7 @@ use crate::settings::types::PythonVersion;
/// `__future__` annotations are not evaluated at runtime. If your code relies /// `__future__` annotations are not evaluated at runtime. If your code relies
/// on runtime type annotations (either directly or via a library like /// on runtime type annotations (either directly or via a library like
/// Pydantic), you can disable this behavior for Python versions prior to 3.10 /// 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 /// ## Example
/// ```python /// ```python
@ -46,7 +46,7 @@ use crate::settings::types::PythonVersion;
/// ///
/// ## Options /// ## Options
/// - `target-version` /// - `target-version`
/// - `pyupgrade.keep-runtime-typing` /// - `lint.pyupgrade.keep-runtime-typing`
/// ///
/// [PEP 604]: https://peps.python.org/pep-0604/ /// [PEP 604]: https://peps.python.org/pep-0604/
#[violation] #[violation]

View file

@ -28,7 +28,7 @@ use crate::settings::LinterSettings;
/// spec recommends `GREEK CAPITAL LETTER OMEGA` over `OHM SIGN`. /// spec recommends `GREEK CAPITAL LETTER OMEGA` over `OHM SIGN`.
/// ///
/// You can omit characters from being flagged as ambiguous via the /// You can omit characters from being flagged as ambiguous via the
/// [`allowed-confusables`] setting. /// [`lint.allowed-confusables`] setting.
/// ///
/// ## Example /// ## Example
/// ```python /// ```python
@ -41,7 +41,7 @@ use crate::settings::LinterSettings;
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `allowed-confusables` /// - `lint.allowed-confusables`
/// ///
/// [preview]: https://docs.astral.sh/ruff/preview/ /// [preview]: https://docs.astral.sh/ruff/preview/
#[violation] #[violation]
@ -94,7 +94,7 @@ impl Violation for AmbiguousUnicodeCharacterString {
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `allowed-confusables` /// - `lint.allowed-confusables`
/// ///
/// [preview]: https://docs.astral.sh/ruff/preview/ /// [preview]: https://docs.astral.sh/ruff/preview/
#[violation] #[violation]
@ -147,7 +147,7 @@ impl Violation for AmbiguousUnicodeCharacterDocstring {
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `allowed-confusables` /// - `lint.allowed-confusables`
/// ///
/// [preview]: https://docs.astral.sh/ruff/preview/ /// [preview]: https://docs.astral.sh/ruff/preview/
#[violation] #[violation]

View file

@ -53,7 +53,7 @@ use crate::rules::ruff::rules::helpers::{
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `flake8-bugbear.extend-immutable-calls` /// - `lint.flake8-bugbear.extend-immutable-calls`
#[violation] #[violation]
pub struct FunctionCallInDataclassDefaultArgument { pub struct FunctionCallInDataclassDefaultArgument {
name: Option<String>, name: Option<String>,

View file

@ -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.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) /// - [Python documentation: `typing.NoReturn`](https://docs.python.org/3/library/typing.html#typing.NoReturn)
#[violation] #[violation]

View file

@ -36,7 +36,7 @@ pub struct UnusedCodes {
/// ``` /// ```
/// ///
/// ## Options /// ## Options
/// - `external` /// - `lint.external`
/// ///
/// ## References /// ## References
/// - [Ruff error suppression](https://docs.astral.sh/ruff/linter/#error-suppression) /// - [Ruff error suppression](https://docs.astral.sh/ruff/linter/#error-suppression)

View file

@ -396,11 +396,11 @@ impl Configuration {
pub fn from_options(options: Options, project_root: &Path) -> Result<Self> { pub fn from_options(options: Options, project_root: &Path) -> Result<Self> {
let lint = if let Some(mut lint) = options.lint { let lint = if let Some(mut lint) = options.lint {
lint.common = lint.common.combine(options.lint_top_level); lint.common = lint.common.combine(options.lint_top_level.common);
lint lint
} else { } else {
LintOptions { LintOptions {
common: options.lint_top_level, common: options.lint_top_level.common,
..LintOptions::default() ..LintOptions::default()
} }
}; };

View file

@ -6,6 +6,7 @@ use rustc_hash::{FxHashMap, FxHashSet};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use strum::IntoEnumIterator; use strum::IntoEnumIterator;
use crate::options_base::{OptionsMetadata, Visit};
use ruff_formatter::IndentStyle; use ruff_formatter::IndentStyle;
use ruff_linter::line_width::{IndentWidth, LineLength}; use ruff_linter::line_width::{IndentWidth, LineLength};
use ruff_linter::rules::flake8_pytest_style::settings::SettingsError; use ruff_linter::rules::flake8_pytest_style::settings::SettingsError;
@ -420,21 +421,21 @@ pub struct Options {
)] )]
pub tab_size: Option<IndentWidth>, pub tab_size: Option<IndentWidth>,
#[option_group]
pub lint: Option<LintOptions>, pub lint: Option<LintOptions>,
/// The lint sections specified at the top level. /// The lint sections specified at the top level.
#[serde(flatten)] #[serde(flatten)]
pub lint_top_level: LintCommonOptions, pub lint_top_level: DeprecatedTopLevelLintOptions,
/// Options to configure code formatting. /// Options to configure code formatting.
#[option_group] #[option_group]
pub format: Option<FormatOptions>, pub format: Option<FormatOptions>,
} }
/// Experimental section to configure Ruff's linting. This new section will eventually /// Configures how ruff checks your code.
/// replace the top-level linting options.
/// ///
/// Options specified in the `lint` section take precedence over the top-level settings. /// Options specified in the `lint` section take precedence over the deprecated top-level settings.
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
#[derive(Debug, PartialEq, Eq, Default, OptionsMetadata, Serialize, Deserialize)] #[derive(Debug, PartialEq, Eq, Default, OptionsMetadata, Serialize, Deserialize)]
#[serde(deny_unknown_fields, rename_all = "kebab-case")] #[serde(deny_unknown_fields, rename_all = "kebab-case")]
@ -477,15 +478,69 @@ pub struct LintOptions {
pub preview: Option<bool>, pub preview: Option<bool>,
} }
/// Newtype wrapper for [`LintCommonOptions`] that allows customizing the JSON schema and omitting the fields from the [`OptionsMetadata`].
#[derive(Debug, PartialEq, Eq, Default, Serialize, Deserialize)]
#[serde(transparent)]
pub struct DeprecatedTopLevelLintOptions {
pub common: LintCommonOptions,
}
impl OptionsMetadata for DeprecatedTopLevelLintOptions {
fn record(_visit: &mut dyn Visit) {
// Intentionally empty. Omit all fields from the documentation and instead promote the options under the `lint.` section.
// This doesn't create an empty 'common' option because the field in the `Options` struct is marked with `#[serde(flatten)]`.
// Meaning, the code here flattens no-properties into the parent, which is what we want.
}
}
#[cfg(feature = "schemars")]
impl schemars::JsonSchema for DeprecatedTopLevelLintOptions {
fn schema_name() -> std::string::String {
"DeprecatedTopLevelLintOptions".to_owned()
}
fn schema_id() -> std::borrow::Cow<'static, str> {
std::borrow::Cow::Borrowed(std::concat!(
std::module_path!(),
"::",
"DeprecatedTopLevelLintOptions"
))
}
fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
use schemars::schema::Schema;
let common_schema = LintCommonOptions::json_schema(gen);
let mut schema_obj = common_schema.into_object();
if let Some(object) = schema_obj.object.as_mut() {
for property in object.properties.values_mut() {
if let Schema::Object(property_object) = property {
if let Some(metadata) = &mut property_object.metadata {
metadata.deprecated = true;
} else {
property_object.metadata = Some(Box::new(schemars::schema::Metadata {
deprecated: true,
..schemars::schema::Metadata::default()
}));
}
}
}
}
Schema::Object(schema_obj)
}
}
// Note: This struct should be inlined into [`LintOptions`] once support for the top-level lint settings // Note: This struct should be inlined into [`LintOptions`] once support for the top-level lint settings
// is removed. // is removed.
// Don't add any new options to this struct. Add them to [`LintOptions`] directly to avoid exposing them in the
// global settings.
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
#[derive( #[derive(
Debug, PartialEq, Eq, Default, OptionsMetadata, CombineOptions, Serialize, Deserialize, Debug, PartialEq, Eq, Default, OptionsMetadata, CombineOptions, Serialize, Deserialize,
)] )]
#[serde(deny_unknown_fields, rename_all = "kebab-case")] #[serde(deny_unknown_fields, rename_all = "kebab-case")]
pub struct LintCommonOptions { pub struct LintCommonOptions {
// WARNING: Don't add new options to this type. Add them to `LintOptions` instead.
/// A list of allowed "confusable" Unicode characters to ignore when /// A list of allowed "confusable" Unicode characters to ignore when
/// enforcing `RUF001`, `RUF002`, and `RUF003`. /// enforcing `RUF001`, `RUF002`, and `RUF003`.
#[option( #[option(
@ -734,6 +789,7 @@ pub struct LintCommonOptions {
)] )]
pub unfixable: Option<Vec<RuleSelector>>, pub unfixable: Option<Vec<RuleSelector>>,
// WARNING: Don't add new options to this type. Add them to `LintOptions` instead.
/// Options for the `flake8-annotations` plugin. /// Options for the `flake8-annotations` plugin.
#[option_group] #[option_group]
pub flake8_annotations: Option<Flake8AnnotationsOptions>, pub flake8_annotations: Option<Flake8AnnotationsOptions>,
@ -830,6 +886,8 @@ pub struct LintCommonOptions {
#[option_group] #[option_group]
pub pyupgrade: Option<PyUpgradeOptions>, pub pyupgrade: Option<PyUpgradeOptions>,
// WARNING: Don't add new options to this type. Add them to `LintOptions` instead.
// Tables are required to go last. // Tables are required to go last.
/// A list of mappings from file pattern to rule codes or prefixes to /// A list of mappings from file pattern to rule codes or prefixes to
/// exclude, when considering any matching files. /// exclude, when considering any matching files.
@ -857,6 +915,7 @@ pub struct LintCommonOptions {
"# "#
)] )]
pub extend_per_file_ignores: Option<FxHashMap<String, Vec<RuleSelector>>>, pub extend_per_file_ignores: Option<FxHashMap<String, Vec<RuleSelector>>>,
// WARNING: Don't add new options to this type. Add them to `LintOptions` instead.
} }
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
@ -2816,9 +2875,7 @@ impl PyUpgradeOptions {
} }
} }
/// Experimental: Configures how `ruff format` formats your code. /// Configures the way ruff formats your code.
///
/// Please provide feedback in [this discussion](https://github.com/astral-sh/ruff/discussions/7310).
#[derive( #[derive(
Debug, PartialEq, Eq, Default, Deserialize, Serialize, OptionsMetadata, CombineOptions, Debug, PartialEq, Eq, Default, Deserialize, Serialize, OptionsMetadata, CombineOptions,
)] )]

View file

@ -321,16 +321,16 @@ leading to [`line-too-long`](rules/line-too-long.md) (`E501`) errors.
None of the above are included in Ruff's default configuration. However, if you've enabled None of the above are included in Ruff's default configuration. However, if you've enabled
any of these rules or their parent categories (like `Q`), we recommend disabling them via the any of these rules or their parent categories (like `Q`), we recommend disabling them via the
linter's [`ignore`](settings.md#ignore) setting. linter's [`lint.ignore`](settings.md#lint_ignore) setting.
Similarly, we recommend avoiding the following isort settings, which are incompatible with the Similarly, we recommend avoiding the following isort settings, which are incompatible with the
formatter's treatment of import statements when set to non-default values: formatter's treatment of import statements when set to non-default values:
- [`force-single-line`](settings.md#isort-force-single-line) - [`force-single-line`](settings.md#lint_isort_force-single-line)
- [`force-wrap-aliases`](settings.md#isort-force-wrap-aliases) - [`force-wrap-aliases`](settings.md#lint_isort_force-wrap-aliases)
- [`lines-after-imports`](settings.md#isort-lines-after-imports) - [`lines-after-imports`](settings.md#lint_isort_lines-after-imports)
- [`lines-between-types`](settings.md#isort-lines-between-types) - [`lines-between-types`](settings.md#lint_isort_lines-between-types)
- [`split-on-trailing-comma`](settings.md#isort-split-on-trailing-comma) - [`split-on-trailing-comma`](settings.md#lint_isort_split-on-trailing-comma)
If you've configured any of these settings to take on non-default values, we recommend removing If you've configured any of these settings to take on non-default values, we recommend removing
them from your Ruff configuration. them from your Ruff configuration.

View file

@ -24,14 +24,14 @@ For the full list of supported options, run `ruff check --help`.
## Rule selection ## Rule selection
The set of enabled rules is controlled via the [`select`](settings.md#select), The set of enabled rules is controlled via the [`lint.select`](settings.md#lint_select),
[`extend-select`](settings.md#extend-select), and [`ignore`](settings.md#ignore) settings. [`lint.extend-select`](settings.md#lint_extend-select), and [`lint.ignore`](settings.md#lint_ignore) settings.
Ruff's linter mirrors Flake8's rule code system, in which each rule code consists of a one-to-three Ruff's linter mirrors Flake8's rule code system, in which each rule code consists of a one-to-three
letter prefix, followed by three digits (e.g., `F401`). The prefix indicates that "source" of the rule letter prefix, followed by three digits (e.g., `F401`). The prefix indicates that "source" of the rule
(e.g., `F` for Pyflakes, `E` for pycodestyle, `ANN` for flake8-annotations). (e.g., `F` for Pyflakes, `E` for pycodestyle, `ANN` for flake8-annotations).
Rule selectors like [`select`](settings.md#select) and [`ignore`](settings.md#ignore) accept either Rule selectors like [`lint.select`](settings.md#lint_select) and [`lint.ignore`](settings.md#lint_ignore) accept either
a full rule code (e.g., `F401`) or any valid prefix (e.g., `F`). For example, given the following a full rule code (e.g., `F401`) or any valid prefix (e.g., `F`). For example, given the following
configuration file: configuration file:
@ -60,7 +60,7 @@ formats. Ruff will automatically disable any conflicting rules when `ALL` is ena
If you're wondering how to configure Ruff, here are some **recommended guidelines**: If you're wondering how to configure Ruff, here are some **recommended guidelines**:
- Prefer [`select`](settings.md#select) over [`extend-select`](settings.md#extend-select) to make your rule set explicit. - Prefer [`lint.select`](settings.md#lint_select) over [`lint.extend-select`](settings.md#lint_extend-select) to make your rule set explicit.
- Use `ALL` with discretion. Enabling `ALL` will implicitly enable new rules whenever you upgrade. - Use `ALL` with discretion. Enabling `ALL` will implicitly enable new rules whenever you upgrade.
- Start with a small set of rules (`select = ["E", "F"]`) and add a category at-a-time. For example, - Start with a small set of rules (`select = ["E", "F"]`) and add a category at-a-time. For example,
you might consider expanding to `select = ["E", "F", "B"]` to enable the popular flake8-bugbear you might consider expanding to `select = ["E", "F", "B"]` to enable the popular flake8-bugbear
@ -109,13 +109,13 @@ pedantic) might look like the following:
] ]
``` ```
To resolve the enabled rule set, Ruff may need to reconcile [`select`](settings.md#select) and To resolve the enabled rule set, Ruff may need to reconcile [`lint.select`](settings.md#lint_select) and
[`ignore`](settings.md#ignore) from a variety of sources, including the current `pyproject.toml`, [`lint.ignore`](settings.md#lint_ignore) from a variety of sources, including the current `pyproject.toml`,
any inherited `pyproject.toml` files, and the CLI (e.g., [`--select`](settings.md#select)). any inherited `pyproject.toml` files, and the CLI (e.g., [`--select`](settings.md#lint_select)).
In those scenarios, Ruff uses the "highest-priority" [`select`](settings.md#select) as the basis for In those scenarios, Ruff uses the "highest-priority" [`select`](settings.md#lint_select) as the basis for
the rule set, and then applies [`extend-select`](settings.md#extend-select) and the rule set, and then applies [`extend-select`](settings.md#lint_extend-select) and
[`ignore`](settings.md#ignore) adjustments. CLI options are given higher priority than [`ignore`](settings.md#lint_ignore) adjustments. CLI options are given higher priority than
`pyproject.toml` options, and the current `pyproject.toml` file is given higher priority than any `pyproject.toml` options, and the current `pyproject.toml` file is given higher priority than any
inherited `pyproject.toml` files. inherited `pyproject.toml` files.
@ -233,9 +233,9 @@ You may use prefixes to select rules as well, e.g., `F` can be used to promote f
### Disabling fixes ### Disabling fixes
To limit the set of rules that Ruff should fix, use the [`fixable`](settings.md#fixable) and To limit the set of rules that Ruff should fix, use the [`lint.fixable`](settings.md#lint_fixable) and
[`unfixable`](settings.md#unfixable) settings, along with their [`extend-fixable`](settings.md#extend-fixable) [`lint.unfixable`](settings.md#lint_unfixable) settings, along with their [`lint.extend-fixable`](settings.md#lint_extend-fixable)
and [`extend-unfixable`](settings.md#extend-unfixable) variants. and [`lint.extend-unfixable`](settings.md#lint_extend-unfixable) variants.
For example, the following configuration would enable fixes for all rules except For example, the following configuration would enable fixes for all rules except
[`unused-imports`](rules/unused-import.md) (`F401`): [`unused-imports`](rules/unused-import.md) (`F401`):
@ -277,7 +277,7 @@ Conversely, the following configuration would only enable fixes for `F401`:
Ruff supports several mechanisms for suppressing lint errors, be they false positives or Ruff supports several mechanisms for suppressing lint errors, be they false positives or
permissible violations. permissible violations.
To omit a lint rule entirely, add it to the "ignore" list via the [`ignore`](settings.md#ignore) To omit a lint rule entirely, add it to the "ignore" list via the [`lint.ignore`](settings.md#lint_ignore)
setting, either on the command-line or in your `pyproject.toml` or `ruff.toml` file. setting, either on the command-line or in your `pyproject.toml` or `ruff.toml` file.
To suppress a violation inline, Ruff uses a `noqa` system similar to [Flake8](https://flake8.pycqa.org/en/3.1.1/user/ignoring-errors.html). To suppress a violation inline, Ruff uses a `noqa` system similar to [Flake8](https://flake8.pycqa.org/en/3.1.1/user/ignoring-errors.html).
@ -326,7 +326,7 @@ file, preferably towards the top, like so:
# ruff: noqa: F841 # ruff: noqa: F841
``` ```
Or see the [`per-file-ignores`](settings.md#per-file-ignores) setting, which enables the same Or see the [`lint.per-file-ignores`](settings.md#lint_per-file-ignores) setting, which enables the same
functionality from within your `pyproject.toml` or `ruff.toml` file. functionality from within your `pyproject.toml` or `ruff.toml` file.
Global `noqa` comments must be on their own line to disambiguate from comments which ignore Global `noqa` comments must be on their own line to disambiguate from comments which ignore

46
ruff.schema.json generated
View file

@ -5,6 +5,7 @@
"properties": { "properties": {
"allowed-confusables": { "allowed-confusables": {
"description": "A list of allowed \"confusable\" Unicode characters to ignore when enforcing `RUF001`, `RUF002`, and `RUF003`.", "description": "A list of allowed \"confusable\" Unicode characters to ignore when enforcing `RUF001`, `RUF002`, and `RUF003`.",
"deprecated": true,
"type": [ "type": [
"array", "array",
"null" "null"
@ -34,6 +35,7 @@
}, },
"dummy-variable-rgx": { "dummy-variable-rgx": {
"description": "A regular expression used to identify \"dummy\" variables, or those which should be ignored when enforcing (e.g.) unused-variable rules. The default expression matches `_`, `__`, and `_var`, but not `_var_`.", "description": "A regular expression used to identify \"dummy\" variables, or those which should be ignored when enforcing (e.g.) unused-variable rules. The default expression matches `_`, `__`, and `_var`, but not `_var_`.",
"deprecated": true,
"type": [ "type": [
"string", "string",
"null" "null"
@ -51,6 +53,7 @@
}, },
"explicit-preview-rules": { "explicit-preview-rules": {
"description": "Whether to require exact codes to select preview rules. When enabled, preview rules will not be selected by prefixes — the full code of each preview rule will be required to enable the rule.", "description": "Whether to require exact codes to select preview rules. When enabled, preview rules will not be selected by prefixes — the full code of each preview rule will be required to enable the rule.",
"deprecated": true,
"type": [ "type": [
"boolean", "boolean",
"null" "null"
@ -75,6 +78,7 @@
}, },
"extend-fixable": { "extend-fixable": {
"description": "A list of rule codes or prefixes to consider fixable, in addition to those specified by `fixable`.", "description": "A list of rule codes or prefixes to consider fixable, in addition to those specified by `fixable`.",
"deprecated": true,
"type": [ "type": [
"array", "array",
"null" "null"
@ -106,6 +110,7 @@
}, },
"extend-per-file-ignores": { "extend-per-file-ignores": {
"description": "A list of mappings from file pattern to rule codes or prefixes to exclude, in addition to any rules excluded by `per-file-ignores`.", "description": "A list of mappings from file pattern to rule codes or prefixes to exclude, in addition to any rules excluded by `per-file-ignores`.",
"deprecated": true,
"type": [ "type": [
"object", "object",
"null" "null"
@ -119,6 +124,7 @@
}, },
"extend-safe-fixes": { "extend-safe-fixes": {
"description": "A list of rule codes or prefixes for which unsafe fixes should be considered safe.", "description": "A list of rule codes or prefixes for which unsafe fixes should be considered safe.",
"deprecated": true,
"type": [ "type": [
"array", "array",
"null" "null"
@ -129,6 +135,7 @@
}, },
"extend-select": { "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`.",
"deprecated": true,
"type": [ "type": [
"array", "array",
"null" "null"
@ -150,6 +157,7 @@
}, },
"extend-unsafe-fixes": { "extend-unsafe-fixes": {
"description": "A list of rule codes or prefixes for which safe fixes should be considered unsafe.", "description": "A list of rule codes or prefixes for which safe fixes should be considered unsafe.",
"deprecated": true,
"type": [ "type": [
"array", "array",
"null" "null"
@ -160,6 +168,7 @@
}, },
"external": { "external": {
"description": "A list of rule codes or prefixes that are unsupported by Ruff, but should be preserved when (e.g.) validating `# noqa` directives. Useful for retaining `# noqa` directives that cover plugins not yet implemented by Ruff.", "description": "A list of rule codes or prefixes that are unsupported by Ruff, but should be preserved when (e.g.) validating `# noqa` directives. Useful for retaining `# noqa` directives that cover plugins not yet implemented by Ruff.",
"deprecated": true,
"type": [ "type": [
"array", "array",
"null" "null"
@ -184,6 +193,7 @@
}, },
"fixable": { "fixable": {
"description": "A list of rule codes or prefixes to consider fixable. By default, all rules are considered fixable.", "description": "A list of rule codes or prefixes to consider fixable. By default, all rules are considered fixable.",
"deprecated": true,
"type": [ "type": [
"array", "array",
"null" "null"
@ -194,6 +204,7 @@
}, },
"flake8-annotations": { "flake8-annotations": {
"description": "Options for the `flake8-annotations` plugin.", "description": "Options for the `flake8-annotations` plugin.",
"deprecated": true,
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/Flake8AnnotationsOptions" "$ref": "#/definitions/Flake8AnnotationsOptions"
@ -205,6 +216,7 @@
}, },
"flake8-bandit": { "flake8-bandit": {
"description": "Options for the `flake8-bandit` plugin.", "description": "Options for the `flake8-bandit` plugin.",
"deprecated": true,
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/Flake8BanditOptions" "$ref": "#/definitions/Flake8BanditOptions"
@ -216,6 +228,7 @@
}, },
"flake8-bugbear": { "flake8-bugbear": {
"description": "Options for the `flake8-bugbear` plugin.", "description": "Options for the `flake8-bugbear` plugin.",
"deprecated": true,
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/Flake8BugbearOptions" "$ref": "#/definitions/Flake8BugbearOptions"
@ -227,6 +240,7 @@
}, },
"flake8-builtins": { "flake8-builtins": {
"description": "Options for the `flake8-builtins` plugin.", "description": "Options for the `flake8-builtins` plugin.",
"deprecated": true,
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/Flake8BuiltinsOptions" "$ref": "#/definitions/Flake8BuiltinsOptions"
@ -238,6 +252,7 @@
}, },
"flake8-comprehensions": { "flake8-comprehensions": {
"description": "Options for the `flake8-comprehensions` plugin.", "description": "Options for the `flake8-comprehensions` plugin.",
"deprecated": true,
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/Flake8ComprehensionsOptions" "$ref": "#/definitions/Flake8ComprehensionsOptions"
@ -249,6 +264,7 @@
}, },
"flake8-copyright": { "flake8-copyright": {
"description": "Options for the `flake8-copyright` plugin.", "description": "Options for the `flake8-copyright` plugin.",
"deprecated": true,
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/Flake8CopyrightOptions" "$ref": "#/definitions/Flake8CopyrightOptions"
@ -260,6 +276,7 @@
}, },
"flake8-errmsg": { "flake8-errmsg": {
"description": "Options for the `flake8-errmsg` plugin.", "description": "Options for the `flake8-errmsg` plugin.",
"deprecated": true,
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/Flake8ErrMsgOptions" "$ref": "#/definitions/Flake8ErrMsgOptions"
@ -271,6 +288,7 @@
}, },
"flake8-gettext": { "flake8-gettext": {
"description": "Options for the `flake8-gettext` plugin.", "description": "Options for the `flake8-gettext` plugin.",
"deprecated": true,
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/Flake8GetTextOptions" "$ref": "#/definitions/Flake8GetTextOptions"
@ -282,6 +300,7 @@
}, },
"flake8-implicit-str-concat": { "flake8-implicit-str-concat": {
"description": "Options for the `flake8-implicit-str-concat` plugin.", "description": "Options for the `flake8-implicit-str-concat` plugin.",
"deprecated": true,
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/Flake8ImplicitStrConcatOptions" "$ref": "#/definitions/Flake8ImplicitStrConcatOptions"
@ -293,6 +312,7 @@
}, },
"flake8-import-conventions": { "flake8-import-conventions": {
"description": "Options for the `flake8-import-conventions` plugin.", "description": "Options for the `flake8-import-conventions` plugin.",
"deprecated": true,
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/Flake8ImportConventionsOptions" "$ref": "#/definitions/Flake8ImportConventionsOptions"
@ -304,6 +324,7 @@
}, },
"flake8-pytest-style": { "flake8-pytest-style": {
"description": "Options for the `flake8-pytest-style` plugin.", "description": "Options for the `flake8-pytest-style` plugin.",
"deprecated": true,
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/Flake8PytestStyleOptions" "$ref": "#/definitions/Flake8PytestStyleOptions"
@ -315,6 +336,7 @@
}, },
"flake8-quotes": { "flake8-quotes": {
"description": "Options for the `flake8-quotes` plugin.", "description": "Options for the `flake8-quotes` plugin.",
"deprecated": true,
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/Flake8QuotesOptions" "$ref": "#/definitions/Flake8QuotesOptions"
@ -326,6 +348,7 @@
}, },
"flake8-self": { "flake8-self": {
"description": "Options for the `flake8_self` plugin.", "description": "Options for the `flake8_self` plugin.",
"deprecated": true,
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/Flake8SelfOptions" "$ref": "#/definitions/Flake8SelfOptions"
@ -337,6 +360,7 @@
}, },
"flake8-tidy-imports": { "flake8-tidy-imports": {
"description": "Options for the `flake8-tidy-imports` plugin.", "description": "Options for the `flake8-tidy-imports` plugin.",
"deprecated": true,
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/Flake8TidyImportsOptions" "$ref": "#/definitions/Flake8TidyImportsOptions"
@ -348,6 +372,7 @@
}, },
"flake8-type-checking": { "flake8-type-checking": {
"description": "Options for the `flake8-type-checking` plugin.", "description": "Options for the `flake8-type-checking` plugin.",
"deprecated": true,
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/Flake8TypeCheckingOptions" "$ref": "#/definitions/Flake8TypeCheckingOptions"
@ -359,6 +384,7 @@
}, },
"flake8-unused-arguments": { "flake8-unused-arguments": {
"description": "Options for the `flake8-unused-arguments` plugin.", "description": "Options for the `flake8-unused-arguments` plugin.",
"deprecated": true,
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/Flake8UnusedArgumentsOptions" "$ref": "#/definitions/Flake8UnusedArgumentsOptions"
@ -388,6 +414,7 @@
}, },
"ignore": { "ignore": {
"description": "A list of rule codes or prefixes to ignore. Prefixes can specify exact rules (like `F841`), entire categories (like `F`), or anything in between.\n\nWhen breaking ties between enabled and disabled rules (via `select` and `ignore`, respectively), more specific prefixes override less specific prefixes.", "description": "A list of rule codes or prefixes to ignore. Prefixes can specify exact rules (like `F841`), entire categories (like `F`), or anything in between.\n\nWhen breaking ties between enabled and disabled rules (via `select` and `ignore`, respectively), more specific prefixes override less specific prefixes.",
"deprecated": true,
"type": [ "type": [
"array", "array",
"null" "null"
@ -398,6 +425,7 @@
}, },
"ignore-init-module-imports": { "ignore-init-module-imports": {
"description": "Avoid automatically removing unused imports in `__init__.py` files. Such imports will still be flagged, but with a dedicated message suggesting that the import is either added to the module's `__all__` symbol, or re-exported with a redundant alias (e.g., `import os as os`).", "description": "Avoid automatically removing unused imports in `__init__.py` files. Such imports will still be flagged, but with a dedicated message suggesting that the import is either added to the module's `__all__` symbol, or re-exported with a redundant alias (e.g., `import os as os`).",
"deprecated": true,
"type": [ "type": [
"boolean", "boolean",
"null" "null"
@ -426,6 +454,7 @@
}, },
"isort": { "isort": {
"description": "Options for the `isort` plugin.", "description": "Options for the `isort` plugin.",
"deprecated": true,
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/IsortOptions" "$ref": "#/definitions/IsortOptions"
@ -458,6 +487,7 @@
}, },
"logger-objects": { "logger-objects": {
"description": "A list of objects that should be treated equivalently to a `logging.Logger` object.\n\nThis is useful for ensuring proper diagnostics (e.g., to identify `logging` deprecations and other best-practices) for projects that re-export a `logging.Logger` object from a common module.\n\nFor example, if you have a module `logging_setup.py` with the following contents: ```python import logging\n\nlogger = logging.getLogger(__name__) ```\n\nAdding `\"logging_setup.logger\"` to `logger-objects` will ensure that `logging_setup.logger` is treated as a `logging.Logger` object when imported from other modules (e.g., `from logging_setup import logger`).", "description": "A list of objects that should be treated equivalently to a `logging.Logger` object.\n\nThis is useful for ensuring proper diagnostics (e.g., to identify `logging` deprecations and other best-practices) for projects that re-export a `logging.Logger` object from a common module.\n\nFor example, if you have a module `logging_setup.py` with the following contents: ```python import logging\n\nlogger = logging.getLogger(__name__) ```\n\nAdding `\"logging_setup.logger\"` to `logger-objects` will ensure that `logging_setup.logger` is treated as a `logging.Logger` object when imported from other modules (e.g., `from logging_setup import logger`).",
"deprecated": true,
"type": [ "type": [
"array", "array",
"null" "null"
@ -468,6 +498,7 @@
}, },
"mccabe": { "mccabe": {
"description": "Options for the `mccabe` plugin.", "description": "Options for the `mccabe` plugin.",
"deprecated": true,
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/McCabeOptions" "$ref": "#/definitions/McCabeOptions"
@ -500,6 +531,7 @@
}, },
"pep8-naming": { "pep8-naming": {
"description": "Options for the `pep8-naming` plugin.", "description": "Options for the `pep8-naming` plugin.",
"deprecated": true,
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/Pep8NamingOptions" "$ref": "#/definitions/Pep8NamingOptions"
@ -511,6 +543,7 @@
}, },
"per-file-ignores": { "per-file-ignores": {
"description": "A list of mappings from file pattern to rule codes or prefixes to exclude, when considering any matching files.", "description": "A list of mappings from file pattern to rule codes or prefixes to exclude, when considering any matching files.",
"deprecated": true,
"type": [ "type": [
"object", "object",
"null" "null"
@ -531,6 +564,7 @@
}, },
"pycodestyle": { "pycodestyle": {
"description": "Options for the `pycodestyle` plugin.", "description": "Options for the `pycodestyle` plugin.",
"deprecated": true,
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/PycodestyleOptions" "$ref": "#/definitions/PycodestyleOptions"
@ -542,6 +576,7 @@
}, },
"pydocstyle": { "pydocstyle": {
"description": "Options for the `pydocstyle` plugin.", "description": "Options for the `pydocstyle` plugin.",
"deprecated": true,
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/PydocstyleOptions" "$ref": "#/definitions/PydocstyleOptions"
@ -553,6 +588,7 @@
}, },
"pyflakes": { "pyflakes": {
"description": "Options for the `pyflakes` plugin.", "description": "Options for the `pyflakes` plugin.",
"deprecated": true,
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/PyflakesOptions" "$ref": "#/definitions/PyflakesOptions"
@ -564,6 +600,7 @@
}, },
"pylint": { "pylint": {
"description": "Options for the `pylint` plugin.", "description": "Options for the `pylint` plugin.",
"deprecated": true,
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/PylintOptions" "$ref": "#/definitions/PylintOptions"
@ -575,6 +612,7 @@
}, },
"pyupgrade": { "pyupgrade": {
"description": "Options for the `pyupgrade` plugin.", "description": "Options for the `pyupgrade` plugin.",
"deprecated": true,
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/PyUpgradeOptions" "$ref": "#/definitions/PyUpgradeOptions"
@ -604,6 +642,7 @@
}, },
"select": { "select": {
"description": "A list of rule codes or prefixes to enable. Prefixes can specify exact rules (like `F841`), entire categories (like `F`), or anything in between.\n\nWhen breaking ties between enabled and disabled rules (via `select` and `ignore`, respectively), more specific prefixes override less specific prefixes.", "description": "A list of rule codes or prefixes to enable. Prefixes can specify exact rules (like `F841`), entire categories (like `F`), or anything in between.\n\nWhen breaking ties between enabled and disabled rules (via `select` and `ignore`, respectively), more specific prefixes override less specific prefixes.",
"deprecated": true,
"type": [ "type": [
"array", "array",
"null" "null"
@ -661,6 +700,7 @@
}, },
"task-tags": { "task-tags": {
"description": "A list of task tags to recognize (e.g., \"TODO\", \"FIXME\", \"XXX\").\n\nComments starting with these tags will be ignored by commented-out code detection (`ERA`), and skipped by line-length rules (`E501`) if `ignore-overlong-task-comments` is set to `true`.", "description": "A list of task tags to recognize (e.g., \"TODO\", \"FIXME\", \"XXX\").\n\nComments starting with these tags will be ignored by commented-out code detection (`ERA`), and skipped by line-length rules (`E501`) if `ignore-overlong-task-comments` is set to `true`.",
"deprecated": true,
"type": [ "type": [
"array", "array",
"null" "null"
@ -671,6 +711,7 @@
}, },
"typing-modules": { "typing-modules": {
"description": "A list of modules whose exports should be treated equivalently to members of the `typing` module.\n\nThis is useful for ensuring proper type annotation inference for projects that re-export `typing` and `typing_extensions` members from a compatibility module. If omitted, any members imported from modules apart from `typing` and `typing_extensions` will be treated as ordinary Python objects.", "description": "A list of modules whose exports should be treated equivalently to members of the `typing` module.\n\nThis is useful for ensuring proper type annotation inference for projects that re-export `typing` and `typing_extensions` members from a compatibility module. If omitted, any members imported from modules apart from `typing` and `typing_extensions` will be treated as ordinary Python objects.",
"deprecated": true,
"type": [ "type": [
"array", "array",
"null" "null"
@ -681,6 +722,7 @@
}, },
"unfixable": { "unfixable": {
"description": "A list of rule codes or prefixes to consider non-fixable.", "description": "A list of rule codes or prefixes to consider non-fixable.",
"deprecated": true,
"type": [ "type": [
"array", "array",
"null" "null"
@ -1269,7 +1311,7 @@
"additionalProperties": false "additionalProperties": false
}, },
"FormatOptions": { "FormatOptions": {
"description": "Experimental: Configures how `ruff format` formats your code.\n\nPlease provide feedback in [this discussion](https://github.com/astral-sh/ruff/discussions/7310).", "description": "Configures the way ruff formats your code.",
"type": "object", "type": "object",
"properties": { "properties": {
"docstring-code-format": { "docstring-code-format": {
@ -1701,7 +1743,7 @@
"minimum": 1.0 "minimum": 1.0
}, },
"LintOptions": { "LintOptions": {
"description": "Experimental section to configure Ruff's linting. This new section will eventually replace the top-level linting options.\n\nOptions specified in the `lint` section take precedence over the top-level settings.", "description": "Configures how ruff checks your code.\n\nOptions specified in the `lint` section take precedence over the deprecated top-level settings.",
"type": "object", "type": "object",
"properties": { "properties": {
"allowed-confusables": { "allowed-confusables": {