diff options
Diffstat (limited to 'tools/hooks')
-rwxr-xr-x | tools/hooks/pre-commit.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/hooks/pre-commit.rb b/tools/hooks/pre-commit.rb index 6e52147..ef2c6a5 100755 --- a/tools/hooks/pre-commit.rb +++ b/tools/hooks/pre-commit.rb @@ -7,15 +7,15 @@ puts "Running in #{`pwd`}" puts 'Checking licenses...' files.each { |name| - File.open(name) { |f| - if not f.readline.start_with? '/** LICENSE **' then - puts "Missing license header: #{name}" + File.open(name) { |file| + if file.grep(/Copyright\s\(C\)\s(\d{4}\s*-\s*){0,1}(#{Time.now.year})/).empty? then + puts "Missing or incorrect license header: #{name}" result = 1 end } } -puts 'Checking style...' +puts 'Running astyle...' if not `astyle --dry-run --formatted --options=astyle.rc #{files.join(' ')}`.empty? then system "astyle --verbose --suffix=none --formatted --options=astyle.rc #{files.join(' ')}" result = 1 |