2018-01-23 12:42:10 -05:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
|
|
|
|
ALLOWED = [
|
2019-07-22 11:11:50 -04:00
|
|
|
# https://gitlab.com/gitlab-org/gitaly/issues/760
|
|
|
|
'lib/elasticsearch/git/repository.rb',
|
|
|
|
|
2018-10-01 23:21:46 -04:00
|
|
|
# Needed to handle repositories that are not in any storage
|
2018-01-23 12:42:10 -05:00
|
|
|
'lib/gitlab/bare_repository_import/repository.rb',
|
|
|
|
|
2018-07-17 09:12:29 -04:00
|
|
|
# Needed to avoid using the git binary to validate a branch name
|
2019-02-21 16:07:26 -05:00
|
|
|
'lib/gitlab/git_ref_validator.rb',
|
|
|
|
|
|
|
|
# Reverted Rugged calls due to Gitaly atop NFS performance
|
|
|
|
# See https://docs.gitlab.com/ee/development/gitaly.html#legacy-rugged-code.
|
|
|
|
'lib/gitlab/git/rugged_impl/',
|
2019-07-17 19:34:27 -04:00
|
|
|
'lib/gitlab/gitaly_client/storage_settings.rb',
|
|
|
|
|
|
|
|
# Needed for logging
|
2019-07-21 01:34:46 -04:00
|
|
|
'config/initializers/peek.rb',
|
2019-07-17 19:34:27 -04:00
|
|
|
'config/initializers/lograge.rb',
|
|
|
|
'lib/gitlab/grape_logging/loggers/perf_logger.rb',
|
2019-08-09 00:33:20 -04:00
|
|
|
'lib/gitlab/instrumentation_helper.rb',
|
2019-07-21 01:34:46 -04:00
|
|
|
'lib/gitlab/rugged_instrumentation.rb',
|
|
|
|
'lib/peek/views/rugged.rb'
|
2018-01-23 12:42:10 -05:00
|
|
|
].freeze
|
|
|
|
|
|
|
|
rugged_lines = IO.popen(%w[git grep -i -n rugged -- app config lib], &:read).lines
|
2018-01-30 11:21:55 -05:00
|
|
|
rugged_lines = rugged_lines.select { |l| /^[^:]*\.rb:/ =~ l }
|
2018-01-23 12:42:10 -05:00
|
|
|
rugged_lines = rugged_lines.reject { |l| l.start_with?(*ALLOWED) }
|
2019-02-21 16:07:26 -05:00
|
|
|
rugged_lines = rugged_lines.reject { |l| /(include|prepend) Gitlab::Git::RuggedImpl/ =~ l}
|
2018-01-23 12:42:10 -05:00
|
|
|
rugged_lines = rugged_lines.reject do |line|
|
|
|
|
code, _comment = line.split('# ', 2)
|
|
|
|
code !~ /rugged/i
|
|
|
|
end
|
|
|
|
|
|
|
|
exit if rugged_lines.empty?
|
|
|
|
|
|
|
|
puts "Using Rugged is only allowed in test and #{ALLOWED}\n\n"
|
|
|
|
|
|
|
|
puts rugged_lines
|
|
|
|
|
|
|
|
exit(false)
|