|
|
@ -69,6 +69,14 @@ BLACKLIST_IMPORTS = {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ReporterEncoder(json.JSONEncoder):
|
|
|
|
|
|
|
|
def default(self, o):
|
|
|
|
|
|
|
|
if isinstance(o, Exception):
|
|
|
|
|
|
|
|
return str(o)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return json.JSONEncoder.default(self, o)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Reporter(object):
|
|
|
|
class Reporter(object):
|
|
|
|
@staticmethod
|
|
|
|
@staticmethod
|
|
|
|
@contextmanager
|
|
|
|
@contextmanager
|
|
|
@ -135,7 +143,7 @@ class Reporter(object):
|
|
|
|
ret = [len(r['errors']) for _, r in reports.items()]
|
|
|
|
ret = [len(r['errors']) for _, r in reports.items()]
|
|
|
|
|
|
|
|
|
|
|
|
with Reporter._output_handle(output) as handle:
|
|
|
|
with Reporter._output_handle(output) as handle:
|
|
|
|
print(json.dumps(Reporter._filter_out_ok(reports), indent=4), file=handle)
|
|
|
|
print(json.dumps(Reporter._filter_out_ok(reports), indent=4, cls=ReporterEncoder), file=handle)
|
|
|
|
|
|
|
|
|
|
|
|
return 3 if sum(ret) else 0
|
|
|
|
return 3 if sum(ret) else 0
|
|
|
|
|
|
|
|
|
|
|
@ -505,7 +513,6 @@ class ModuleValidator(Validator):
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
self.warnings.append(msg)
|
|
|
|
self.warnings.append(msg)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _find_ps_replacers(self):
|
|
|
|
def _find_ps_replacers(self):
|
|
|
|
if 'WANT_JSON' not in self.text:
|
|
|
|
if 'WANT_JSON' not in self.text:
|
|
|
|
self.errors.append((206, 'WANT_JSON not found in module'))
|
|
|
|
self.errors.append((206, 'WANT_JSON not found in module'))
|
|
|
|