Skip to content

Commit

Permalink
Update pre-commit hook so PHPCS only looks at staged PHP files
Browse files Browse the repository at this point in the history
  • Loading branch information
westonruter committed Oct 7, 2013
1 parent 00d36fb commit 0ae29af
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ if [ -e .jshintrc ]; then
fi

# PHP_CodeSniffer WordPress Coding Standards
if [ $(git status --porcelain | egrep "^ ?[MARC]" | cut -c4- | egrep ".php$" | wc -l) != 0 ]; then
if [ $(git status --porcelain | egrep "^[MARC]" | cut -c4- | egrep ".php$" | wc -l) != 0 ]; then
if command -v jshint >/dev/null 2>&1; then
phpcs_standard=$(if [ -e ruleset.xml ]; then echo ruleset.xml; else echo WordPress; fi)
phpcs -p -s -v --standard=$phpcs_standard $(git status --porcelain | egrep "^ ?[MARC]" | cut -c4- | egrep ".php$")
phpcs -p -s -v --standard=$phpcs_standard $(git status --porcelain | egrep "^[MARC]" | cut -c4- | egrep ".php$")
else
echo "Skipping phpcs since not installed"
fi
Expand Down

0 comments on commit 0ae29af

Please sign in to comment.