---
source: crates/ruff_linter/src/rules/ruff/mod.rs
---
RUF028 [*] This suppression comment is invalid because it cannot be in an expression, pattern, argument list, or other non-statement
 --> RUF028.py:3:9
  |
1 | def fmt_off_between_lists():
2 |     test_list = [
3 |         # fmt: off
  |         ^^^^^^^^^^
4 |         1,
5 |         2,
  |
help: Remove this comment
  |
2 |     test_list = [
  -         # fmt: off
3 |         1,
  |
note: This is an unsafe fix and may change runtime behavior

RUF028 [*] This suppression comment is invalid because it cannot be on its own line
  --> RUF028.py:12:5
   |
10 | # note: the second `fmt: skip`` should be OK
11 | def fmt_skip_on_own_line():
12 |     # fmt: skip
   |     ^^^^^^^^^^^
13 |     pass  # fmt: skip
   |
help: Remove this comment
   |
11 | def fmt_skip_on_own_line():
   -     # fmt: skip
12 |     pass  # fmt: skip
   |
note: This is an unsafe fix and may change runtime behavior

RUF028 [*] This suppression comment is invalid because it cannot be after a decorator
  --> RUF028.py:17:1
   |
16 | @fmt_skip_on_own_line
17 | # fmt: off
   | ^^^^^^^^^^
18 | @fmt_off_between_lists
19 | def fmt_off_between_decorators():
   |
help: Remove this comment
   |
16 | @fmt_skip_on_own_line
   - # fmt: off
17 | @fmt_off_between_lists
   |
note: This is an unsafe fix and may change runtime behavior

RUF028 [*] This suppression comment is invalid because it cannot be after a decorator
  --> RUF028.py:24:1
   |
23 | @fmt_off_between_decorators
24 | # fmt: off
   | ^^^^^^^^^^
25 | class FmtOffBetweenClassDecorators:
26 |     ...
   |
help: Remove this comment
   |
23 | @fmt_off_between_decorators
   - # fmt: off
24 | class FmtOffBetweenClassDecorators:
   |
note: This is an unsafe fix and may change runtime behavior

RUF028 [*] This suppression comment is invalid because it cannot be directly above an alternate body
  --> RUF028.py:33:5
   |
31 |     for val in x:
32 |         print(x)
33 |     # fmt: off
   |     ^^^^^^^^^^
34 |     else:
35 |         print("done")
   |
help: Remove this comment
   |
32 |         print(x)
   -     # fmt: off
33 |     else:
   |
note: This is an unsafe fix and may change runtime behavior

RUF028 [*] This suppression comment is invalid because it cannot be directly above an alternate body
  --> RUF028.py:39:5
   |
37 |         print("while")
38 |         # fmt: off
39 |     # fmt: off
   |     ^^^^^^^^^^
40 |     else:
41 |         print("done")
   |
help: Remove this comment
   |
38 |         # fmt: off
   -     # fmt: off
39 |     else:
   |
note: This is an unsafe fix and may change runtime behavior

RUF028 [*] This suppression comment is invalid because it cannot be directly above an alternate body
  --> RUF028.py:45:5
   |
43 |         print("huh?")
44 |     # fmt: on
45 |     # fmt: off
   |     ^^^^^^^^^^
46 |     else:
47 |         print("expected")
   |
help: Remove this comment
   |
44 |     # fmt: on
   -     # fmt: off
45 |     else:
   |
note: This is an unsafe fix and may change runtime behavior

RUF028 [*] This suppression comment is invalid because it cannot be after a decorator
  --> RUF028.py:52:5
   |
50 | class Test:
51 |     @classmethod
52 |     # fmt: off
   |     ^^^^^^^^^^
53 |     def cls_method_a(
54 |         # fmt: off
   |
help: Remove this comment
   |
51 |     @classmethod
   -     # fmt: off
52 |     def cls_method_a(
   |
note: This is an unsafe fix and may change runtime behavior

RUF028 [*] This suppression comment is invalid because it cannot be in an expression, pattern, argument list, or other non-statement
  --> RUF028.py:54:9
   |
52 |     # fmt: off
53 |     def cls_method_a(
54 |         # fmt: off
   |         ^^^^^^^^^^
55 |         cls,
56 |     ) -> None: # noqa: test # fmt: skip
   |
help: Remove this comment
   |
53 |     def cls_method_a(
   -         # fmt: off
54 |         cls,
   |
note: This is an unsafe fix and may change runtime behavior

RUF028 [*] This suppression comment is invalid because it cannot be at the end of a line
  --> RUF028.py:62:13
   |
60 | def fmt_on_trailing():
61 |     # fmt: off
62 |     val = 5 # fmt: on
   |             ^^^^^^^^^
63 |     pass # fmt: on
   |
help: Remove this comment
   |
61 |     # fmt: off
   -     val = 5 # fmt: on
62 +     val = 5
63 |     pass # fmt: on
   |
note: This is an unsafe fix and may change runtime behavior

RUF028 [*] This suppression comment is invalid because it cannot be at the end of a line
  --> RUF028.py:63:10
   |
61 |     # fmt: off
62 |     val = 5 # fmt: on
63 |     pass # fmt: on
   |          ^^^^^^^^^
   |
help: Remove this comment
   |
62 |     val = 5 # fmt: on
   -     pass # fmt: on
63 +     pass
64 |
   |
note: This is an unsafe fix and may change runtime behavior
