diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2017-12-25 21:35:49 +0100 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2017-12-25 21:35:49 +0100 |
commit | 6186990d9bcbfe344dd701caef781c4472439d6b (patch) | |
tree | 2c0060c9f3dfc7038404127501649f258281a897 /tools/hooks | |
parent | --profile no longer causes a crash (diff) | |
download | smolbote-6186990d9bcbfe344dd701caef781c4472439d6b.tar.xz |
Updated pre-commit hook
Diffstat (limited to 'tools/hooks')
-rwxr-xr-x | tools/hooks/pre-commit.rb | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/tools/hooks/pre-commit.rb b/tools/hooks/pre-commit.rb index ffc710c..f93281c 100755 --- a/tools/hooks/pre-commit.rb +++ b/tools/hooks/pre-commit.rb @@ -1,14 +1,14 @@ #!/usr/bin/env ruby result = 0 -files = Dir['src/**/*.h'] + Dir['src/**/*.cpp'] - Dir['src/3rd-party/**/*'] +files = Dir.glob("**/*.h") + Dir.glob("**/*.cpp") -puts "Running in #{`pwd`}" +puts "pre-commit: #{`pwd`}" puts 'Checking licenses...' files.each { |name| File.open(name) { |file| - if file.grep(/Copyright\s\(C\)\s(\d{4}\s*-\s*){0,1}(#{Time.now.year})/).empty? then + if file.grep(/SPDX-License-Identifier/).empty? then puts "Missing or incorrect license header: #{name}" result = 1 end @@ -21,8 +21,5 @@ if not `astyle --dry-run --formatted --options=astyle.rc #{files.join(' ')}`.emp result = 1 end -#puts 'Running cppcheck...' -#`cppcheck --quiet --enable=all --inconclusive --std=posix -I src/ .` - puts "pre-commit exit(#{result})" exit result |