Consider logger candidate from logging module only (#3878)
This commit is contained in:
@@ -18,9 +18,15 @@ use crate::context::Context;
|
||||
/// ```
|
||||
pub fn is_logger_candidate(context: &Context, func: &Expr) -> bool {
|
||||
if let ExprKind::Attribute { value, .. } = &func.node {
|
||||
let Some(call_path) = context
|
||||
.resolve_call_path(value)
|
||||
.or_else(|| collect_call_path(value)) else {
|
||||
let Some(call_path) = (if let Some(call_path) = context.resolve_call_path(value) {
|
||||
if call_path.first().map_or(false, |module| *module == "logging") {
|
||||
Some(call_path)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
} else {
|
||||
collect_call_path(value)
|
||||
}) else {
|
||||
return false;
|
||||
};
|
||||
if let Some(tail) = call_path.last() {
|
||||
|
||||
Reference in New Issue
Block a user