Skip to content

Commit

Permalink
added version check for isort
Browse files Browse the repository at this point in the history
Summary: Added `isort` version check to ensure that produced formatting is compliant.

Reviewed By: ppwwyyxx

Differential Revision: D19421825

fbshipit-source-id: 51b8c113e09a1cc233f631f3cd4b1bdc485c4652
  • Loading branch information
vkhalidov authored and facebook-github-bot committed Jan 16, 2020
1 parent 38c5357 commit 13fb72f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions dev/linter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,24 @@

# Run this script at project root by "./dev/linter.sh" before you commit

vergte() {
[ "$2" = "$(echo -e "$1\n$2" | sort -V | head -n1)" ]
}

{
black --version | grep "19.3b0" > /dev/null
} || {
echo "Linter requires black==19.3b0 !"
exit 1
}

ISORT_TARGET_VERSION="4.3.21"
ISORT_VERSION=$(isort -v | grep VERSION | awk '{print $2}')
vergte "$ISORT_VERSION" "$ISORT_TARGET_VERSION" || {
echo "Linter requires isort>=${ISORT_TARGET_VERSION} !"
exit 1
}

set -v

echo "Running isort ..."
Expand Down

0 comments on commit 13fb72f

Please sign in to comment.