Skip to content

Commit

Permalink
[CI] Make format checker error message more user-friendly by using em…
Browse files Browse the repository at this point in the history
…oji (#9564)

This PR makes format checker error message more user-friendly by adding emojis.
  • Loading branch information
KuntaiDu authored Oct 21, 2024
1 parent 711f3a7 commit 575dceb
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,20 @@ builtin cd "$(dirname "${BASH_SOURCE:-$0}")"
ROOT="$(git rev-parse --show-toplevel)"
builtin cd "$ROOT" || exit 1

check_command() {
if ! command -v "$1" &> /dev/null; then
echo "❓❓$1 is not installed, please run \`pip install -r requirements-lint.txt\`"
exit 1
fi
}

check_command yapf
check_command ruff
check_command mypy
check_command codespell
check_command isort
check_command clang-format

YAPF_VERSION=$(yapf --version | awk '{print $2}')
RUFF_VERSION=$(ruff --version | awk '{print $2}')
MYPY_VERSION=$(mypy --version | awk '{print $2}')
Expand All @@ -31,7 +45,7 @@ CLANGFORMAT_VERSION=$(clang-format --version | awk '{print $3}')
# # params: tool name, tool version, required version
tool_version_check() {
if [[ $2 != $3 ]]; then
echo "Wrong $1 version installed: $3 is required, not $2."
echo "❓❓Wrong $1 version installed: $3 is required, not $2."
exit 1
fi
}
Expand Down Expand Up @@ -281,10 +295,12 @@ tools/actionlint.sh -color
echo 'vLLM actionlint: Done'

if ! git diff --quiet &>/dev/null; then
echo 'Reformatted files. Please review and stage the changes.'
echo 'Changes not staged for commit:'
echo
echo
echo "🔍🔍There are files changed by the format checker or by you that are not added and committed:"
git --no-pager diff --name-only
echo "🔍🔍Format checker passed, but please add, commit and push all the files above to include changes made by the format checker."

exit 1
else
echo "✨🎉 Format check passed! Congratulations! 🎉✨"
fi

0 comments on commit 575dceb

Please sign in to comment.