From b231faf8ed4d8cc009a33afb636fd4fe197ddd0e Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Sun, 2 Apr 2017 20:22:13 +0200 Subject: Updated pre-commit.rb --- tools/hooks/pre-commit.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tools') 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 -- cgit v1.2.1