You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're using %Q() to wrap a piece of text with double quotes like so %Q("#{text}"), but Style/UnneededPercentQ is telling me this is not acceptable.
The cop states "Use %Q only for strings that ... or for dynamic strings that contain double quotes." so, if I've understood correctly, shouldn't this usage - a dynamic string including double quotes - be acceptable?
Example file:
text = 'something'
result = %Q("#{text}")
Result:
$ rubocop example.rb --only Style/UnneededPercentQ
C
Offenses:
example.rb:2:6: C: Style/UnneededPercentQ: Use %Q only for strings that contain both single quotes and double quotes, or for dynamic strings that contain double quotes.
result = %Q("#{text}")
^^^^^^^^^^^^^
1 file inspected, 1 offense detected
The text was updated successfully, but these errors were encountered:
We're using
%Q()
to wrap a piece of text with double quotes like so%Q("#{text}")
, butStyle/UnneededPercentQ
is telling me this is not acceptable.The cop states "Use %Q only for strings that ... or for dynamic strings that contain double quotes." so, if I've understood correctly, shouldn't this usage - a dynamic string including double quotes - be acceptable?
Example file:
Result:
The text was updated successfully, but these errors were encountered: