Rubocop doesn't appear to be correcting spaces within braces denoting variables within strings.
Attempting an automatic correction does not fix this.
Running the auto-gen-correct command does not suggest any configurations to correct this.
Rubocop doesn't appear to be correcting spaces within braces denoting variables within strings.
Attempting an automatic correction does not fix this.
Running the auto-gen-correct command does not suggest any configurations to correct this.
variable = "hi" | |
string = "#{ variable} #{variable} #{variable }" | |
puts string | |
# line 1: should be single spaces | |
# line 2: should consolidate to one form | |
# line 3: no problems |
$ rubocop -a | |
Inspecting 1 file | |
C | |
Offenses: | |
testing_rubocop.rb:1:12: C: [Corrected] Prefer single-quoted strings when you don't need string interpolation or special symbols. | |
variable = "hi" | |
^^^^ | |
1 file inspected, 1 offense detected, 1 offense corrected |
variable = 'hi' | |
string = "#{ variable} #{variable} #{variable }" | |
puts string | |
# line 1: auto corrected | |
# line 2: not altered. | |
# line 3: no change. |
$ rubocop --auto-gen-config | |
Inspecting 1 file | |
C | |
Offenses: | |
testing_rubocop.rb:1:12: C: Prefer single-quoted strings when you don't need string interpolation or special symbols. | |
variable = "hi" | |
^^^^ | |
1 file inspected, 1 offense detected | |
Created .rubocop_todo.yml. | |
Run `rubocop --config .rubocop_todo.yml`, or | |
add inherit_from: .rubocop_todo.yml in a .rubocop.yml file. |
This is totally a thing.
rubocop/rubocop#1836
The Bible now says "#{v}" is good, "#{ v }" is bad. I'm making a PR to create a cop to fix this now.