# ruff G010: fix changes program behavior

Internal evidence sheet generated by fixhunt. Not an issue text. A human re-verifies, checks the duplicates
below, and writes the upstream report in their own words following the project's AI policy.

- Tool: ruff ruff 0.17.1
- Rule: G010 (tool labels the fix: unknown, this fix reported as safe)
- Oracle: fix-changes-behavior
- Judge (Nemotron 3 Ultra, advisory): intended-change, severity low. The rule intentionally rewrites the deprecated `logger.warn` method to `logger.warning` to eliminate the DeprecationWarning, which is the documented purpose of the rule. The stderr output changes from showing a deprecation warning to showing only the logged message 'pre-fix', demonstrating the fix works as intended.
- Program: minimized from 8 to 4 lines

## Reproducer

```python
import logging
logger = logging.getLogger('test')
warning_prefix = 'pre-'  # Variable containing substring 'warn'
logger.warn(warning_prefix + 'fix')  # Correctly becomes .warning
```

## Commands

```sh
python3 prog.py
ruff check --preview --isolated --select G010 --fix prog.py
python3 prog.py
```

## Observed

```
stderr before: /w/prog.py:4: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
stderr after: pre-fix
```

## Diff applied by the fix

```diff
--- orig.py	2026-10-22 13:28:42.425243520 -0400
+++ fixed.py	2026-10-22 13:28:44.467277582 -0400
@@ -1,4 +1,4 @@
 import logging
 logger = logging.getLogger('test')
 warning_prefix = 'pre-'  # Variable containing substring 'warn'
-logger.warn(warning_prefix + 'fix')  # Correctly becomes .warning
+logger.warning(warning_prefix + 'fix')  # Correctly becomes .warning
```

## Why the rewrite is not equivalent (model draft, verify before use)

The original call to `logger.warn` produced a deprecation warning on stderr due to the outdated method name; replacing it with `logger.warning` eliminates that warning while preserving the same log output, so the program’s observable behavior changes by suppressing the deprecation message, even though the intended logging action remains identical. This alteration of side effects means the fix is not strictly semantics‑preserving.

## Upstream search

Queries: "G010 fix", "ruff G010 warn method call", "logging.warn deprecation replacement", "method name change to warning"

- no duplicate or related report found among 31 hits

<details><summary>All hits</summary>

- [github, open] No error on `logging.Logger.warn` access [G010] — https://github.com/astral-sh/ruff/issues/12295
- [github, open] Implement `flake8-logging` — https://github.com/astral-sh/ruff/issues/7248
- [github, open] Add support for rule aliasing — https://github.com/astral-sh/ruff/issues/2186
- [github, closed] unused-function-argument not silenced by prefixed underscore if variable name is "次" — https://github.com/astral-sh/ruff/issues/28721
- [github, closed] G rules seems not working with loguru. — https://github.com/astral-sh/ruff/issues/13673
- [github, closed] Ord violation panic when fixing file with nightly compiler — https://github.com/astral-sh/ruff/issues/12469
- [github, closed] Pack of fuzzer Autofix/Infinite loop errors [2] — https://github.com/astral-sh/ruff/issues/8402
- [github, closed] Rule RUF027 cause panic — https://github.com/astral-sh/ruff/issues/9895
- [github, closed] Fixed code unformatted — https://github.com/astral-sh/ruff/issues/8619
- [github, closed] Add option to disable preview warnings — https://github.com/astral-sh/ruff/issues/8620
- [tavily] Importing a logger circumvents "logging-f-string (G004)" · Issue #17219 · astral-sh/ruff · GitHub — https://github.com/astral-sh/ruff/issues/17219
- [tavily] Dependency Dashboard · Issue #10578 · astral-sh/ruff · GitHub — https://github.com/astral-sh/ruff/issues/10578
- [tavily] Allow to declare modules/calls as deprecated · Issue #10131 · astral-sh/ruff · GitHub — https://github.com/astral-sh/ruff/issues/10131
- [tavily] Ruff server not closing with neovim instances - vol 2 · Issue #11545 · astral-sh/ruff · GitHub — https://github.com/astral-sh/ruff/issues/11545
- [github, open] Reconsider recommendation to use `defusedxml` — https://github.com/astral-sh/ruff/issues/23999
- [github, open] Feature request: Support a "warning" level for linting — https://github.com/astral-sh/ruff/issues/1256
- [github, open] DJ012 is not raised when a parent class, that inherits from django.Model, is in a different file. — https://github.com/astral-sh/ruff/issues/12865
- [github, open] [analyze] proposal for extending include-dependencies — https://github.com/astral-sh/ruff/issues/24216
- [github, open] Preview rules — https://github.com/astral-sh/ruff/issues/27051
- [github, open] [syntax-errors] Remaining syntax errors raised by the compiler — https://github.com/astral-sh/ruff/issues/17412
- [github, open] D417 Argument descriptions only required if there is an "Args" section — https://github.com/astral-sh/ruff/issues/2310
- [github, open] Server doesn't detect ruff config for files not under working directory of server — https://github.com/astral-sh/ruff/issues/17944
- [github, open] Implement Pylint — https://github.com/astral-sh/ruff/issues/970
- [github, open] Handle "untitled" files in Neovim — https://github.com/astral-sh/ruff/issues/15392
- [tavily] [`pylint`] Add `allow-dunder-method-names` setting for `bad-dunder-method-name` (`PLW3201`) by ThiefMaster · Pull Request #8812 · astral-sh/ruff · GitHub — https://github.com/astral-sh/ruff/issues/8812
- [tavily] BLE001 (blind-except): false positive when logging via `warning` · Issue #21889 · astral-sh/ruff · GitHub — https://github.com/astral-sh/ruff/issues/21889
- [tavily] Consider `__new__` methods as special function type for enforcing class method or static method rules by cake-monotone · Pull Request #13305 · astral-sh/ruff · GitHub — https://redirect.github.com/astral-sh/ruff/pull/13305
- [tavily] Emit a warning instead of an error for unknown rule selectors by ntBre · Pull Request #26113 · astral-sh/ruff · GitHub — https://redirect.github.com/astral-sh/ruff/pull/26113
- [tavily] Ban urllib.parse.urljoin (security issue and confusing name) · Issue #14773 · astral-sh/ruff · GitHub — https://github.com/astral-sh/ruff/issues/14773
- [tavily] providing settings for rules which are not generated should produce a warning · Issue #4266 · astral-sh/ruff · GitHub — https://github.com/astral-sh/ruff/issues/4266
- [tavily] Invalid noqa warning should give the file name · Issue #5855 · astral-sh/ruff · GitHub — https://github.com/astral-sh/ruff/issues/5855

</details>
