* Also lint working tree files When performing a git diff of upstream/dev..., git is diffing against the current HEAD, but does not include working tree files. By manually calculating a merge-base SHA to diff against, git will still diff those files. * Don't pylint tests files, since we don't in CI * Use merge base for lazytox * Simplify files changed header
23 lines
687 B
Bash
Executable file
23 lines
687 B
Bash
Executable file
#!/bin/sh
|
|
# Execute lint to spot code mistakes.
|
|
|
|
cd "$(dirname "$0")/.."
|
|
|
|
export files="$(git diff $(git merge-base upstream/dev HEAD) --diff-filter=d --name-only | grep -e '\.py$')"
|
|
echo '================================================='
|
|
echo '= FILES CHANGED ='
|
|
echo '================================================='
|
|
if [ -z "$files" ] ; then
|
|
echo "No python file changed. Rather use: tox -e lint"
|
|
exit
|
|
fi
|
|
printf "%s\n" $files
|
|
echo "================"
|
|
echo "LINT with flake8"
|
|
echo "================"
|
|
flake8 --doctests $files
|
|
echo "================"
|
|
echo "LINT with pylint"
|
|
echo "================"
|
|
pylint $(echo "$files" | grep -v '^tests.*')
|
|
echo
|