Sha256: be74d594be5cce10adcb2e0fe6b1589961a03228019eb272c1ba4ebb363b9fef

Contents?: true

Size: 499 Bytes

Versions: 7

Compression:

Stored size: 499 Bytes

Contents

module Gitlab
  module Styles
    module Rubocop
      module ModelHelpers
        # Returns true if the given node originated from the models directory.
        def in_model?(node)
          path = node.location.expression.source_buffer.name
          pwd = RuboCop::PathUtil.pwd
          models_path = File.join(pwd, 'app', 'models')
          ee_models_path = File.join(pwd, 'ee', 'app', 'models')

          path.start_with?(models_path, ee_models_path)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
gitlab-styles-3.3.0 lib/gitlab/styles/rubocop/model_helpers.rb
gitlab-styles-3.2.0 lib/gitlab/styles/rubocop/model_helpers.rb
gitlab-styles-3.1.0 lib/gitlab/styles/rubocop/model_helpers.rb
gitlab-styles-3.0.0 lib/gitlab/styles/rubocop/model_helpers.rb
gitlab-styles-2.8.0 lib/gitlab/styles/rubocop/model_helpers.rb
gitlab-styles-2.7.0 lib/gitlab/styles/rubocop/model_helpers.rb
gitlab-styles-2.6.2 lib/gitlab/styles/rubocop/model_helpers.rb