2016-02-13 19:56:32 -05:00
|
|
|
#!/bin/sh
|
2017-01-02 22:04:09 +01:00
|
|
|
# Execute lint to spot code mistakes.
|
2015-09-17 00:35:26 -07:00
|
|
|
|
2017-01-05 09:45:14 +01:00
|
|
|
cd "$(dirname "$0")/.."
|
|
|
|
|
2018-03-11 16:15:09 -04:00
|
|
|
export files="$(git diff $(git merge-base upstream/dev HEAD) --diff-filter=d --name-only | grep -e '\.py$')"
|
|
|
|
echo '================================================='
|
|
|
|
echo '= FILES CHANGED ='
|
|
|
|
echo '================================================='
|
2018-03-09 22:27:39 +02:00
|
|
|
if [ -z "$files" ] ; then
|
|
|
|
echo "No python file changed. Rather use: tox -e lint"
|
|
|
|
exit
|
2016-08-23 05:52:31 +02:00
|
|
|
fi
|
2018-03-09 22:27:39 +02:00
|
|
|
printf "%s\n" $files
|
|
|
|
echo "================"
|
|
|
|
echo "LINT with flake8"
|
|
|
|
echo "================"
|
|
|
|
flake8 --doctests $files
|
|
|
|
echo "================"
|
|
|
|
echo "LINT with pylint"
|
|
|
|
echo "================"
|
2018-03-11 16:15:09 -04:00
|
|
|
pylint $(echo "$files" | grep -v '^tests.*')
|
2018-03-09 22:27:39 +02:00
|
|
|
echo
|