gitlab-org--gitlab-foss/rubocop/model_helpers.rb

12 lines
304 B
Ruby
Raw Normal View History

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
models_path = File.join(Dir.pwd, 'app', 'models')
path.start_with?(models_path)
end
end
end