Make commit fail if formatter fails

master
Alex Selimov 11 months ago
parent 5070183726
commit e8fb49cfb4

@ -13,8 +13,11 @@ if hash black 2>/dev/null; then
# Only run if we have cached python files
if [ "$cached_files" ]; then
black --line-length 100 $cached_files
git add $cached_files
black --line-length 100 $cached_files \
&& git add $cached_files \
|| exit 1
fi
else
@ -30,8 +33,9 @@ if hash idea.sh 2>/dev/null; then
if [ "$cached_files" ]; then
idea.sh format -allowDefaults $cached_files 2>/dev/null
git add $cached_files
idea.sh format -allowDefaults $cached_files 2>/dev/null \
&& git add $cached_files \
|| exit 1
fi
else
echo "intellij isn't installed so not formatting java code"

Loading…
Cancel
Save