Skip to content

Commit

Permalink
Print format suggestions from Linter on OSS.
Browse files Browse the repository at this point in the history
Differential Revision: D54502339

Pull Request resolved: #843
  • Loading branch information
yikaiMeta authored Mar 6, 2024
1 parent 433718c commit cc9e217
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion scripts/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,23 @@ fi
CHANGED_FILES="$(git diff --name-only | grep '\.py$' | tr '\n' ' ')"
if [ "$CHANGED_FILES" != "" ]
then
RED="\e[31m"
ENDCOLOR="\e[0m"
echo "------------------------------------------"
echo -e "${RED}[format] These files are not well-formatted:${ENDCOLOR}"
git diff --name-only
echo "There are uncommitted changes on disk likely caused by the linters."
echo "------------------------------------------"
echo -e "${RED}[format] Suggested format by lint:${ENDCOLOR}"
git diff
echo "------------------------------------------"
echo "To apply the suggested format, run:"
echo "usort format <file_name>"
echo "black <file_name> -q"
echo "flake8 <file_name>"
echo -e "${RED}You must fix them before merging the pull request.${ENDCOLOR}"
# need this so that CI fails
exit 1
else
echo "All files are well-formatted."
exit 0
fi

0 comments on commit cc9e217

Please sign in to comment.