mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-09-30 09:02:31 +01:00
Initial commit of open source Workload Automation.
This commit is contained in:
47
dev_scripts/pylint
Executable file
47
dev_scripts/pylint
Executable file
@@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
pylint_version=$(python -c 'from pylint.__pkginfo__ import version; print version')
|
||||
compare_versions $pylint_version "1.3.0"
|
||||
result=$?
|
||||
if [ "$result" == "2" ]; then
|
||||
echo "ERROR: pylint version must be at least 1.3.0; found $pylint_version"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
THIS_DIR="`dirname \"$0\"`"
|
||||
if [[ "$target" == "" ]]; then
|
||||
pushd $THIS_DIR/.. > /dev/null
|
||||
pylint --rcfile extras/pylintrc wlauto
|
||||
popd > /dev/null
|
||||
else
|
||||
pylint --rcfile $THIS_DIR/../extras/pylintrc $target
|
||||
fi
|
Reference in New Issue
Block a user