Skip to content

Commit 3478b9c

Browse files
authored
Merge pull request #2036 from tseaver/pylint-no_fallback_if_envvars_set
Drop the fallback to linting everything.
2 parents bbf5053 + c859c78 commit 3478b9c

1 file changed

Lines changed: 8 additions & 21 deletions

File tree

scripts/run_pylint.py

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -194,14 +194,11 @@ def get_python_files(all_files=None):
194194
:param all_files: Optional list of files to be linted.
195195
196196
:rtype: tuple
197-
:returns: A tuple containing two lists and a boolean. The first list
198-
contains all production files, the next all test files and
199-
the boolean indicates if a restricted fileset was used.
197+
:returns: A tuple containing two lists. The first list
198+
contains all production files, the next all test files.
200199
"""
201-
using_restricted = False
202200
if all_files is None:
203201
all_files, diff_base = get_files_for_linting()
204-
using_restricted = diff_base is not None
205202

206203
library_files = []
207204
non_library_files = []
@@ -212,7 +209,7 @@ def get_python_files(all_files=None):
212209
else:
213210
non_library_files.append(filename)
214211

215-
return library_files, non_library_files, using_restricted
212+
return library_files, non_library_files, diff_base
216213

217214

218215
def lint_fileset(filenames, rcfile, description):
@@ -244,21 +241,11 @@ def main():
244241
"""Script entry point. Lints both sets of files."""
245242
make_test_rc(PRODUCTION_RC, TEST_RC_ADDITIONS,
246243
TEST_RC_REPLACEMENTS, TEST_RC)
247-
library_files, non_library_files, using_restricted = get_python_files()
248-
try:
249-
lint_fileset(library_files, PRODUCTION_RC, 'library code')
250-
lint_fileset(non_library_files, TEST_RC, 'test code')
251-
except SystemExit:
252-
if not using_restricted:
253-
raise
254-
255-
message = 'Restricted lint failed, expanding to full fileset.'
256-
print(message, file=sys.stderr)
257-
all_files, _ = get_files_for_linting(allow_limited=False)
258-
library_files, non_library_files, _ = get_python_files(
259-
all_files=all_files)
260-
lint_fileset(library_files, PRODUCTION_RC, 'library code')
261-
lint_fileset(non_library_files, TEST_RC, 'test code')
244+
library_files, non_library_files, diff_base = get_python_files()
245+
if diff_base:
246+
print('Checking only files which differ from base.')
247+
lint_fileset(library_files, PRODUCTION_RC, 'library code')
248+
lint_fileset(non_library_files, TEST_RC, 'test code')
262249

263250

264251
if __name__ == '__main__':

0 commit comments

Comments
 (0)