Module: Gitlab::Styles::Rubocop::MigrationHelpers

Included in:
Cop::Migration::UpdateLargeTable
Defined in:
lib/gitlab/styles/rubocop/migration_helpers.rb

Overview

Module containing helper methods for writing migration cops.

Instance Method Summary collapse

Instance Method Details

#in_migration?(node) ⇒ Boolean

Returns true if the given node originated from the db/migrate directory.

Returns:

  • (Boolean)


9
10
11
12
13
14
15
16
17
# File 'lib/gitlab/styles/rubocop/migration_helpers.rb', line 9

def in_migration?(node)
  dirname = File.dirname(node.location.expression.source_buffer.name)

  dirname.end_with?(
    'db/migrate',
    'db/post_migrate',
    'ee/db/migrate',
    'ee/db/post_migrate')
end