[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:
Steve C 2024-01-24 14:30:01 -05:00 committed by GitHub
parent 45628a5883
commit dba2cb79cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 210 additions and 0 deletions

View file

@ -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),
}
}
}