Open mikeweltevrede opened 5 days ago
It makes sense to me that Ruff shouldn't provide an autofix in this case because it breaks user code. Doing this would require that Ruff understands doctests and takes them into account when running the analysis. How this would work is an interesting question.
Hi all, curious to hear your opinion on this :) Please let me know if this needs to be filed on flake8-type-checking instead!
Ruleset
flake8-type-checking (TCH) with unsafe fixes on.
Ruff call and settings
Ruff version
0.4.8
Command invoked
pre-commit hooks:
Relevant settings in
pyproject.toml
:Explanation and Example
When allowing TCH to auto-fix, it will transform this...
into ...
While this seems correct at first glance (no SyntaxError), notice that
datetime
is used in the doctest. It would be great if the ruff fixer can scan doctests as well for usage.