-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Labels
bugSomething isn't workingSomething isn't workingformatterRelated to the formatterRelated to the formatter
Description
Summary
Taking this over from #8415:
I have a little snippet that inserts ipdb
into code, and I want to keep it on a single line, so that I can easily remove it again with Vim dd
, here is the test-case:
def main() -> None:
import ipdb; ipdb.set_trace() # noqa: E402,E702,I001 fmt: skip
This passes ruff's check alright:
% ruff --isolated check test.py --fix
All checks passed!
But when I run the formatter on it, it seems that fmt: skip
is being ignored:
% ruff --isolated format test.py --diff
--- test.py
+++ test.py
@@ -1,2 +1,4 @@
def main() -> None:
- import ipdb; ipdb.set_trace() # noqa: E402 E702 I001 # fmt: skip
+ import ipdb
+
+ ipdb.set_trace() # noqa: E402 E702 I001 # fmt: skip
1 file would be reformatted
I have tried # fmt: skip
before and after the noqa
filter, I have tried two spaces before the #
, and I have tried without noqa
, i.e. just # fmt: skip
, with and without a space after the colon — the same result for each of these permutations.
If I enclose the line in fmt:off
and fmt:on
statements, then the formatter finds nothing to do, but that defies the purpose of the single-line import, and the per-line fmt:skip
instruction.
Version
0.11.4
mxmlnkn, vsydorov, mrmachine and Mase3206sizhky and Jackevansevo
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingformatterRelated to the formatterRelated to the formatter