diff options
author | Pieter Wuille <pieter@wuille.net> | 2023-04-13 21:44:31 -0400 |
---|---|---|
committer | Pieter Wuille <pieter@wuille.net> | 2023-04-14 10:52:33 -0400 |
commit | 621c17869d3754559c03e4f2bee73885659e0c68 (patch) | |
tree | 8f1c82d3252578feb106579f809a2df239a64d57 /test/lint | |
parent | 719a74989be3cfbc4422ec07cac199c295d28d05 (diff) | |
download | bitcoin-621c17869d3754559c03e4f2bee73885659e0c68.tar.xz |
Respect and update FILES_ARGS in test/lint/lint-python.py
Diffstat (limited to 'test/lint')
-rwxr-xr-x | test/lint/lint-python.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/test/lint/lint-python.py b/test/lint/lint-python.py index 4ec7608708..9de13e44e2 100755 --- a/test/lint/lint-python.py +++ b/test/lint/lint-python.py @@ -15,7 +15,13 @@ import sys DEPS = ['flake8', 'mypy', 'pyzmq'] MYPY_CACHE_DIR = f"{os.getenv('BASE_ROOT_DIR', '')}/test/.mypy_cache" -FILES_ARGS = ['git', 'ls-files', 'test/functional/*.py', 'contrib/devtools/*.py'] + +# All .py files, except those in src/ (to exclude subtrees there) +FLAKE_FILES_ARGS = ['git', 'ls-files', '*.py', ':!:src/*.py'] + +# Only .py files in test/functional and contrib/devtools have type annotations +# enforced. +MYPY_FILES_ARGS = ['git', 'ls-files', 'test/functional/*.py', 'contrib/devtools/*.py'] ENABLED = ( 'E101,' # indentation contains mixed spaces and tabs @@ -107,8 +113,7 @@ def main(): if len(sys.argv) > 1: flake8_files = sys.argv[1:] else: - files_args = ['git', 'ls-files', '*.py'] - flake8_files = subprocess.check_output(files_args).decode("utf-8").splitlines() + flake8_files = subprocess.check_output(FLAKE_FILES_ARGS).decode("utf-8").splitlines() flake8_args = ['flake8', '--ignore=B,C,E,F,I,N,W', f'--select={ENABLED}'] + flake8_files flake8_env = os.environ.copy() @@ -119,7 +124,7 @@ def main(): except subprocess.CalledProcessError: exit(1) - mypy_files = subprocess.check_output(FILES_ARGS).decode("utf-8").splitlines() + mypy_files = subprocess.check_output(MYPY_FILES_ARGS).decode("utf-8").splitlines() mypy_args = ['mypy', '--show-error-codes'] + mypy_files try: |