astral-sh/ruff

Make logger object name patterns configurable

Open

#12,613 建立於 2024年8月1日

在 GitHub 查看
 (6 留言) (3 反應) (0 負責人)Rust (2,088 fork)batch import
help wantedtype-inference

倉庫指標

Star
 (47,527 star)
PR 合併指標
 (平均合併 5天 4小時) (30 天內合併 463 個 PR)

描述

Currently, Ruff uses some hard-coded name "patterns" to determine whether a module-local object might be a logger (for the purposes of e.g. flake8-logging-format G rules).

https://github.com/astral-sh/ruff/blob/fc16d8d04d86aa94a8aac14bbb87089b64d443a1/crates/ruff_python_semantic/src/analyze/logging.rs#L60-L74

We've found that we have some loggers called _LOG which aren't matched, and I was disappointed to find that these aren't configurable. Maybe this should be a setting list of regular expressions or globs or something like that?

貢獻者指南