| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
set -e |
| 4 |
set -u |
| 5 |
set -o pipefail |
| 6 |
|
| 7 |
cd "$(hg root)" |
| 8 |
|
| 9 |
if [[ $# -ge 1 ]] && [[ "$1" == "--import-graph" ]]; then |
| 10 |
importlab --trim --tree mercurial hgext hgext3rd hgdemandimport \ |
| 11 |
| ./contrib/import-lab-tree-color.sh |
| 12 |
exit 0 |
| 13 |
fi |
| 14 |
|
| 15 |
|
| 16 |
printf "pytype version: " |
| 17 |
pytype --version |
| 18 |
|
| 19 |
# Many of the individual files that are excluded here confuse pytype |
| 20 |
# because they do a mix of Python 2 and Python 3 things |
| 21 |
# conditionally. There's no good way to help it out with that as far as |
| 22 |
# I can tell, so let's just hide those files from it for now. We should |
| 23 |
# endeavor to empty this list out over time, as some of these are |
| 24 |
# probably hiding real problems. |
| 25 |
# |
| 26 |
# hgext/absorb.py # [attribute-error] |
| 27 |
# hgext/bugzilla.py # [pyi-error], [attribute-error] |
| 28 |
# hgext/convert/bzr.py # [attribute-error] |
| 29 |
# hgext/convert/cvs.py # [attribute-error], [wrong-arg-types] |
| 30 |
# hgext/convert/cvsps.py # [attribute-error] |
| 31 |
# hgext/convert/p4.py # [wrong-arg-types] (__file: mercurial.utils.procutil._pfile -> IO) |
| 32 |
# hgext/convert/subversion.py # [attribute-error], [name-error], [pyi-error] |
| 33 |
# hgext/fastannotate/context.py # no linelog.copyfrom() |
| 34 |
# hgext/fastannotate/formatter.py # [unsupported-operands] |
| 35 |
# hgext/fsmonitor/__init__.py # [name-error] |
| 36 |
# hgext/git/__init__.py # [attribute-error] |
| 37 |
# hgext/githelp.py # [attribute-error] [wrong-arg-types] |
| 38 |
# hgext/hgk.py # [attribute-error] |
| 39 |
# hgext/histedit.py # [attribute-error], [wrong-arg-types] |
| 40 |
# hgext/keyword.py # [attribute-error] |
| 41 |
# hgext/largefiles/storefactory.py # [attribute-error] |
| 42 |
# hgext/lfs/__init__.py # [attribute-error] |
| 43 |
# hgext/narrow/narrowbundle2.py # [attribute-error] |
| 44 |
# hgext/narrow/narrowcommands.py # [attribute-error], [name-error] |
| 45 |
# hgext/rebase.py # [attribute-error] |
| 46 |
# hgext/zeroconf/__init__.py # bytes vs str; tests fail on macOS |
| 47 |
# |
| 48 |
# mercurial/context.py # many [attribute-error] |
| 49 |
# mercurial/debugcommands.py # [wrong-arg-types] |
| 50 |
# mercurial/minirst.py # [unsupported-operands], [attribute-error] |
| 51 |
# mercurial/repoview.py # [attribute-error] |
| 52 |
# mercurial/testing/storage.py # tons of [attribute-error] |
| 53 |
# mercurial/win32.py # [not-callable] |
| 54 |
|
| 55 |
# TODO: use --no-cache on test server? Caching the files locally helps during |
| 56 |
# development, but may be a hinderance for CI testing. |
| 57 |
|
| 58 |
# TODO: include hgext and hgext3rd |
| 59 |
|
| 60 |
# use ts to produce some timing if available |
| 61 |
if ! command -v ts; then |
| 62 |
ts() { |
| 63 |
cat |
| 64 |
} |
| 65 |
fi |
| 66 |
|
| 67 |
# __version__.py is regenerated anytime we run the tests, and ⅔ of the file in |
| 68 |
# the repository indirectly rely on it. So we move its modification date back |
| 69 |
# into oblivion to let the cache do its job. |
| 70 |
# |
| 71 |
# This is not expected to be a problem as the file structure is very simple and |
| 72 |
# very seldomly changes. (Hi, to anyone reading that comment because this |
| 73 |
# eventually created problem) |
| 74 |
touch --no-create --date '2005-05-03 13:16:10' mercurial/__version__.py |
| 75 |
|
| 76 |
pytype --keep-going --jobs auto \ |
| 77 |
doc/check-seclevel.py hgdemandimport hgext mercurial \ |
| 78 |
contrib/import-checker.py \ |
| 79 |
-x hgext/absorb.py \ |
| 80 |
-x hgext/bugzilla.py \ |
| 81 |
-x hgext/convert/bzr.py \ |
| 82 |
-x hgext/convert/cvs.py \ |
| 83 |
-x hgext/convert/cvsps.py \ |
| 84 |
-x hgext/convert/p4.py \ |
| 85 |
-x hgext/convert/subversion.py \ |
| 86 |
-x hgext/fastannotate/context.py \ |
| 87 |
-x hgext/fastannotate/formatter.py \ |
| 88 |
-x hgext/fsmonitor/__init__.py \ |
| 89 |
-x hgext/git/__init__.py \ |
| 90 |
-x hgext/githelp.py \ |
| 91 |
-x hgext/hgk.py \ |
| 92 |
-x hgext/histedit.py \ |
| 93 |
-x hgext/keyword.py \ |
| 94 |
-x hgext/largefiles/storefactory.py \ |
| 95 |
-x hgext/lfs/__init__.py \ |
| 96 |
-x hgext/narrow/narrowbundle2.py \ |
| 97 |
-x hgext/narrow/narrowcommands.py \ |
| 98 |
-x hgext/rebase.py \ |
| 99 |
-x hgext/zeroconf/__init__.py \ |
| 100 |
-x mercurial/context.py \ |
| 101 |
-x mercurial/debugcommands.py \ |
| 102 |
-x mercurial/minirst.py \ |
| 103 |
-x mercurial/repoview.py \ |
| 104 |
-x mercurial/testing/storage.py \ |
| 105 |
-x mercurial/thirdparty \ |
| 106 |
-x mercurial/win32.py \ |
| 107 |
| ts -i "(%.s)" | ts -s "%.s" |
| 108 |
|
| 109 |
if find .pytype/pyi -name '*.pyi' | xargs grep -ql '# Caught error'; then |
| 110 |
echo 'pytype crashed while generating the following type stubs:' |
| 111 |
find .pytype/pyi -name '*.pyi' | xargs grep -l '# Caught error' | sort |
| 112 |
fi |