mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-26 11:59:10 +00:00
[pylint
] Implement too-many-nested-blocks
(PLR1702
) (#9172)
## Summary Implement [`PLR1702`/`too-many-nested-blocks`](https://pylint.readthedocs.io/en/latest/user_guide/messages/refactor/too-many-nested-blocks.html) See: #970 ## Test Plan `cargo test`
This commit is contained in:
parent
45628a5883
commit
dba2cb79cb
10 changed files with 210 additions and 0 deletions
|
@ -2728,6 +2728,11 @@ pub struct PylintOptions {
|
|||
/// (see: `PLR0916`).
|
||||
#[option(default = r"5", value_type = "int", example = r"max-bool-expr = 5")]
|
||||
pub max_bool_expr: Option<usize>,
|
||||
|
||||
/// Maximum number of nested blocks allowed within a function or method body
|
||||
/// (see: `PLR1702`).
|
||||
#[option(default = r"5", value_type = "int", example = r"max-nested-blocks = 5")]
|
||||
pub max_nested_blocks: Option<usize>,
|
||||
}
|
||||
|
||||
impl PylintOptions {
|
||||
|
@ -2751,6 +2756,7 @@ impl PylintOptions {
|
|||
.max_public_methods
|
||||
.unwrap_or(defaults.max_public_methods),
|
||||
max_locals: self.max_locals.unwrap_or(defaults.max_locals),
|
||||
max_nested_blocks: self.max_nested_blocks.unwrap_or(defaults.max_nested_blocks),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue