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 headerpull/13100/merge
parent
991c457430
commit
14aa4e7694
|
@ -94,7 +94,9 @@ async def git():
|
|||
"""Exec git."""
|
||||
if len(sys.argv) > 2 and sys.argv[1] == '--':
|
||||
return sys.argv[2:]
|
||||
_, log = await async_exec('git', 'diff', 'upstream/dev...', '--name-only')
|
||||
_, log = await async_exec('git', 'merge-base', 'upstream/dev', 'HEAD')
|
||||
merge_base = log.splitlines()[0]
|
||||
_, log = await async_exec('git', 'diff', merge_base, '--name-only')
|
||||
return log.splitlines()
|
||||
|
||||
|
||||
|
|
10
script/lint
10
script/lint
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue