Rubocop: Layout/SpaceBeforeBrackets: a space is incorrectly added to `strip_whitespace % w[name email]`

Created on 25 Dec 2020  路  2Comments  路  Source: rubocop-hq/rubocop

Expected behavior

Does noting to before_validation { to_downcase %w[email] }

Actual behavior

Layout/SpaceBeforeBrackets: a space is incorrectly added to before_validation { to_downcase %w[email] } => before_validation { to_downcase % w[email] }

Steps to reproduce the problem

Add before_validation { to_downcase %w[email] }to model file

RuboCop version

$ [bundle exec] rubocop -V
1.7.0 (using Parser 2.7.2.0, rubocop-ast 1.3.0, running on ruby 2.7.2 x86_64-linux)
  - rubocop-performance 1.9.1
  - rubocop-rails 2.9.1
  - rubocop-rspec 2.1.0
bug

Most helpful comment

Actually, this fails with any method that accepts an array as params, if not using parenthesis (which is quite common in DSLs)

All 2 comments

Another example that should not generate a warning:

link_to [@site, person] do
  content_tag(:span, person.email)
end

Actually, this fails with any method that accepts an array as params, if not using parenthesis (which is quite common in DSLs)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

NobodysNightmare picture NobodysNightmare  路  3Comments

millisami picture millisami  路  3Comments

benoittgt picture benoittgt  路  3Comments

Aqualon picture Aqualon  路  3Comments

bquorning picture bquorning  路  3Comments