mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Removed OpenCFD-specific behaviour out of hooks
This commit is contained in:
@ -39,7 +39,6 @@
|
||||
#
|
||||
# Checks for
|
||||
# - illegal code, e.g. <TAB>
|
||||
# - copyright is current, e.g. if present, contains XXX-<current-year>
|
||||
# - columns greater than 80 for *.[CH] files
|
||||
#
|
||||
# Note
|
||||
@ -138,8 +137,8 @@ checkIllegalCode()
|
||||
{
|
||||
echo "$hookName: check bad strings/characters etc ..." 1>&2
|
||||
|
||||
reBad="(N""abla|"$'\t'")"
|
||||
msgBad="N""abla or <TAB>"
|
||||
reBad="("$'\t'")"
|
||||
msgBad="<TAB>"
|
||||
|
||||
scope=$(gitScope $@)
|
||||
|
||||
@ -167,40 +166,6 @@ checkIllegalCode()
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# check that OpenCFD copyright is current
|
||||
#
|
||||
checkCopyright()
|
||||
{
|
||||
year=$(date +%Y)
|
||||
echo "$hookName: check copyright ..." 1>&2
|
||||
|
||||
scope=$(gitScope $@)
|
||||
|
||||
badFiles=$(
|
||||
for f in $fileList
|
||||
do
|
||||
# NB: need to have OpenCFD on a separate line to prevent
|
||||
# this check being caught by itself!
|
||||
#
|
||||
# parse line numbers from grep output:
|
||||
# <lineNr>: contents
|
||||
#
|
||||
lines=$(git grep -F -hn -e Copyright \
|
||||
--and -e OpenCFD \
|
||||
--and --not -e "$year" \
|
||||
$scope"$f" |
|
||||
sed -e 's@:.*@@' |
|
||||
tr '\n' ' '
|
||||
)
|
||||
[ -n "$lines" ] && echo "$Indent$f -- lines: $lines"
|
||||
done
|
||||
)
|
||||
|
||||
dieOnBadFiles "Update copyright year, e.g. XXXX-$year"
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# limit line length to 80-columns
|
||||
#
|
||||
@ -308,9 +273,6 @@ bad=$(git diff-index --cached --check $against --) || die "$bad"
|
||||
# check for illegal code, e.g. <TAB>, etc
|
||||
checkIllegalCode
|
||||
|
||||
# ensure OpenCFD copyright contains correct year
|
||||
checkCopyright
|
||||
|
||||
# ensure code conforms to 80 columns max
|
||||
checkLineLengthNonDirective
|
||||
|
||||
|
||||
@ -39,7 +39,6 @@
|
||||
#
|
||||
# Checks for
|
||||
# - illegal code, e.g. <TAB>
|
||||
# - copyright is current, e.g. if present, contains XXX-<current-year>
|
||||
# - columns greater than 80 for *.[CH] files
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
@ -101,8 +100,8 @@ checkIllegalCode()
|
||||
{
|
||||
echo "$hookName: check bad strings/characters etc ..." 1>&2
|
||||
|
||||
reBad="(N""abla|"$'\t'"|"$'\r\n'")"
|
||||
msgBad="N""abla, <TAB> or DOS-line-endings"
|
||||
reBad="("$'\t'"|"$'\r\n'")"
|
||||
msgBad="<TAB> or DOS-line-endings"
|
||||
|
||||
scope=$(gitScope $@)
|
||||
|
||||
@ -130,40 +129,6 @@ checkIllegalCode()
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# check that OpenCFD copyright is current
|
||||
#
|
||||
checkCopyright()
|
||||
{
|
||||
year=$(date +%Y)
|
||||
echo "$hookName: check copyright ..." 1>&2
|
||||
|
||||
scope=$(gitScope $@)
|
||||
|
||||
badFiles=$(
|
||||
for f in $fileList
|
||||
do
|
||||
# NB: need to have OpenCFD on a separate line to prevent
|
||||
# this check being caught by itself!
|
||||
#
|
||||
# parse line numbers from grep output:
|
||||
# <lineNr>: contents
|
||||
#
|
||||
lines=$(git grep -F -hn -e Copyright \
|
||||
--and -e OpenCFD \
|
||||
--and --not -e "$year" \
|
||||
$scope"$f" |
|
||||
sed -e 's@:.*@@' |
|
||||
tr '\n' ' '
|
||||
)
|
||||
[ -n "$lines" ] && echo "$Indent$f -- lines: $lines"
|
||||
done
|
||||
)
|
||||
|
||||
dieOnBadFiles "Update copyright year, e.g. XXXX-$year"
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# limit line length to 80-columns
|
||||
#
|
||||
@ -297,9 +262,6 @@ do
|
||||
# check for illegal code, e.g. <TAB>, etc
|
||||
checkIllegalCode $newSHA1
|
||||
|
||||
# ensure OpenCFD copyright contains correct year
|
||||
checkCopyright $newSHA1
|
||||
|
||||
# ensure code conforms to 80 columns max
|
||||
checkLineLengthNonDirective $newSHA1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user