From b342f60b407dfd4255ef2d1736e1019d40a21185 Mon Sep 17 00:00:00 2001 From: Chris Bachhuber Date: Fri, 19 Dec 2025 20:08:12 +0100 Subject: [PATCH] Update T201 suggestion to not use root logger to satisfy LOG015 (#22059) ## Summary Currently, the proposed fix for https://docs.astral.sh/ruff/rules/print/ violates https://docs.astral.sh/ruff/rules/root-logger-call/. Thus, let's change the proposal to make LOG015 happy as well. ## Test Plan Test manually in a project that has both T201 and LOG015 enabled and run them over the previous and proposed code. Is there continuous testing of the code snippets from the docs? --- crates/ruff_linter/src/rules/flake8_print/rules/print_call.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/ruff_linter/src/rules/flake8_print/rules/print_call.rs b/crates/ruff_linter/src/rules/flake8_print/rules/print_call.rs index 82db18a2fc..0c6d023fa4 100644 --- a/crates/ruff_linter/src/rules/flake8_print/rules/print_call.rs +++ b/crates/ruff_linter/src/rules/flake8_print/rules/print_call.rs @@ -37,10 +37,11 @@ use crate::{Fix, FixAvailability, Violation}; /// import logging /// /// logging.basicConfig(level=logging.INFO) +/// logger = logging.getLogger(__name__) /// /// /// def sum_less_than_four(a, b): -/// logging.debug("Calling sum_less_than_four") +/// logger.debug("Calling sum_less_than_four") /// return a + b < 4 /// ``` ///