summaryrefslogtreecommitdiff
path: root/rubocop/migration_helpers.rb
blob: 3160a784a042299eb5cc450ca09cd859eef96a36 (plain)
1
2
3
4
5
6
7
8
9
10
module RuboCop
  # Module containing helper methods for writing migration cops.
  module MigrationHelpers
    # Returns true if the given node originated from the db/migrate directory.
    def in_migration?(node)
      File.dirname(node.location.expression.source_buffer.name).
        end_with?('db/migrate')
    end
  end
end