Rubocop: Feature request: add an option to Layout/ExtraSpacing rule for table aligned arguments

Created on 9 Mar 2018  路  5Comments  路  Source: rubocop-hq/rubocop

I have this Rails migration:

class CreateUsers < ActiveRecord::Migration[5.2]
  def change
    create_table :users do |t|
      t.citext :email,           null: false, index: { unique: true }
      t.citext :username,                     index: { unique: true }
      t.string :password_digest, null: false

      t.timestamps
    end
  end
end

Layout/ExtraSpacing complains on t.citext :email, null: false, index: { unique: true } line because there's too much space; but I like how they are aligned. I'd love if Layout/ExtraSpacing rule had some kind of AllowTableStyleArgumentsAlignment option in order to allow this kind of alignment.

Expected behavior

t.citext :email, null: false, index: { unique: true } line in the example above shouldn't complain if some kind of AllowTableStyleArgumentsAlignment option is enabled

Actual behavior

t.citext :email, null: false, index: { unique: true } line raises Layout/ExtraSpacing rule violation


RuboCop version

> rubocop -V
0.53.0 (using Parser 2.5.0.3, running on ruby 2.4.2 x86_64-linux)
feature request stale

Most helpful comment

Hi, I would just like to second this. This is a major source of annoyance for me and I wish there were some way to have rubocop recognize parameters intentionally aligned this way.

All 5 comments

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding!

Hi, I would just like to second this. This is a major source of annoyance for me and I wish there were some way to have rubocop recognize parameters intentionally aligned this way.

Possibly related to #2035

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding!

This issues been automatically closed due to lack of activity. Feel free to re-open it if you ever come back to it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bquorning picture bquorning  路  3Comments

mikegee picture mikegee  路  3Comments

david942j picture david942j  路  3Comments

benoittgt picture benoittgt  路  3Comments

deivid-rodriguez picture deivid-rodriguez  路  3Comments