From ff37232f5524dd0c17475a73fd667776841bcdb0 Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 29 Jul 2011 18:11:53 +0100 Subject: [PATCH] ENH: commit-hook: added copyright check --- bin/tools/pre-commit-hook | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/bin/tools/pre-commit-hook b/bin/tools/pre-commit-hook index 94018f90b7..eab03d8e77 100755 --- a/bin/tools/pre-commit-hook +++ b/bin/tools/pre-commit-hook @@ -263,6 +263,26 @@ checkLineLengthNonDirective() } +# +# check that OpenCFD copyright is currents +# +checkCopyright() +{ + year=$(date +%Y) + echo "$hookName: check copyright ..." 1>&2 + + for f in $fileList + do + sYear=`grep "Copyright.*OpenCFD" $f | sed 's/[^0-9]//g' | cut -c 5-9` + if [ "$year" != "" ] && [ "$year" != "$sYear" ]; then + echo "Updated copyright for: $f" + sed -i "s/$sYear OpenCFD/$year OpenCFD/g" $f + fi + + done +} + + #------------------------------------------------------------------------------ # Main code : do all checks # @@ -276,6 +296,7 @@ checkIllegalCode # ensure code conforms to 80 columns max checkLineLengthNonDirective +checkCopyright exit 0 #------------------------------------------------------------------------------