Consider Flask app logger as logger candidate (#4253)

This commit is contained in:
Dhruv Manilawala 2023-05-06 21:01:10 +05:30 committed by GitHub
parent 11e1380df4
commit 2c91412321
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 1 deletions

View file

@ -19,7 +19,7 @@ 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) = (if let Some(call_path) = context.resolve_call_path(value) {
if call_path.first().map_or(false, |module| *module == "logging") {
if call_path.first().map_or(false, |module| *module == "logging") || call_path.as_slice() == ["flask", "current_app", "logger"] {
Some(call_path)
} else {
None