2015-03-10 13:09:31 +00:00
|
|
|
#!/bin/bash
|
2015-06-08 17:58:23 +01:00
|
|
|
DEFAULT_DIRS=(
|
2017-12-04 17:13:56 +00:00
|
|
|
wa
|
2015-06-08 17:58:23 +01:00
|
|
|
)
|
|
|
|
|
2015-03-10 13:09:31 +00:00
|
|
|
target=$1
|
|
|
|
|
|
|
|
compare_versions() {
|
|
|
|
if [[ $1 == $2 ]]; then
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
local IFS=.
|
|
|
|
local i ver1=($1) ver2=($2)
|
|
|
|
|
|
|
|
for ((i=${#ver1[@]}; i<${#ver2[@]}; i++)); do
|
|
|
|
ver1[i]=0
|
|
|
|
done
|
|
|
|
|
|
|
|
for ((i=0; i<${#ver1[@]}; i++)); do
|
|
|
|
if [[ -z ${ver2[i]} ]]; then
|
|
|
|
ver2[i]=0
|
|
|
|
fi
|
|
|
|
if ((10#${ver1[i]} > 10#${ver2[i]})); then
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
if ((10#${ver1[i]} < 10#${ver2[i]})); then
|
|
|
|
return 2
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2018-07-10 12:19:23 +01:00
|
|
|
pylint_version=$(python -c 'from pylint.__pkginfo__ import version; print(version)' 2>/dev/null)
|
|
|
|
if [ "x$pylint_version" == "x" ]; then
|
|
|
|
pylint_version=$(python3 -c 'from pylint.__pkginfo__ import version; print(version)' 2>/dev/null)
|
|
|
|
fi
|
|
|
|
if [ "x$pylint_version" == "x" ]; then
|
|
|
|
echo "ERROR: no pylint verison found; is it installed?"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2018-07-06 10:19:36 +01:00
|
|
|
compare_versions $pylint_version "1.9.2"
|
2015-03-10 13:09:31 +00:00
|
|
|
result=$?
|
|
|
|
if [ "$result" == "2" ]; then
|
2018-07-06 10:19:36 +01:00
|
|
|
echo "ERROR: pylint version must be at least 1.9.2; found $pylint_version"
|
2015-03-10 13:09:31 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2018-07-10 12:19:23 +01:00
|
|
|
set -e
|
2015-03-10 13:09:31 +00:00
|
|
|
THIS_DIR="`dirname \"$0\"`"
|
2018-07-05 16:37:28 +01:00
|
|
|
CWD=$PWD
|
|
|
|
pushd $THIS_DIR > /dev/null
|
2015-03-10 13:09:31 +00:00
|
|
|
if [[ "$target" == "" ]]; then
|
2015-06-08 17:58:23 +01:00
|
|
|
for dir in "${DEFAULT_DIRS[@]}"; do
|
2018-07-06 10:19:36 +01:00
|
|
|
PYTHONPATH=. pylint --rcfile ../extras/pylintrc --load-plugins pylint_plugins $THIS_DIR/../$dir
|
2015-06-08 17:58:23 +01:00
|
|
|
done
|
2015-03-10 13:09:31 +00:00
|
|
|
else
|
2018-07-05 16:37:28 +01:00
|
|
|
PYTHONPATH=. pylint --rcfile ../extras/pylintrc --load-plugins pylint_plugins $CWD/$target
|
2015-03-10 13:09:31 +00:00
|
|
|
fi
|
2018-07-05 16:37:28 +01:00
|
|
|
popd > /dev/null
|