mirror of https://github.com/astral-sh/ruff
Remove --max-complexity from the CLI (#1877)
This commit is contained in:
parent
a81ac6705d
commit
a01edad1c4
|
|
@ -385,8 +385,6 @@ Options:
|
||||||
The minimum Python version that should be supported
|
The minimum Python version that should be supported
|
||||||
--line-length <LINE_LENGTH>
|
--line-length <LINE_LENGTH>
|
||||||
Set the line-length for length-associated rules and automatic formatting
|
Set the line-length for length-associated rules and automatic formatting
|
||||||
--max-complexity <MAX_COMPLEXITY>
|
|
||||||
Maximum McCabe complexity allowed for a given function
|
|
||||||
--add-noqa
|
--add-noqa
|
||||||
Enable automatic additions of `noqa` directives to failing lines
|
Enable automatic additions of `noqa` directives to failing lines
|
||||||
--clean
|
--clean
|
||||||
|
|
|
||||||
|
|
@ -137,9 +137,6 @@ pub struct Cli {
|
||||||
/// formatting.
|
/// formatting.
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
pub line_length: Option<usize>,
|
pub line_length: Option<usize>,
|
||||||
/// Maximum McCabe complexity allowed for a given function.
|
|
||||||
#[arg(long)]
|
|
||||||
pub max_complexity: Option<usize>,
|
|
||||||
/// Enable automatic additions of `noqa` directives to failing lines.
|
/// Enable automatic additions of `noqa` directives to failing lines.
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
|
|
@ -266,7 +263,6 @@ impl Cli {
|
||||||
fixable: self.fixable,
|
fixable: self.fixable,
|
||||||
ignore: self.ignore,
|
ignore: self.ignore,
|
||||||
line_length: self.line_length,
|
line_length: self.line_length,
|
||||||
max_complexity: self.max_complexity,
|
|
||||||
per_file_ignores: self.per_file_ignores,
|
per_file_ignores: self.per_file_ignores,
|
||||||
respect_gitignore: resolve_bool_arg(
|
respect_gitignore: resolve_bool_arg(
|
||||||
self.respect_gitignore,
|
self.respect_gitignore,
|
||||||
|
|
@ -332,7 +328,6 @@ pub struct Overrides {
|
||||||
pub fixable: Option<Vec<RuleCodePrefix>>,
|
pub fixable: Option<Vec<RuleCodePrefix>>,
|
||||||
pub ignore: Option<Vec<RuleCodePrefix>>,
|
pub ignore: Option<Vec<RuleCodePrefix>>,
|
||||||
pub line_length: Option<usize>,
|
pub line_length: Option<usize>,
|
||||||
pub max_complexity: Option<usize>,
|
|
||||||
pub per_file_ignores: Option<Vec<PatternPrefixPair>>,
|
pub per_file_ignores: Option<Vec<PatternPrefixPair>>,
|
||||||
pub respect_gitignore: Option<bool>,
|
pub respect_gitignore: Option<bool>,
|
||||||
pub select: Option<Vec<RuleCodePrefix>>,
|
pub select: Option<Vec<RuleCodePrefix>>,
|
||||||
|
|
@ -383,9 +378,6 @@ impl ConfigProcessor for &Overrides {
|
||||||
if let Some(line_length) = &self.line_length {
|
if let Some(line_length) = &self.line_length {
|
||||||
config.line_length = Some(*line_length);
|
config.line_length = Some(*line_length);
|
||||||
}
|
}
|
||||||
if let Some(max_complexity) = &self.max_complexity {
|
|
||||||
config.set_max_complexity(Some(*max_complexity));
|
|
||||||
}
|
|
||||||
if let Some(per_file_ignores) = &self.per_file_ignores {
|
if let Some(per_file_ignores) = &self.per_file_ignores {
|
||||||
config.per_file_ignores = Some(collect_per_file_ignores(per_file_ignores.clone()));
|
config.per_file_ignores = Some(collect_per_file_ignores(per_file_ignores.clone()));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -251,12 +251,6 @@ impl Configuration {
|
||||||
pyupgrade: self.pyupgrade.or(config.pyupgrade),
|
pyupgrade: self.pyupgrade.or(config.pyupgrade),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_max_complexity(&mut self, max_complexity: Option<usize>) {
|
|
||||||
let mut mccabe = self.mccabe.take().unwrap_or_default();
|
|
||||||
mccabe.max_complexity = max_complexity;
|
|
||||||
self.mccabe = Some(mccabe);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Given a list of source paths, which could include glob patterns, resolve the
|
/// Given a list of source paths, which could include glob patterns, resolve the
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue