Class: RuboCop::Cop::PostgresMigrationCops::UseAddIndex
- Inherits:
-
RuboCop::Cop
- Object
- RuboCop::Cop
- RuboCop::Cop::PostgresMigrationCops::UseAddIndex
- Defined in:
- lib/cops/use_add_index.rb
Overview
end
end
Constant Summary collapse
- MSG =
"Add indexes using 'add_index ... algorithm: :concurrently'"
Instance Method Summary collapse
Instance Method Details
#on_class(class_node) ⇒ Object
37 38 39 |
# File 'lib/cops/use_add_index.rb', line 37 def on_class(class_node) @is_migration = class_node.children.any? { |n| is_migration?(n) } end |
#on_send(send_node) ⇒ Object
41 42 43 44 45 |
# File 'lib/cops/use_add_index.rb', line 41 def on_send(send_node) return unless @is_migration add_offense(send_node) if contains_index?(send_node) end |