-
-
Save handrus/9254534 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Git pre-commit hook for Drupal projects. | |
# Created by Dave Hall - http://davehall.com.au | |
# | |
# Changed by Handrus Nogueira and Luiz Petri | |
# | |
# Distributed under the terms of the WTFPL - http://www.wtfpl.net/ | |
# | |
set -e | |
files = "" | |
ROOT_DIR=$(git rev-parse --show-toplevel) | |
for file in $(git diff --cached --name-only --diff-filter=ACM); do | |
files = "$files $ROOT_DIR/$file" | |
# Skip docs | |
ext="${file##*.}" | |
if ! [[ $ext in ("php" | "module" | "inc") ]]; then | |
continue; | |
fi | |
php -l "$ROOT_DIR/$file" | |
done | |
echo "Running coder"; | |
drush coder-review --minor --comment --i18n --release --security --sql --style --no-empty "$files" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment