Sha256: f6e46f90c8235de77a16b16f198cc5d34aa910cfbe511577a2a8e843e009a52b

Contents?: true

Size: 443 Bytes

Versions: 9

Compression:

Stored size: 443 Bytes

Contents

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.location.expression.source_buffer.name)

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
gitlab-styles-2.4.0 lib/gitlab/styles/rubocop/migration_helpers.rb
gitlab-styles-2.3.2 lib/gitlab/styles/rubocop/migration_helpers.rb
gitlab-styles-2.3.1 lib/gitlab/styles/rubocop/migration_helpers.rb
gitlab-styles-2.3.0 lib/gitlab/styles/rubocop/migration_helpers.rb
gitlab-styles-2.2.0 lib/gitlab/styles/rubocop/migration_helpers.rb
gitlab-styles-2.1.0 lib/gitlab/styles/rubocop/migration_helpers.rb
gitlab-styles-2.0.0 lib/gitlab/styles/rubocop/migration_helpers.rb
gitlab-styles-1.0.0 lib/gitlab/styles/rubocop/migration_helpers.rb
gitlab-styles-0.1.0 lib/gitlab/styles/rubocop/migration_helpers.rb