diff options
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 |