rubocop gemを改造して、slimファイルを直接動作させる実験に成功した。
$ ./exe/rubocop dummy.slim
Inspecting 1 file
W
Offenses:
dummy.slim:1:3: C: [Correctable] Style/FrozenStringLiteralComment: Missing frozen string literal comment.
- "a"
^
dummy.slim:1:3: C: [Correctable] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
- "a"
^^^
dummy.slim:1:6: C: [Correctable] Layout/TrailingEmptyLines: Final newline missing.
- "a"
dummy.slim:2:3: C: [Correctable] Style/FrozenStringLiteralComment: Missing frozen string literal comment.
= b
^
dummy.slim:2:4: C: [Correctable] Layout/TrailingEmptyLines: Final newline missing.
= b
dummy.slim:3:5: C: [Correctable] Style/FrozenStringLiteralComment: Missing frozen string literal comment.
| #{"c"}
^
dummy.slim:3:5: C: [Correctable] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
| #{"c"}
^^^
dummy.slim:3:8: C: [Correctable] Layout/TrailingEmptyLines: Final newline missing.
| #{"c"}
dummy.slim:4:3: W: Lint/UselessAssignment: Useless assignment to variable - a.
- a = 1
^
dummy.slim:4:3: C: [Correctable] Style/FrozenStringLiteralComment: Missing frozen string literal comment.
- a = 1
^
dummy.slim:4:8: C: [Correctable] Layout/TrailingEmptyLines: Final newline missing.
- a = 1
dummy.slim:5:3: C: [Correctable] Style/FrozenStringLiteralComment: Missing frozen string literal comment.
- a if array.size > 0
^
dummy.slim:5:8: C: [Correctable] Style/NumericPredicate: Use array.size.positive? instead of array.size > 0.
- a if array.size > 0
^^^^^^^^^^^^^^
dummy.slim:5:8: C: [Correctable] Style/ZeroLengthPredicate: Use !empty? instead of size > 0.
- a if array.size > 0
^^^^^^^^^^^^^^
dummy.slim:5:22: C: [Correctable] Layout/TrailingEmptyLines: Final newline missing.
- a if array.size > 0
dummy.slim:6:3: C: [Correctable] Style/FrozenStringLiteralComment: Missing frozen string literal comment.
- a if !b
^
dummy.slim:6:3: C: [Correctable] Style/NegatedIf: Favor unless over if for negative conditions.
- a if !b
^^^^^^^
dummy.slim:6:10: C: [Correctable] Layout/TrailingEmptyLines: Final newline missing.
- a if !b
dummy.slim:7:3: C: [Correctable] Style/FrozenStringLiteralComment: Missing frozen string literal comment.
- a if !b # rubocop:disable Style/NegatedIf
^
dummy.slim:7:44: C: [Correctable] Layout/TrailingEmptyLines: Final newline missing.
- a if !b # rubocop:disable Style/NegatedIf
dummy.slim:8:6: C: [Correctable] Style/FrozenStringLiteralComment: Missing frozen string literal comment.
- if "a"
^
dummy.slim:8:6: C: [Correctable] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
- if "a"
^^^
dummy.slim:8:9: C: [Correctable] Layout/TrailingEmptyLines: Final newline missing.
- if "a"
1 file inspected, 23 offenses detected, 22 offenses autocorrectable
rubocopの改造とrubocop-slimでの実験が上手くいったので、rubocopにpull requestをdraftで出した。