2016-02-14 00:56:32 +00:00
|
|
|
#!/bin/sh
|
2017-01-02 21:04:09 +00:00
|
|
|
# Execute lint to spot code mistakes.
|
2015-09-17 07:35:26 +00:00
|
|
|
|
2017-01-05 08:45:14 +00:00
|
|
|
cd "$(dirname "$0")/.."
|
|
|
|
|
2018-03-01 17:02:19 +00:00
|
|
|
if [ "$1" = "--all" ]; then
|
|
|
|
tox -e lint
|
|
|
|
else
|
2018-02-22 23:22:59 +00:00
|
|
|
export files="`git diff upstream/dev... --name-only | grep -e '\.py$'`"
|
2016-08-23 03:52:31 +00:00
|
|
|
echo "================================================="
|
2018-02-22 23:22:59 +00:00
|
|
|
echo "FILES CHANGED (git diff upstream/dev... --name-only)"
|
2016-08-23 03:52:31 +00:00
|
|
|
echo "================================================="
|
2018-02-25 03:11:49 +00:00
|
|
|
if [ -z "$files" ] ; then
|
2018-02-22 23:22:59 +00:00
|
|
|
echo "No python file changed"
|
|
|
|
exit
|
|
|
|
fi
|
2018-02-15 06:01:30 +00:00
|
|
|
printf "%s\n" $files
|
2016-08-23 03:52:31 +00:00
|
|
|
echo "================"
|
|
|
|
echo "LINT with flake8"
|
|
|
|
echo "================"
|
|
|
|
flake8 --doctests $files
|
|
|
|
echo "================"
|
|
|
|
echo "LINT with pylint"
|
|
|
|
echo "================"
|
|
|
|
pylint $files
|
|
|
|
echo
|
|
|
|
fi
|