Commit 96aa0838 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'sh-cache-rubocop-cwd' into 'master'

Cache current working directory to speed up Rubocop

Closes #61383

See merge request gitlab-org/gitlab-ce!28066
parents d5c4cb56 a8cbec49
......@@ -5,7 +5,7 @@ module RuboCop
def in_qa_file?(node)
path = node.location.expression.source_buffer.name
path.start_with?(File.join(Dir.pwd, 'qa'))
path.start_with?(File.join(RuboCop::PathUtil.pwd, 'qa'))
end
end
end
......@@ -6,14 +6,16 @@ module RuboCop
# Returns true if the given node originated from the spec directory.
def in_spec?(node)
path = node.location.expression.source_buffer.name
pwd = RuboCop::PathUtil.pwd
!SPEC_HELPERS.include?(File.basename(path)) &&
path.start_with?(File.join(Dir.pwd, 'spec'), File.join(Dir.pwd, 'ee', 'spec'))
path.start_with?(File.join(pwd, 'spec'), File.join(pwd, 'ee', 'spec'))
end
def migration_directories
@migration_directories ||= MIGRATION_SPEC_DIRECTORIES.map do |dir|
[File.join(Dir.pwd, dir), File.join(Dir.pwd, 'ee', dir)]
pwd = RuboCop::PathUtil.pwd
[File.join(pwd, dir), File.join(pwd, 'ee', dir)]
end.flatten
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment