diff options
author | Rémy Coutable <remy@rymai.me> | 2017-09-19 17:25:42 +0200 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2017-12-22 08:34:44 -0600 |
commit | a2d39b80109f006ff63752cfaed5e458f9443d1d (patch) | |
tree | cc5a0f06ba04448dbf025dd95a6e39686343d256 /rubocop/cop/migration | |
parent | 299e04e318728d4ee5857379f8fb350c944a0b4e (diff) | |
download | gitlab-ce-a2d39b80109f006ff63752cfaed5e458f9443d1d.tar.gz |
Use gitlab-styles
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'rubocop/cop/migration')
-rw-r--r-- | rubocop/cop/migration/add_column.rb | 2 | ||||
-rw-r--r-- | rubocop/cop/migration/add_concurrent_foreign_key.rb | 2 | ||||
-rw-r--r-- | rubocop/cop/migration/add_concurrent_index.rb | 2 | ||||
-rw-r--r-- | rubocop/cop/migration/add_index.rb | 2 | ||||
-rw-r--r-- | rubocop/cop/migration/add_timestamps.rb | 2 | ||||
-rw-r--r-- | rubocop/cop/migration/datetime.rb | 4 | ||||
-rw-r--r-- | rubocop/cop/migration/hash_index.rb | 2 | ||||
-rw-r--r-- | rubocop/cop/migration/remove_column.rb | 2 | ||||
-rw-r--r-- | rubocop/cop/migration/remove_concurrent_index.rb | 2 | ||||
-rw-r--r-- | rubocop/cop/migration/remove_index.rb | 2 | ||||
-rw-r--r-- | rubocop/cop/migration/reversible_add_column_with_default.rb | 4 | ||||
-rw-r--r-- | rubocop/cop/migration/safer_boolean_column.rb | 4 | ||||
-rw-r--r-- | rubocop/cop/migration/timestamps.rb | 2 | ||||
-rw-r--r-- | rubocop/cop/migration/update_column_in_batches.rb | 2 | ||||
-rw-r--r-- | rubocop/cop/migration/update_large_table.rb | 4 |
15 files changed, 19 insertions, 19 deletions
diff --git a/rubocop/cop/migration/add_column.rb b/rubocop/cop/migration/add_column.rb index d2cf36c454a..2530d6477e8 100644 --- a/rubocop/cop/migration/add_column.rb +++ b/rubocop/cop/migration/add_column.rb @@ -29,7 +29,7 @@ module RuboCop opts.each_node(:pair) do |pair| if hash_key_type(pair) == :sym && hash_key_name(pair) == :default - add_offense(node, :selector) + add_offense(node, location: :selector) end end end diff --git a/rubocop/cop/migration/add_concurrent_foreign_key.rb b/rubocop/cop/migration/add_concurrent_foreign_key.rb index d1fc94d55be..d78c7b9b043 100644 --- a/rubocop/cop/migration/add_concurrent_foreign_key.rb +++ b/rubocop/cop/migration/add_concurrent_foreign_key.rb @@ -15,7 +15,7 @@ module RuboCop name = node.children[1] - add_offense(node, :selector) if name == :add_foreign_key + add_offense(node, location: :selector) if name == :add_foreign_key end def method_name(node) diff --git a/rubocop/cop/migration/add_concurrent_index.rb b/rubocop/cop/migration/add_concurrent_index.rb index 69852f4d580..a2e4ac72565 100644 --- a/rubocop/cop/migration/add_concurrent_index.rb +++ b/rubocop/cop/migration/add_concurrent_index.rb @@ -21,7 +21,7 @@ module RuboCop node.each_ancestor(:def) do |def_node| next unless method_name(def_node) == :change - add_offense(def_node, :name) + add_offense(def_node, location: :name) end end diff --git a/rubocop/cop/migration/add_index.rb b/rubocop/cop/migration/add_index.rb index fa21a0d6555..4aea3c0cce3 100644 --- a/rubocop/cop/migration/add_index.rb +++ b/rubocop/cop/migration/add_index.rb @@ -27,7 +27,7 @@ module RuboCop # data in these tables yet. next if new_tables.include?(first_arg) - add_offense(send_node, :selector) + add_offense(send_node, location: :selector) end end diff --git a/rubocop/cop/migration/add_timestamps.rb b/rubocop/cop/migration/add_timestamps.rb index 08ddd91e54d..ba32d6a9960 100644 --- a/rubocop/cop/migration/add_timestamps.rb +++ b/rubocop/cop/migration/add_timestamps.rb @@ -13,7 +13,7 @@ module RuboCop def on_send(node) return unless in_migration?(node) - add_offense(node, :selector) if method_name(node) == :add_timestamps + add_offense(node, location: :selector) if method_name(node) == :add_timestamps end def method_name(node) diff --git a/rubocop/cop/migration/datetime.rb b/rubocop/cop/migration/datetime.rb index 9cba3c35b26..03ad3f3f601 100644 --- a/rubocop/cop/migration/datetime.rb +++ b/rubocop/cop/migration/datetime.rb @@ -17,7 +17,7 @@ module RuboCop method_name = node.children[1] if method_name == :datetime || method_name == :timestamp - add_offense(send_node, :selector, format(MSG, method_name)) + add_offense(send_node, location: :selector, message: format(MSG, method_name)) end end end @@ -32,7 +32,7 @@ module RuboCop last_argument = descendant.children.last if last_argument == :datetime || last_argument == :timestamp - add_offense(node, :expression, format(MSG, last_argument)) + add_offense(node, location: :expression, message: format(MSG, last_argument)) end end end diff --git a/rubocop/cop/migration/hash_index.rb b/rubocop/cop/migration/hash_index.rb index 2cc59691d84..3206b73bd3d 100644 --- a/rubocop/cop/migration/hash_index.rb +++ b/rubocop/cop/migration/hash_index.rb @@ -29,7 +29,7 @@ module RuboCop hash_key_name(pair) == :using if hash_key_value(pair).to_s == 'hash' - add_offense(pair, :expression) + add_offense(pair, location: :expression) end end end diff --git a/rubocop/cop/migration/remove_column.rb b/rubocop/cop/migration/remove_column.rb index e53eb2e07b2..fffb4ab7fab 100644 --- a/rubocop/cop/migration/remove_column.rb +++ b/rubocop/cop/migration/remove_column.rb @@ -20,7 +20,7 @@ module RuboCop send_method = send_node.children[1] if send_method == :remove_column - add_offense(send_node, :selector) + add_offense(send_node, location: :selector) end end end diff --git a/rubocop/cop/migration/remove_concurrent_index.rb b/rubocop/cop/migration/remove_concurrent_index.rb index 268c49865cb..2328740cf36 100644 --- a/rubocop/cop/migration/remove_concurrent_index.rb +++ b/rubocop/cop/migration/remove_concurrent_index.rb @@ -16,7 +16,7 @@ module RuboCop return unless node.children[1] == :remove_concurrent_index node.each_ancestor(:def) do |def_node| - add_offense(def_node, :name) if method_name(def_node) == :change + add_offense(def_node, location: :name) if method_name(def_node) == :change end end diff --git a/rubocop/cop/migration/remove_index.rb b/rubocop/cop/migration/remove_index.rb index 613b35dd00d..4df3b1ba756 100644 --- a/rubocop/cop/migration/remove_index.rb +++ b/rubocop/cop/migration/remove_index.rb @@ -13,7 +13,7 @@ module RuboCop return unless in_migration?(node) node.each_descendant(:send) do |send_node| - add_offense(send_node, :selector) if method_name(send_node) == :remove_index + add_offense(send_node, location: :selector) if method_name(send_node) == :remove_index end end diff --git a/rubocop/cop/migration/reversible_add_column_with_default.rb b/rubocop/cop/migration/reversible_add_column_with_default.rb index f413f06f39b..dd49188defa 100644 --- a/rubocop/cop/migration/reversible_add_column_with_default.rb +++ b/rubocop/cop/migration/reversible_add_column_with_default.rb @@ -9,7 +9,7 @@ module RuboCop include MigrationHelpers def_node_matcher :add_column_with_default?, <<~PATTERN - (send nil :add_column_with_default $...) + (send nil? :add_column_with_default $...) PATTERN def_node_matcher :defines_change?, <<~PATTERN @@ -26,7 +26,7 @@ module RuboCop node.each_ancestor(:def) do |def_node| next unless defines_change?(def_node) - add_offense(def_node, :name) + add_offense(def_node, location: :name) end end end diff --git a/rubocop/cop/migration/safer_boolean_column.rb b/rubocop/cop/migration/safer_boolean_column.rb index 0335c25d85d..dc5c55df6fb 100644 --- a/rubocop/cop/migration/safer_boolean_column.rb +++ b/rubocop/cop/migration/safer_boolean_column.rb @@ -28,7 +28,7 @@ module RuboCop ].freeze def_node_matcher :add_column?, <<~PATTERN - (send nil :add_column $...) + (send nil? :add_column $...) PATTERN def on_send(node) @@ -54,7 +54,7 @@ module RuboCop NULL_OFFENSE end - add_offense(node, :expression, format(offense, table)) if offense + add_offense(node, location: :expression, message: format(offense, table)) if offense end def no_default?(opts) diff --git a/rubocop/cop/migration/timestamps.rb b/rubocop/cop/migration/timestamps.rb index 71a9420cc3b..6cf5648b996 100644 --- a/rubocop/cop/migration/timestamps.rb +++ b/rubocop/cop/migration/timestamps.rb @@ -14,7 +14,7 @@ module RuboCop return unless in_migration?(node) node.each_descendant(:send) do |send_node| - add_offense(send_node, :selector) if method_name(send_node) == :timestamps + add_offense(send_node, location: :selector) if method_name(send_node) == :timestamps end end diff --git a/rubocop/cop/migration/update_column_in_batches.rb b/rubocop/cop/migration/update_column_in_batches.rb index 3f886cbfea3..db2b5564297 100644 --- a/rubocop/cop/migration/update_column_in_batches.rb +++ b/rubocop/cop/migration/update_column_in_batches.rb @@ -18,7 +18,7 @@ module RuboCop spec_path = spec_filename(node) unless File.exist?(File.expand_path(spec_path, rails_root)) - add_offense(node, :expression, format(MSG, spec_path)) + add_offense(node, location: :expression, message: format(MSG, spec_path)) end end diff --git a/rubocop/cop/migration/update_large_table.rb b/rubocop/cop/migration/update_large_table.rb index 3ae3fb1b68e..bb14d0f4f56 100644 --- a/rubocop/cop/migration/update_large_table.rb +++ b/rubocop/cop/migration/update_large_table.rb @@ -35,7 +35,7 @@ module RuboCop ].freeze def_node_matcher :batch_update?, <<~PATTERN - (send nil ${:add_column_with_default :update_column_in_batches} $(sym ...) ...) + (send nil? ${:add_column_with_default :update_column_in_batches} $(sym ...) ...) PATTERN def on_send(node) @@ -49,7 +49,7 @@ module RuboCop return unless LARGE_TABLES.include?(table) - add_offense(node, :expression, format(MSG, update_method, table)) + add_offense(node, location: :expression, message: format(MSG, update_method, table)) end end end |