diff --git a/dev/linter.sh b/dev/linter.sh index 6f4cab875f..8dff44115d 100755 --- a/dev/linter.sh +++ b/dev/linter.sh @@ -3,6 +3,10 @@ # 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 } || { @@ -10,6 +14,13 @@ 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 ..."