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
link_to '#foo' is not detected as violating Style/StringLiterals set to double_quotes.
Sample code with comments:
link_to'#foo'# should raise a Rubocop error but doesn't :(link_to'jim',key: 'value'# correctly detected ^_^link_to"bob",key: "other value"# passes, move along :)
Expected behavior
link_to '#foo' should be detected as not using double quotes
Actual behavior
it is not detected although it uses single quotes. When chaning the string to 'foo' it does get detected.
Output from sample repository:
rubocop
Inspecting 2 files
.C
Offenses:
test.rb:2:9: C: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
link_to 'jim', key: 'value'# correctly detected ^_^
^^^^^
test.rb:2:21: C: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
link_to 'jim', key: 'value'# correctly detected ^_^
^^^^^^^
2 files inspected, 2 offenses detected
paulkoegel
changed the title
link_to '#foo' is not detected as violating Style/StringLiterals set to double_quotes.
Style/StringLiterals: link_to '#foo' not detected as violating double_quotesApr 12, 2016
Not exactly. We'll keep both issues open, because # is a 7-bit ASCII character, so it's a different bug than the failure to report strings with, for example, ñ in them.
link_to '#foo'
is not detected as violatingStyle/StringLiterals
set todouble_quotes
.Sample code with comments:
Expected behavior
link_to '#foo'
should be detected as not using double quotesActual behavior
it is not detected although it uses single quotes. When chaning the string to
'foo'
it does get detected.Output from sample repository:
Steps to reproduce the problem
Please see sample repository: https://github.com/paulkogel/rubocop-bug
bundle install
and runrubocop
RuboCop version
0.39.0
The text was updated successfully, but these errors were encountered: