Skip to content

Commit

Permalink
Set default max-complexity to 10 for empty McCabe settings (#6073)
Browse files Browse the repository at this point in the history
Closes #6058.
  • Loading branch information
charliermarsh authored Jul 25, 2023
1 parent 670db1d commit c996b61
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions crates/ruff/src/rules/mccabe/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,20 @@ pub struct Settings {
pub max_complexity: usize,
}

const DEFAULT_MAX_COMPLEXITY: usize = 10;

impl Default for Settings {
fn default() -> Self {
Self { max_complexity: 10 }
Self {
max_complexity: DEFAULT_MAX_COMPLEXITY,
}
}
}

impl From<Options> for Settings {
fn from(options: Options) -> Self {
Self {
max_complexity: options.max_complexity.unwrap_or_default(),
max_complexity: options.max_complexity.unwrap_or(DEFAULT_MAX_COMPLEXITY),
}
}
}
Expand Down

0 comments on commit c996b61

Please sign in to comment.