Style/RedundantPercentQ
autocorrects Ruby hash output unsafely
#12786
Labels
Style/RedundantPercentQ
autocorrects Ruby hash output unsafely
#12786
Style/RedundantPercentQ
will autocorrect given the following, albeit unsafely:It will replace the surrounding
%Q
with double quotes and will not escape the contents, resulting in syntactically invalid code.Issue demonstrated in this PR.
Expected behavior
Stylistically I think I would prefer
%Q
was kept for this multiline output, but I appreciate that that's subjective.Actual behavior
The code was autocorrected to:
As GitHub's syntax highlighting...well, highlights, this doesn't resolve to a string.
Steps to reproduce the problem
rubocop --only Style/RedundantPercentQ -a <some_file_containing_this_input.rb>
RuboCop version
The text was updated successfully, but these errors were encountered: