blob: 6cdb055d0fffe254c7e1643a2752099df2930c66 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#!/usr/bin/env ruby
ALLOWED = [
# Needed to handle repositories that are not in any storage
"lib/gitlab/bare_repository_import/repository.rb",
# Needed to avoid using the git binary to validate a branch name
"lib/gitlab/git_ref_validator.rb",
].freeze
rugged_lines = IO.popen(%w[git grep -i -n rugged -- app config lib], &:read).lines
rugged_lines = rugged_lines.select { |l| /^[^:]*\.rb:/ =~ l }
rugged_lines = rugged_lines.reject { |l| l.start_with?(*ALLOWED) }
rugged_lines = rugged_lines.reject { |line|
code, _comment = line.split("# ", 2)
code !~ /rugged/i
}
exit if rugged_lines.empty?
puts "Using Rugged is only allowed in test and #{ALLOWED}\n\n"
puts rugged_lines
exit(false)
|