Sha256: e96fb51af75f1ec4a737a3f59fbb535cda3e07426e9d1b94eac1981d42af3820

Contents?: true

Size: 485 Bytes

Versions: 6

Compression:

Stored size: 485 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 = Dir.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

6 entries across 6 versions & 1 rubygems

Version Path
gitlab-styles-2.6.1 lib/gitlab/styles/rubocop/model_helpers.rb
gitlab-styles-2.6.0 lib/gitlab/styles/rubocop/model_helpers.rb
gitlab-styles-2.5.2 lib/gitlab/styles/rubocop/model_helpers.rb
gitlab-styles-2.5.1 lib/gitlab/styles/rubocop/model_helpers.rb
gitlab-styles-2.5.0 lib/gitlab/styles/rubocop/model_helpers.rb
gitlab-styles-2.4.1 lib/gitlab/styles/rubocop/model_helpers.rb