Skip to content

Commit

Permalink
Suppress RuboCop offenses
Browse files Browse the repository at this point in the history
Follow up rubocop/rubocop#10717 and
suppresses the following offenses:

```console
Offenses:

lib/rubocop/cop/rails/enum_hash.rb:23:80: C: [Corrected]
Layout/LineContinuationSpacing: Use one space in front of backslash.
        MSG = 'Enum defined as an array found in `%<enum>s` enum
        declaration. '\
                      ^
lib/rubocop/cop/rails/order_by_id.rb:26:58: C: [Corrected]
Layout/LineContinuationSpacing: Use one space in front of backslash.
        MSG = 'Do not use the `id` column for ordering. '\
                                                         ^
spec/rubocop/cop/rails/schema_comment_spec.rb:39:77: C: [Corrected]
Layout/LineContinuationSpacing: Use one space in front of backslash.
    it 'does not register an offense when `add_column` has `comment`
    option'\
           ^
spec/rubocop/cop/rails/schema_comment_spec.rb:108:76: C: [Corrected]
Layout/LineContinuationSpacing: Use one space in front of backslash.
    it 'does not register an offense when `t.integer` has `comment`
    option'\
           ^
```
  • Loading branch information
koic committed Jun 20, 2022
1 parent 5f38b74 commit b671caa
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
3 changes: 1 addition & 2 deletions lib/rubocop/cop/rails/enum_hash.rb
Expand Up @@ -20,8 +20,7 @@ module Rails
class EnumHash < Base
extend AutoCorrector

MSG = 'Enum defined as an array found in `%<enum>s` enum declaration. '\
'Use hash syntax instead.'
MSG = 'Enum defined as an array found in `%<enum>s` enum declaration. Use hash syntax instead.'
RESTRICT_ON_SEND = %i[enum].freeze

def_node_matcher :enum?, <<~PATTERN
Expand Down
3 changes: 1 addition & 2 deletions lib/rubocop/cop/rails/order_by_id.rb
Expand Up @@ -23,8 +23,7 @@ module Rails
class OrderById < Base
include RangeHelp

MSG = 'Do not use the `id` column for ordering. '\
'Use a timestamp column to order chronologically.'
MSG = 'Do not use the `id` column for ordering. Use a timestamp column to order chronologically.'
RESTRICT_ON_SEND = %i[order].freeze

def_node_matcher :order_by_id?, <<~PATTERN
Expand Down
9 changes: 3 additions & 6 deletions spec/rubocop/cop/rails/schema_comment_spec.rb
Expand Up @@ -36,8 +36,7 @@
RUBY
end

it 'does not register an offense when `add_column` has `comment` option'\
'among other options' do
it 'does not register an offense when `add_column` has `comment` option among other options' do
expect_no_offenses(<<~RUBY)
add_column :table, :column, :integer, null: false, comment: 'An integer field', default: 0
RUBY
Expand Down Expand Up @@ -96,17 +95,15 @@
RUBY
end

it 'does not register an offense when `t.column` has `comment` option' \
'among other options' do
it 'does not register an offense when `t.column` has `comment` option among other options' do
expect_no_offenses(<<~RUBY)
create_table :users, comment: 'Table' do |t|
t.column :column, :integer, default: nil, comment: 'I am a column', null: true
end
RUBY
end

it 'does not register an offense when `t.integer` has `comment` option'\
'among other options' do
it 'does not register an offense when `t.integer` has `comment` option among other options' do
expect_no_offenses(<<~RUBY)
create_table :users, comment: 'Table' do |t|
t.integer :column, default: nil, comment: 'I am a column', null: true
Expand Down

0 comments on commit b671caa

Please sign in to comment.