Created
June 21, 2021 09:25
-
-
Save takada-at/678ed712a01709cfc517872fe119af70 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 | |
set -eu | |
EXIT_CODE=0 | |
# `check $FILE_PATH $MESSAGE`: $FILE_PATH が存在してたら表示して EXIT_CODE を 1 に設定 | |
function check () { | |
if [ -s $1 ]; then | |
echo $2 | |
cat $1 | |
EXIT_CODE=1 | |
fi | |
} | |
rm -rf data/black.txt | |
black --check notes_generator 2>&1 1>/dev/null | grep "would reformat" > data/black.txt || true | |
black --check scripts 2>&1 1>/dev/null | grep "would reformat" >> data/black.txt || true | |
black --check tests 2>&1 1>/dev/null | grep "would reformat" >> data/black.txt || true | |
check data/black.txt '[check black]' | |
test $EXIT_CODE -eq 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment