mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
[task/git-tools] Beginnings of a syntax checking hook.
Currently this hook checks line length is less than or equal to 80 characters. PHPBB3-9768
This commit is contained in:
parent
bfa7b28734
commit
66e58234ec
1 changed files with 26 additions and 0 deletions
26
git-tools/hooks/commit-msg
Executable file
26
git-tools/hooks/commit-msg
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# A hook to check syntax of a phpBB3 commit message, per:
|
||||
# * <http://wiki.phpbb.com/display/DEV/Git>
|
||||
# * <http://area51.phpbb.com/phpBB/viewtopic.php?p=209919#p209919>
|
||||
#
|
||||
# This is a commit-msg hook.
|
||||
#
|
||||
# To install this you can either copy or symlink it to
|
||||
# $GIT_DIR/hooks, example:
|
||||
#
|
||||
# ln -s ../../git-tools/hooks/commit-msg \\
|
||||
# .git/hooks/commit-msg
|
||||
|
||||
status=0;
|
||||
|
||||
if [ "$(wc --max-line-length "$1" | cut -f1 -d" ")" -gt 80 ]
|
||||
then
|
||||
echo "The following lines are greater than 80 characters long:\n";
|
||||
|
||||
grep -nE '.{81,}' "$1";
|
||||
|
||||
status=1;
|
||||
fi
|
||||
|
||||
exit $status;
|
Loading…
Add table
Reference in a new issue