Created
July 17, 2019 19:27
-
-
Save mbklein/018a71745cb39b94f8ebc60d8c3862fe to your computer and use it in GitHub Desktop.
Report credo exit status based on severity, not category
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 | |
###################################################### | |
# | |
# This script will take the normal credo exit code | |
# (see https://github.com/rrrene/credo#exit-status) | |
# and add 64 if any high-severity (non-strict) | |
# issues are found and 128 if any low-severity | |
# (strict) issues are found | |
# | |
tmp=$(mktemp) | |
mix credo --strict --format oneline | tee "$tmp" | |
status=${PIPESTATUS[0]} | |
if grep -qE '[↑↗→]' "$tmp"; then | |
status=$(($status + 64)) | |
elif grep -qE '[↘↓]' "$tmp"; then | |
status=$(($status + 128)) | |
fi | |
rm "$tmp" | |
exit $status |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment