mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-16 00:20:38 +00:00
[pylint
] Add allow-dunder-method-names
setting for bad-dunder-method-name
(PLW3201
) (#8812)
closes #8732 I noticed that the reference to the setting in the rule docs doesn't work, but there seem to be something wrong with pylint settings in general in the docs - the "For related settings, see ...." is also missing there.
This commit is contained in:
parent
f1ed0f27c2
commit
948094e691
6 changed files with 55 additions and 3 deletions
|
@ -2573,6 +2573,17 @@ pub struct PylintOptions {
|
|||
)]
|
||||
pub allow_magic_value_types: Option<Vec<ConstantType>>,
|
||||
|
||||
/// Dunder methods name to allow, in addition to the default set from the
|
||||
/// Python standard library (see: `PLW3201`).
|
||||
#[option(
|
||||
default = r#"[]"#,
|
||||
value_type = r#"list[str]"#,
|
||||
example = r#"
|
||||
allow-dunder-method-names = ["__tablename__", "__table_args__"]
|
||||
"#
|
||||
)]
|
||||
pub allow_dunder_method_names: Option<FxHashSet<String>>,
|
||||
|
||||
/// Maximum number of branches allowed for a function or method body (see:
|
||||
/// `PLR0912`).
|
||||
#[option(default = r"12", value_type = "int", example = r"max-branches = 12")]
|
||||
|
@ -2614,6 +2625,7 @@ impl PylintOptions {
|
|||
allow_magic_value_types: self
|
||||
.allow_magic_value_types
|
||||
.unwrap_or(defaults.allow_magic_value_types),
|
||||
allow_dunder_method_names: self.allow_dunder_method_names.unwrap_or_default(),
|
||||
max_args: self.max_args.unwrap_or(defaults.max_args),
|
||||
max_bool_expr: self.max_bool_expr.unwrap_or(defaults.max_bool_expr),
|
||||
max_returns: self.max_returns.unwrap_or(defaults.max_returns),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue