-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpre-commit
executable file
·42 lines (34 loc) · 1.38 KB
/
pre-commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
# Propeople SVN pre commit hook
# Martin Martinov / https://github.com/martinov/svn-pre-commit
# Add -x to the first line of the script to debug.
# Last change: 25.10.2012
REPOS="$1"
TXN="$2"
REPO_NAME=`basename ${REPOS}`
CHECK_LOG_MSG="/home/martin/shell_scripts/check-log-msg-svn-pre-commit"
CHECK_PHP_SYNTAX="/home/martin/shell_scripts/check-php-syntax-svn-pre-commit"
CHECK_DRUPAL_CS="/home/martin/shell_scripts/phpcs-svn-pre-commit\
--standard=/home/martin/coder/coder_sniffer/Drupal/ruleset.xml\
--extensions=php,module,inc,install,test,profile,theme"
CHECK_DRUPAL_CS_PROJECTS="/home/martin/shell_scripts/drupalcs-projects"
CHECK_DRUPAL_CS_SKIP="/home/martin/shell_scripts/skip-keyword-svn-pre-commit"
SVNLOOK=/usr/bin/svnlook
# Check if there are changes in */sites/*/modules/[propeople|custom] directories.
#CHANGED_DIRS=`${SVNLOOK} dirs-changed -t "${TXN}" "${REPOS}"`
# Check log message for proper task/bug identification.
if [ -x ${CHECK_LOG_MSG} ]; then
${CHECK_LOG_MSG} "${REPOS}" "${TXN}" 1>&2 || exit 1
fi
# Check PHP files for syntax errors.
if [ -x ${CHECK_PHP_SYNTAX} ]; then
${CHECK_PHP_SYNTAX} "${REPOS}" "${TXN}" 1>&2 || exit 1
fi
# Check for Drupal Coding Standards.
if [ `sed -n "/^${REPO_NAME}$/p" $CHECK_DRUPAL_CS_PROJECTS` ]; then
${CHECK_DRUPAL_CS_SKIP} "${REPOS}" "${TXN}"
if [ $? -ne 0 ]; then
$CHECK_DRUPAL_CS "$REPOS" -t "$TXN" >&2 || exit 1
fi
fi
exit 0