literal-in-interpolation
What it does
Section titled “What it does”Reports a number, symbol, true, false, nil or string literal that is the whole content of a #{...}.
Why it matters
Section titled “Why it matters”A literal does not need interpolation, and in "a #{1}" the value is known to the reader. Often it is a leftover of an expression that was replaced by a constant.
To fix, write the literal in the string itself.
Example
Section titled “Example”...y = :ok..."a #{1} #{x} #{[:a]}".../(?<a>x)(?:y)/...Configuration
Section titled “Configuration”ruby: lint: rules: literal-in-interpolation: warn # off (default), warn, errorEnabled by the presets: ruby/rubocop.
Suppress one line with sudsy-disable-next-line literal-in-interpolation in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| rubocop | Lint/LiteralInInterpolation |
full |