From 71a4e548df2423ae8aebe06390f4beac58eea45e Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Mon, 9 Jul 2018 16:59:03 +0100 Subject: [PATCH] Updated git hooks to check new header format --- .../pendulumAndSpring.gnuplot | 2 +- .../test/rigidBodyDynamics/spring.gnuplot | 2 +- bin/tools/HookFunctions | 55 ++++++++++++------- doc/Doxygen/Macros/tensorOperator.sty | 2 +- .../hotBoxes/patchifyObstacles | 8 --- wmake/src/wmkdep.l | 12 ++-- 6 files changed, 44 insertions(+), 37 deletions(-) diff --git a/applications/test/rigidBodyDynamics/pendulumAndSpring.gnuplot b/applications/test/rigidBodyDynamics/pendulumAndSpring.gnuplot index 2411645062..a2ccba71da 100644 --- a/applications/test/rigidBodyDynamics/pendulumAndSpring.gnuplot +++ b/applications/test/rigidBodyDynamics/pendulumAndSpring.gnuplot @@ -4,7 +4,7 @@ # \\ / O peration | Website: https://openfoam.org # \\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation # \\/ M anipulation | -#------------------------------------------------------------------------------- +#------------------------------------------------------------------------------ # License # This file is part of OpenFOAM. # diff --git a/applications/test/rigidBodyDynamics/spring.gnuplot b/applications/test/rigidBodyDynamics/spring.gnuplot index ed966e3c40..45cf9c9c80 100644 --- a/applications/test/rigidBodyDynamics/spring.gnuplot +++ b/applications/test/rigidBodyDynamics/spring.gnuplot @@ -4,7 +4,7 @@ # \\ / O peration | Website: https://openfoam.org # \\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation # \\/ M anipulation | -#------------------------------------------------------------------------------- +#------------------------------------------------------------------------------ # License # This file is part of OpenFOAM. # diff --git a/bin/tools/HookFunctions b/bin/tools/HookFunctions index 113836cbda..3e5249aae1 100644 --- a/bin/tools/HookFunctions +++ b/bin/tools/HookFunctions @@ -35,7 +35,8 @@ echoIndent=" " sourceBanner="(\ /\*---------------------------------------------------------------------------\*\\\\|\ -/\*--------------------------------\*- C\+\+ -\*----------------------------------\*\\\\) +/\*--------------------------------\*- C\+\+ -\*----------------------------------\*\\\\|\ +/\*---------------------------------\*- C -\*-----------------------------------\*\\\\) ========= \| \\\\\\\\ / F ield \| OpenFOAM: The Open Source CFD Toolbox \\\\\\\\ / O peration \| Website: https://openfoam\.org @@ -91,13 +92,15 @@ scriptBanner="(\ )*? #------------------------------------------------------------------------------" -dictBanner="\ -/\*--------------------------------\*- C\+\+ -\*----------------------------------\*\\\\ -\| ========= \| \| -\| \\\\\\\\ / F ield \| OpenFOAM: The Open Source CFD Toolbox \| -\| \\\\\\\\ / O peration \| Version: dev \| -\| \\\\\\\\ / A nd \| Website: https://openfoam\.org \| -\| \\\\\\\\/ M anipulation \| \| +dictBanner="(\ +/\*---------------------------------------------------------------------------\*\\\\|\ +/\*--------------------------------\*- C\+\+ -\*----------------------------------\*\\\\) + ========= \| + \\\\\\\\ / F ield \| OpenFOAM: The Open Source CFD Toolbox + \\\\\\\\ / O peration \| Website: https://openfoam\.org + \\\\\\\\ / A nd \| Version: (dev|[0-9\.x]+) + \\\\\\\\/ M anipulation \|(.| +)*? \\\\\*---------------------------------------------------------------------------\*/" @@ -395,36 +398,48 @@ checkBanner() badFiles=$( for f in $fileList do - # Source files - if git grep -q -e "Copyright (C) [0-9-]\+ OpenFOAM Foundation" $scopeGrep"$f" + fFile="${f##*/}" + [[ "$fFile" = *.* ]] && fExt="${fFile##*.}" || fExt="" + + # Skip links + if [ -h "$f" ] 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" then echo $f fi ;; - (*.*) - # No check for other extensions yet - ;; - (*) - # Assume that everything with a copyright statement but without - # an extension is a script with '#' comments + (''|awk|csh|gnuplot|sed|sh) if ! git show $scopeShow"$f" | pcregrep -q -M "$scriptBanner" then echo $f fi ;; + (*) + # Unknown extension + echo "Banner not checked for copyrighted file $f" 1>&2 + ;; esac - # Case files - elif git grep -q -e "^FoamFile" $scopeGrep"$f" + # Versioned case files + elif git grep -q -e "Version: \(dev\|[0-9.]+\)" $scopeGrep"$f" then if ! git show $scopeShow"$f" | pcregrep -q -M "$dictBanner" then echo $f 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 done ) diff --git a/doc/Doxygen/Macros/tensorOperator.sty b/doc/Doxygen/Macros/tensorOperator.sty index 6fbd6a5221..531878b5b3 100644 --- a/doc/Doxygen/Macros/tensorOperator.sty +++ b/doc/Doxygen/Macros/tensorOperator.sty @@ -1,4 +1,4 @@ -%----------------------------------------------------------------------------- +%------------------------------------------------------------------------------ % ========= | % \\ / F ield | OpenFOAM: The Open Source CFD Toolbox % \\ / O peration | Website: https://openfoam.org diff --git a/tutorials/lagrangian/reactingParcelFoam/hotBoxes/patchifyObstacles b/tutorials/lagrangian/reactingParcelFoam/hotBoxes/patchifyObstacles index 653ac2dead..f9ceb3dcf2 100755 --- a/tutorials/lagrangian/reactingParcelFoam/hotBoxes/patchifyObstacles +++ b/tutorials/lagrangian/reactingParcelFoam/hotBoxes/patchifyObstacles @@ -1,12 +1,4 @@ #!/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 # Stop on first error diff --git a/wmake/src/wmkdep.l b/wmake/src/wmkdep.l index 82d6ae4b18..f44b6c9ff1 100644 --- a/wmake/src/wmkdep.l +++ b/wmake/src/wmkdep.l @@ -1,11 +1,11 @@ %{ /*---------------------------------*- C -*-----------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation - \\/ M anipulation | ------------------------------------------------------------------------------- + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- License This file is part of OpenFOAM.