From b671caa38c2afc035adc65db254ec9339cce7039 Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Mon, 20 Jun 2022 12:05:40 +0900 Subject: [PATCH] Suppress RuboCop offenses Follow up https://github.com/rubocop/rubocop/pull/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 `%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'\ ^ ``` --- lib/rubocop/cop/rails/enum_hash.rb | 3 +-- lib/rubocop/cop/rails/order_by_id.rb | 3 +-- spec/rubocop/cop/rails/schema_comment_spec.rb | 9 +++------ 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/lib/rubocop/cop/rails/enum_hash.rb b/lib/rubocop/cop/rails/enum_hash.rb index b99b8edecd..04d4a86d4e 100644 --- a/lib/rubocop/cop/rails/enum_hash.rb +++ b/lib/rubocop/cop/rails/enum_hash.rb @@ -20,8 +20,7 @@ module Rails class EnumHash < Base extend AutoCorrector - MSG = 'Enum defined as an array found in `%s` enum declaration. '\ - 'Use hash syntax instead.' + MSG = 'Enum defined as an array found in `%s` enum declaration. Use hash syntax instead.' RESTRICT_ON_SEND = %i[enum].freeze def_node_matcher :enum?, <<~PATTERN diff --git a/lib/rubocop/cop/rails/order_by_id.rb b/lib/rubocop/cop/rails/order_by_id.rb index a4090b8d3d..f592582152 100644 --- a/lib/rubocop/cop/rails/order_by_id.rb +++ b/lib/rubocop/cop/rails/order_by_id.rb @@ -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 diff --git a/spec/rubocop/cop/rails/schema_comment_spec.rb b/spec/rubocop/cop/rails/schema_comment_spec.rb index 3be3909974..8a9565cdfe 100644 --- a/spec/rubocop/cop/rails/schema_comment_spec.rb +++ b/spec/rubocop/cop/rails/schema_comment_spec.rb @@ -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 @@ -96,8 +95,7 @@ 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 @@ -105,8 +103,7 @@ 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