Sha256: bc96d7cee8185742f3d3b372867cba53b460ae7834445905e297b9b34d950352

Contents?: true

Size: 555 Bytes

Versions: 4

Compression:

Stored size: 555 Bytes

Contents

# frozen_string_literal: true

module Gitlab
  module Styles
    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)
          dirname = File.dirname(node.source_range.source_buffer.name)

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gitlab-styles-13.0.1 lib/gitlab/styles/rubocop/migration_helpers.rb
gitlab-styles-13.0.0 lib/gitlab/styles/rubocop/migration_helpers.rb
gitlab-styles-11.0.0 lib/gitlab/styles/rubocop/migration_helpers.rb
gitlab-styles-10.1.0 lib/gitlab/styles/rubocop/migration_helpers.rb