[pylint] Implement PLR0916 (too-many-boolean-expressions) (#7975)

## Summary

Add
[R0916](https://pylint.readthedocs.io/en/latest/user_guide/messages/refactor/too-many-boolean-expressions.html),
no autofix available.

See: #970 

## Test Plan

`cargo test` and manually.
This commit is contained in:
Steve C 2023-10-17 00:44:25 -04:00 committed by GitHub
parent 5da0f9111e
commit 21ea290d6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 398 additions and 0 deletions

View file

@ -2379,6 +2379,11 @@ pub struct PylintOptions {
example = r"max-public-methods = 20"
)]
pub max_public_methods: Option<usize>,
/// Maximum number of Boolean expressions allowed within a single `if` statement
/// (see: `PLR0916`).
#[option(default = r"5", value_type = "int", example = r"max-bool-expr = 5")]
pub max_bool_expr: Option<usize>,
}
impl PylintOptions {
@ -2389,6 +2394,7 @@ impl PylintOptions {
.allow_magic_value_types
.unwrap_or(defaults.allow_magic_value_types),
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),
max_branches: self.max_branches.unwrap_or(defaults.max_branches),
max_statements: self.max_statements.unwrap_or(defaults.max_statements),