Ruby logoRuby/
RB-ST1008

Improper use of `%q()` or `%()`RB-ST1008

Minor severityMinor
Anti-pattern categoryAnti-pattern

%() (it’s a shorthand for %Q) should be used for single-line strings which require both interpolation and embedded double-quotes. For multi-line strings, heredocs should be preferred.

Avoid %() or the equivalent %q() unless you have a string with both ' and " in it. Regular string literals are more readable and should be preferred unless a lot of characters would have to be escaped in them.

Bad practice

%Q(He said: "#{greeting}")
%q{She said: 'Hi'}
%(He said: "#{greeting}")
%{She said: 'Hi'}