Default `max-positional-args` to `max-args` (#8998)

This commit is contained in:
Charlie Marsh 2023-12-04 14:02:10 -05:00 committed by GitHub
parent b90027d037
commit 93258e8d5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -2637,6 +2637,8 @@ pub struct PylintOptions {
/// Maximum number of positional arguments allowed for a function or method definition
/// (see: `PLR0917`).
///
/// If not specified, defaults to the value of `max-args`.
#[option(default = r"3", value_type = "int", example = r"max-pos-args = 3")]
pub max_positional_args: Option<usize>,
@ -2670,6 +2672,7 @@ impl PylintOptions {
max_args: self.max_args.unwrap_or(defaults.max_args),
max_positional_args: self
.max_positional_args
.or(self.max_args)
.unwrap_or(defaults.max_positional_args),
max_bool_expr: self.max_bool_expr.unwrap_or(defaults.max_bool_expr),
max_returns: self.max_returns.unwrap_or(defaults.max_returns),

2
ruff.schema.json generated
View File

@ -2370,7 +2370,7 @@
"minimum": 0.0
},
"max-positional-args": {
"description": "Maximum number of positional arguments allowed for a function or method definition (see: `PLR0917`).",
"description": "Maximum number of positional arguments allowed for a function or method definition (see: `PLR0917`).\n\nIf not specified, defaults to the value of `max-args`.",
"type": [
"integer",
"null"