astral-sh/ruff

Make logger object name patterns configurable

开放

#12,613 创建于 2024年8月1日

 (6 条评论) (3 个反应) (0 位负责人)Rust (2,088 个派生)batch import
help wantedtype-inference

仓库指标

星标
 (47,527 个星标)
PR 合并指标
 (平均合并 3天 8小时) (30 天内合并 573 个 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?

贡献者指南