diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2017-04-02 20:22:13 +0200 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2017-04-02 20:22:13 +0200 |
commit | b231faf8ed4d8cc009a33afb636fd4fe197ddd0e (patch) | |
tree | 5fb9642ea245a7f906f44f253c5d50d18772c316 /tools/hooks | |
parent | Some code cleanup (diff) | |
download | smolbote-b231faf8ed4d8cc009a33afb636fd4fe197ddd0e.tar.xz |
Updated pre-commit.rb
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 |