gitlab-org--gitlab-foss/rubocop/qa_helpers.rb
Rémy Coutable 02c47f2f73
Add a new QA::ElementWithPattern cop
This cop forbids the use of `element :foo, 'pattern'` and
`element :bar, /pattern/` in QA files.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2018-10-15 14:28:03 +02:00

11 lines
315 B
Ruby

module RuboCop
# Module containing helper methods for writing QA cops.
module QAHelpers
# Returns true if the given node originated from the qa/ directory.
def in_qa_file?(node)
path = node.location.expression.source_buffer.name
path.start_with?(File.join(Dir.pwd, 'qa'))
end
end
end