cloudformation-plus-plus: cfn template preprocessor
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

32 lines
691 B

#!/usr/bin/env bash
CURRENT_DIRECTORY=`pwd`
GIT_HOOKS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PROJECT_DIRECTORY="$GIT_HOOKS_DIR/../.."
cd $PROJECT_DIRECTORY;
echo "Running php-cs-fixer to format the code..."
PHP_CS_FIXER="vendor/bin/php-cs-fixer"
HAS_PHP_CS_FIXER=false
if [ -x "$PHP_CS_FIXER" ]; then
HAS_PHP_CS_FIXER=true
fi
if $HAS_PHP_CS_FIXER; then
git status --porcelain | grep -e '^[AM]\(.*\).php$' | cut -c 3- | while read line; do
${PHP_CS_FIXER} fix --config=.php_cs.dist -q --allow-risky=yes ${line};
git add "$line";
done
else
echo ""
echo "Please run `composer install` to include php-cs-fixer."
echo ""
fi
cd $CURRENT_DIRECTORY;
echo "Done."