Lint script tweaks (#13093)

* 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
This commit is contained in:
Adam Mills 2018-03-11 16:15:09 -04:00 committed by GitHub
parent 991c457430
commit 14aa4e7694
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View file

@ -3,10 +3,10 @@
cd "$(dirname "$0")/.."
export files="`git diff upstream/dev... --diff-filter=d --name-only | grep -e '\.py$'`"
echo "================================================="
echo "FILES CHANGED (git diff upstream/dev... --diff-filter=d --name-only)"
echo "================================================="
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
@ -19,5 +19,5 @@ flake8 --doctests $files
echo "================"
echo "LINT with pylint"
echo "================"
pylint $files
pylint $(echo "$files" | grep -v '^tests.*')
echo