Updated git hooks to check new header format

This commit is contained in:
Henry Weller
2018-07-09 16:59:03 +01:00
parent fdbf3c134f
commit 71a4e548df
6 changed files with 44 additions and 37 deletions

View File

@ -4,7 +4,7 @@
# \\ / O peration | Website: https://openfoam.org # \\ / O peration | Website: https://openfoam.org
# \\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM. # This file is part of OpenFOAM.
# #

View File

@ -4,7 +4,7 @@
# \\ / O peration | Website: https://openfoam.org # \\ / O peration | Website: https://openfoam.org
# \\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM. # This file is part of OpenFOAM.
# #

View File

@ -35,7 +35,8 @@ echoIndent=" "
sourceBanner="(\ sourceBanner="(\
/\*---------------------------------------------------------------------------\*\\\\|\ /\*---------------------------------------------------------------------------\*\\\\|\
/\*--------------------------------\*- C\+\+ -\*----------------------------------\*\\\\) /\*--------------------------------\*- C\+\+ -\*----------------------------------\*\\\\|\
/\*---------------------------------\*- C -\*-----------------------------------\*\\\\)
========= \| ========= \|
\\\\\\\\ / F ield \| OpenFOAM: The Open Source CFD Toolbox \\\\\\\\ / F ield \| OpenFOAM: The Open Source CFD Toolbox
\\\\\\\\ / O peration \| Website: https://openfoam\.org \\\\\\\\ / O peration \| Website: https://openfoam\.org
@ -91,13 +92,15 @@ scriptBanner="(\
)*? )*?
#------------------------------------------------------------------------------" #------------------------------------------------------------------------------"
dictBanner="\ dictBanner="(\
/\*--------------------------------\*- C\+\+ -\*----------------------------------\*\\\\ /\*---------------------------------------------------------------------------\*\\\\|\
\| ========= \| \| /\*--------------------------------\*- C\+\+ -\*----------------------------------\*\\\\)
\| \\\\\\\\ / F ield \| OpenFOAM: The Open Source CFD Toolbox \| ========= \|
\| \\\\\\\\ / O peration \| Version: dev \| \\\\\\\\ / F ield \| OpenFOAM: The Open Source CFD Toolbox
\| \\\\\\\\ / A nd \| Website: https://openfoam\.org \| \\\\\\\\ / O peration \| Website: https://openfoam\.org
\| \\\\\\\\/ M anipulation \| \| \\\\\\\\ / A nd \| Version: (dev|[0-9\.x]+)
\\\\\\\\/ M anipulation \|(.|
)*?
\\\\\*---------------------------------------------------------------------------\*/" \\\\\*---------------------------------------------------------------------------\*/"
@ -395,36 +398,48 @@ checkBanner()
badFiles=$( badFiles=$(
for f in $fileList for f in $fileList
do do
# Source files fFile="${f##*/}"
if git grep -q -e "Copyright (C) [0-9-]\+ OpenFOAM Foundation" $scopeGrep"$f" [[ "$fFile" = *.* ]] && fExt="${fFile##*.}" || fExt=""
# Skip links
if [ -h "$f" ]
then then
case "$f" in :
(*.c|*.C|*.Cver|*.cxx|*.dox|*.H|*.h)
# Copyrighted source and script files
elif git grep -q -e "Copyright (C) [0-9-]\+ OpenFOAM Foundation" $scopeGrep"$f"
then
case "$fExt" in
(c|C|Cver|cxx|dox|H|h|l|L)
if ! git show $scopeShow"$f" | pcregrep -q -M "$sourceBanner" if ! git show $scopeShow"$f" | pcregrep -q -M "$sourceBanner"
then then
echo $f echo $f
fi fi
;; ;;
(*.*) (''|awk|csh|gnuplot|sed|sh)
# No check for other extensions yet
;;
(*)
# Assume that everything with a copyright statement but without
# an extension is a script with '#' comments
if ! git show $scopeShow"$f" | pcregrep -q -M "$scriptBanner" if ! git show $scopeShow"$f" | pcregrep -q -M "$scriptBanner"
then then
echo $f echo $f
fi fi
;; ;;
(*)
# Unknown extension
echo "Banner not checked for copyrighted file $f" 1>&2
;;
esac esac
# Case files # Versioned case files
elif git grep -q -e "^FoamFile" $scopeGrep"$f" elif git grep -q -e "Version: \(dev\|[0-9.]+\)" $scopeGrep"$f"
then then
if ! git show $scopeShow"$f" | pcregrep -q -M "$dictBanner" if ! git show $scopeShow"$f" | pcregrep -q -M "$dictBanner"
then then
echo $f echo $f
fi fi
# Unknown files
elif git grep -q -e "OpenFOAM: The Open Source CFD Toolbox" $scopeGrep"$f"
then
: #echo "Banner not checked for file $f" 1>&2
fi fi
done done
) )

View File

@ -1,4 +1,4 @@
%----------------------------------------------------------------------------- %------------------------------------------------------------------------------
% ========= | % ========= |
% \\ / F ield | OpenFOAM: The Open Source CFD Toolbox % \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
% \\ / O peration | Website: https://openfoam.org % \\ / O peration | Website: https://openfoam.org

View File

@ -1,12 +1,4 @@
#!/bin/sh #!/bin/sh
#--------------------------------*- C++ -*------------------------------------#
# ========= | #
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox #
# \\ / O peration | Version: dev #
# \\ / A nd | Website: https://openfoam.org #
# \\/ M anipulation | #
#-----------------------------------------------------------------------------#
cd ${0%/*} || exit 1 # Run from this directory cd ${0%/*} || exit 1 # Run from this directory
# Stop on first error # Stop on first error

View File

@ -2,10 +2,10 @@
/*---------------------------------*- C -*-----------------------------------*\ /*---------------------------------*- C -*-----------------------------------*\
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------ -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.