mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-27 04:19:18 +00:00
Make collect_call_path
return an Option
(#3849)
This commit is contained in:
parent
d822e08111
commit
08e5b3fa61
21 changed files with 158 additions and 138 deletions
|
@ -43,9 +43,11 @@ impl LoggingLevel {
|
|||
/// ```
|
||||
pub fn is_logger_candidate(context: &Context, func: &Expr) -> bool {
|
||||
if let ExprKind::Attribute { value, .. } = &func.node {
|
||||
let call_path = context
|
||||
let Some(call_path) = context
|
||||
.resolve_call_path(value)
|
||||
.unwrap_or_else(|| collect_call_path(value));
|
||||
.or_else(|| collect_call_path(value)) else {
|
||||
return false;
|
||||
};
|
||||
if let Some(tail) = call_path.last() {
|
||||
if tail.starts_with("log") || tail.ends_with("logger") || tail.ends_with("logging") {
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue