Class: RuboCop::Cop::Style::SchemaComments

Inherits:
RuboCop::Cop show all
Includes:
ConfigurableEnforcedStyle
Defined in:
lib/rubocop/cop/style/schema_comments.rb

Constant Summary collapse

MSG =
'Comment is obligatory.'.freeze
COMMON_DB_FIELDS =
%w("deleted_at" "id" "creator_id" "deleter_id" "created_at" "updated_at").freeze

Instance Method Summary collapse

Instance Method Details

#on_block(node) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/rubocop/cop/style/schema_comments.rb', line 12

def on_block(node)
  node.body.each_child_node do |table|
    # skip add_foreign_key, add_index
    if table.type == :block && table.send_node.source.start_with?("create_table")
      table.body.each_child_node do |ancestor|
        process_block_child_node(ancestor)
      end
    end
  end
end