Move contract analysis to Slither.__init__. Remove useless check

pull/14/head
Josselin 6 years ago
parent 16963d17b0
commit a6f08ed6aa
  1. 2
      slither/__main__.py
  2. 8
      slither/slither.py

@ -29,8 +29,6 @@ def process(filename, args, detector_classes, printer_classes):
for printer_cls in printer_classes:
slither.register_printer(printer_cls)
slither.analyze_contracts()
analyzed_contracts_count = len(slither.contracts)
results = []

@ -28,6 +28,8 @@ class Slither(SlitherSolc):
for d in stdout:
self.parse_contracts_from_json(d)
self.analyze_contracts()
def register_detector(self, detector_class):
"""
:param detector_class: Class inheriting from `AbstractDetector`.
@ -50,8 +52,6 @@ class Slither(SlitherSolc):
"""
:return: List of registered detectors results.
"""
if not self.analyzed:
raise Exception('Launch analysis first by calling {}!'.format(self.analyze_contracts.__name__))
return [d.detect() for d in self._detectors]
@ -59,14 +59,10 @@ class Slither(SlitherSolc):
"""
:return: List of registered printers outputs.
"""
if not self.analyzed:
raise Exception('Launch analysis first by calling {}!'.format(self.analyze_contracts.__name__))
return [p.output(self.filename) for p in self._printers]
def _check_common_things(self, thing_name, cls, base_cls, instances_list):
if self.analyzed:
raise Exception('There is no point of registering {} after running the analyzis.'.format(thing_name))
if not issubclass(cls, base_cls) or cls is base_cls:
raise Exception(

Loading…
Cancel
Save