mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-08 14:04:16 +00:00
Preserve checkers which will not be processed
Ensure that errors captured during the creation of checkers, for instance a non existent file or directory, are preserved and reported.
This commit is contained in:
parent
9631dac52a
commit
7ef431e089
1 changed files with 12 additions and 4 deletions
|
|
@ -76,6 +76,7 @@ class Manager(object):
|
||||||
self.using_multiprocessing = self.jobs > 1
|
self.using_multiprocessing = self.jobs > 1
|
||||||
self.processes = []
|
self.processes = []
|
||||||
self.checkers = []
|
self.checkers = []
|
||||||
|
self.unprocessed_checkers = []
|
||||||
self.statistics = {
|
self.statistics = {
|
||||||
'files': 0,
|
'files': 0,
|
||||||
'logical lines': 0,
|
'logical lines': 0,
|
||||||
|
|
@ -231,9 +232,16 @@ class Manager(object):
|
||||||
self.is_path_excluded)
|
self.is_path_excluded)
|
||||||
if should_create_file_checker(filename, argument)
|
if should_create_file_checker(filename, argument)
|
||||||
)
|
)
|
||||||
self.checkers = [
|
# errors may already have been captured during checker set up,
|
||||||
checker for checker in checkers if checker.should_process
|
# preserve these malfunctioning checkers in a separate list so reports
|
||||||
]
|
# can be generated
|
||||||
|
self.checkers = []
|
||||||
|
self.unprocessed_checkers = []
|
||||||
|
for checker in checkers:
|
||||||
|
if checker.should_process:
|
||||||
|
self.checkers.append(checker)
|
||||||
|
else:
|
||||||
|
self.unprocessed_checkers.append(checker)
|
||||||
LOG.info('Checking %d files', len(self.checkers))
|
LOG.info('Checking %d files', len(self.checkers))
|
||||||
|
|
||||||
def report(self):
|
def report(self):
|
||||||
|
|
@ -249,7 +257,7 @@ class Manager(object):
|
||||||
tuple(int, int)
|
tuple(int, int)
|
||||||
"""
|
"""
|
||||||
results_reported = results_found = 0
|
results_reported = results_found = 0
|
||||||
for checker in self.checkers:
|
for checker in self.checkers + self.unprocessed_checkers:
|
||||||
results = sorted(checker.results, key=lambda tup: (tup[1], tup[2]))
|
results = sorted(checker.results, key=lambda tup: (tup[1], tup[2]))
|
||||||
filename = checker.display_name
|
filename = checker.display_name
|
||||||
with self.style_guide.processing_file(filename):
|
with self.style_guide.processing_file(filename):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue