Skip to content

Commit 621c178

Browse files
committed
Respect and update FILES_ARGS in test/lint/lint-python.py
1 parent 719a749 commit 621c178

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

test/lint/lint-python.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@
1515

1616
DEPS = ['flake8', 'mypy', 'pyzmq']
1717
MYPY_CACHE_DIR = f"{os.getenv('BASE_ROOT_DIR', '')}/test/.mypy_cache"
18-
FILES_ARGS = ['git', 'ls-files', 'test/functional/*.py', 'contrib/devtools/*.py']
18+
19+
# All .py files, except those in src/ (to exclude subtrees there)
20+
FLAKE_FILES_ARGS = ['git', 'ls-files', '*.py', ':!:src/*.py']
21+
22+
# Only .py files in test/functional and contrib/devtools have type annotations
23+
# enforced.
24+
MYPY_FILES_ARGS = ['git', 'ls-files', 'test/functional/*.py', 'contrib/devtools/*.py']
1925

2026
ENABLED = (
2127
'E101,' # indentation contains mixed spaces and tabs
@@ -107,8 +113,7 @@ def main():
107113
if len(sys.argv) > 1:
108114
flake8_files = sys.argv[1:]
109115
else:
110-
files_args = ['git', 'ls-files', '*.py']
111-
flake8_files = subprocess.check_output(files_args).decode("utf-8").splitlines()
116+
flake8_files = subprocess.check_output(FLAKE_FILES_ARGS).decode("utf-8").splitlines()
112117

113118
flake8_args = ['flake8', '--ignore=B,C,E,F,I,N,W', f'--select={ENABLED}'] + flake8_files
114119
flake8_env = os.environ.copy()
@@ -119,7 +124,7 @@ def main():
119124
except subprocess.CalledProcessError:
120125
exit(1)
121126

122-
mypy_files = subprocess.check_output(FILES_ARGS).decode("utf-8").splitlines()
127+
mypy_files = subprocess.check_output(MYPY_FILES_ARGS).decode("utf-8").splitlines()
123128
mypy_args = ['mypy', '--show-error-codes'] + mypy_files
124129

125130
try:

0 commit comments

Comments
 (0)