redundant-string-coercion
What it does
Section titled “What it does”Reports to_s on the last expression of a #{...} and on an argument of puts, print or warn.
Why it matters
Section titled “Why it matters”Interpolation and these methods already convert the value with to_s, so the call adds nothing.
To fix, delete .to_s.
Example
Section titled “Example”...2.times { f }...puts "#{x.to_s} #{y}"puts x.to_s, y...a == bConfiguration
Section titled “Configuration”ruby: lint: rules: redundant-string-coercion: warn # off (default), warn, errorEnabled by the presets: ruby/rubocop.
Suppress one line with sudsy-disable-next-line redundant-string-coercion 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/RedundantStringCoercion |
full |