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
I don't believe that Style/StringHashKeys should be labeled as safe for autocorrection.
As an example, a Hash may be passed as the second argument to String#gsub. If the matched text is one of its keys, the corresponding value is the replacement string. Converting the String key to a Symbol will break the replacement.
Steps to reproduce the problem
example scenario:
"The sky is green.".gsub(/green/,"green"=>"blue")# => "The sky is blue."
after auto correct:
"The sky is green.".gsub(/green/,green: "blue")# => "The sky is ."
I don't believe that
Style/StringHashKeys
should be labeled as safe for autocorrection.As an example, a Hash may be passed as the second argument to
String#gsub
. If the matched text is one of its keys, the corresponding value is the replacement string. Converting the String key to a Symbol will break the replacement.Steps to reproduce the problem
example scenario:
after auto correct:
RuboCop version
A solution might be to ignore StringHashKeys if they occur as an argument to
#gsub
/#gsub!
The text was updated successfully, but these errors were encountered: