hass-core/script/lint
cdce8p 17ba813a6d
Changed default from all to changed (#12660)
* Default option now '--changed'
* to check all files, use: '--all' or 'tox -e lint'
2018-03-01 18:02:19 +01:00

27 lines
683 B
Bash
Executable file

#!/bin/sh
# Execute lint to spot code mistakes.
cd "$(dirname "$0")/.."
if [ "$1" = "--all" ]; then
tox -e lint
else
export files="`git diff upstream/dev... --name-only | grep -e '\.py$'`"
echo "================================================="
echo "FILES CHANGED (git diff upstream/dev... --name-only)"
echo "================================================="
if [ -z "$files" ] ; then
echo "No python file changed"
exit
fi
printf "%s\n" $files
echo "================"
echo "LINT with flake8"
echo "================"
flake8 --doctests $files
echo "================"
echo "LINT with pylint"
echo "================"
pylint $files
echo
fi