mirror of https://github.com/astral-sh/ruff
Minor formatting changes to `Checker` (#5135)
This commit is contained in:
parent
26d19655db
commit
70c01257ca
|
|
@ -364,7 +364,6 @@ where
|
||||||
|expr| self.semantic.resolve_call_path(expr),
|
|expr| self.semantic.resolve_call_path(expr),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.enabled(Rule::AmbiguousFunctionName) {
|
if self.enabled(Rule::AmbiguousFunctionName) {
|
||||||
if let Some(diagnostic) =
|
if let Some(diagnostic) =
|
||||||
pycodestyle::rules::ambiguous_function_name(name, || {
|
pycodestyle::rules::ambiguous_function_name(name, || {
|
||||||
|
|
@ -891,7 +890,6 @@ where
|
||||||
self.diagnostics.push(diagnostic);
|
self.diagnostics.push(diagnostic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.enabled(Rule::LowercaseImportedAsNonLowercase) {
|
if self.enabled(Rule::LowercaseImportedAsNonLowercase) {
|
||||||
if let Some(diagnostic) =
|
if let Some(diagnostic) =
|
||||||
pep8_naming::rules::lowercase_imported_as_non_lowercase(
|
pep8_naming::rules::lowercase_imported_as_non_lowercase(
|
||||||
|
|
@ -905,7 +903,6 @@ where
|
||||||
self.diagnostics.push(diagnostic);
|
self.diagnostics.push(diagnostic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.enabled(Rule::CamelcaseImportedAsLowercase) {
|
if self.enabled(Rule::CamelcaseImportedAsLowercase) {
|
||||||
if let Some(diagnostic) =
|
if let Some(diagnostic) =
|
||||||
pep8_naming::rules::camelcase_imported_as_lowercase(
|
pep8_naming::rules::camelcase_imported_as_lowercase(
|
||||||
|
|
@ -919,7 +916,6 @@ where
|
||||||
self.diagnostics.push(diagnostic);
|
self.diagnostics.push(diagnostic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.enabled(Rule::CamelcaseImportedAsConstant) {
|
if self.enabled(Rule::CamelcaseImportedAsConstant) {
|
||||||
if let Some(diagnostic) =
|
if let Some(diagnostic) =
|
||||||
pep8_naming::rules::camelcase_imported_as_constant(
|
pep8_naming::rules::camelcase_imported_as_constant(
|
||||||
|
|
@ -933,7 +929,6 @@ where
|
||||||
self.diagnostics.push(diagnostic);
|
self.diagnostics.push(diagnostic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.enabled(Rule::CamelcaseImportedAsAcronym) {
|
if self.enabled(Rule::CamelcaseImportedAsAcronym) {
|
||||||
if let Some(diagnostic) =
|
if let Some(diagnostic) =
|
||||||
pep8_naming::rules::camelcase_imported_as_acronym(
|
pep8_naming::rules::camelcase_imported_as_acronym(
|
||||||
|
|
@ -1076,7 +1071,6 @@ where
|
||||||
if self.enabled(Rule::FutureFeatureNotDefined) {
|
if self.enabled(Rule::FutureFeatureNotDefined) {
|
||||||
pyflakes::rules::future_feature_not_defined(self, alias);
|
pyflakes::rules::future_feature_not_defined(self, alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.enabled(Rule::LateFutureImport) {
|
if self.enabled(Rule::LateFutureImport) {
|
||||||
if self.semantic.seen_futures_boundary() {
|
if self.semantic.seen_futures_boundary() {
|
||||||
self.diagnostics.push(Diagnostic::new(
|
self.diagnostics.push(Diagnostic::new(
|
||||||
|
|
@ -1101,7 +1095,6 @@ where
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.enabled(Rule::UndefinedLocalWithImportStar) {
|
if self.enabled(Rule::UndefinedLocalWithImportStar) {
|
||||||
self.diagnostics.push(Diagnostic::new(
|
self.diagnostics.push(Diagnostic::new(
|
||||||
pyflakes::rules::UndefinedLocalWithImportStar {
|
pyflakes::rules::UndefinedLocalWithImportStar {
|
||||||
|
|
@ -1206,7 +1199,6 @@ where
|
||||||
self.diagnostics.push(diagnostic);
|
self.diagnostics.push(diagnostic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.enabled(Rule::LowercaseImportedAsNonLowercase) {
|
if self.enabled(Rule::LowercaseImportedAsNonLowercase) {
|
||||||
if let Some(diagnostic) =
|
if let Some(diagnostic) =
|
||||||
pep8_naming::rules::lowercase_imported_as_non_lowercase(
|
pep8_naming::rules::lowercase_imported_as_non_lowercase(
|
||||||
|
|
@ -1220,7 +1212,6 @@ where
|
||||||
self.diagnostics.push(diagnostic);
|
self.diagnostics.push(diagnostic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.enabled(Rule::CamelcaseImportedAsLowercase) {
|
if self.enabled(Rule::CamelcaseImportedAsLowercase) {
|
||||||
if let Some(diagnostic) =
|
if let Some(diagnostic) =
|
||||||
pep8_naming::rules::camelcase_imported_as_lowercase(
|
pep8_naming::rules::camelcase_imported_as_lowercase(
|
||||||
|
|
@ -1234,7 +1225,6 @@ where
|
||||||
self.diagnostics.push(diagnostic);
|
self.diagnostics.push(diagnostic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.enabled(Rule::CamelcaseImportedAsConstant) {
|
if self.enabled(Rule::CamelcaseImportedAsConstant) {
|
||||||
if let Some(diagnostic) =
|
if let Some(diagnostic) =
|
||||||
pep8_naming::rules::camelcase_imported_as_constant(
|
pep8_naming::rules::camelcase_imported_as_constant(
|
||||||
|
|
@ -1248,7 +1238,6 @@ where
|
||||||
self.diagnostics.push(diagnostic);
|
self.diagnostics.push(diagnostic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.enabled(Rule::CamelcaseImportedAsAcronym) {
|
if self.enabled(Rule::CamelcaseImportedAsAcronym) {
|
||||||
if let Some(diagnostic) =
|
if let Some(diagnostic) =
|
||||||
pep8_naming::rules::camelcase_imported_as_acronym(
|
pep8_naming::rules::camelcase_imported_as_acronym(
|
||||||
|
|
@ -2475,7 +2464,6 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.enabled(Rule::TypeOfPrimitive) {
|
if self.enabled(Rule::TypeOfPrimitive) {
|
||||||
pyupgrade::rules::type_of_primitive(self, expr, func, args);
|
pyupgrade::rules::type_of_primitive(self, expr, func, args);
|
||||||
}
|
}
|
||||||
|
|
@ -3895,7 +3883,6 @@ where
|
||||||
self.diagnostics.push(diagnostic);
|
self.diagnostics.push(diagnostic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.enabled(Rule::BuiltinVariableShadowing) {
|
if self.enabled(Rule::BuiltinVariableShadowing) {
|
||||||
flake8_builtins::rules::builtin_variable_shadowing(
|
flake8_builtins::rules::builtin_variable_shadowing(
|
||||||
self,
|
self,
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,7 @@ impl Violation for LoadBeforeGlobalDeclaration {
|
||||||
format!("Name `{name}` is used prior to global declaration on line {line}")
|
format!("Name `{name}` is used prior to global declaration on line {line}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// PLE0118
|
/// PLE0118
|
||||||
pub(crate) fn load_before_global_declaration(checker: &mut Checker, name: &str, expr: &Expr) {
|
pub(crate) fn load_before_global_declaration(checker: &mut Checker, name: &str, expr: &Expr) {
|
||||||
if let Some(stmt) = checker.semantic().global(name) {
|
if let Some(stmt) = checker.semantic().global(name) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue