blob: 83b4978117c38262d1009e0141e505af68ab6018 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#!/usr/bin/env ruby
result = 0
files = Dir['src/**/*.h'] + Dir['src/**/*.cpp'] - Dir['src/3rd-party/**/*']
puts 'Checking licenses...'
files.each { |name|
File.open(name) { |f|
if not f.readline.start_with? '/** LICENSE **' then
puts "Missing license header: #{name}"
result = 1
end
}
}
puts 'Checking style...'
if not `astyle --dry-run --formatted --options=astyle.rc #{files.join(' ')}`.empty? then
system "astyle --verbose --formatted --options=astyle.rc #{files.join(' ')}"
result = 1
end
puts "pre-commit exit(#{result})"
exit result
|