Skip to content

update register printer to consider multiple compilation units #1780

@0xalpharush

Description

@0xalpharush

register_detector applies to each compilation unit

slither/slither/slither.py

Lines 181 to 189 in 776dcab

def register_detector(self, detector_class: Type[AbstractDetector]) -> None:
"""
:param detector_class: Class inheriting from `AbstractDetector`.
"""
_check_common_things("detector", detector_class, AbstractDetector, self._detectors)
for compilation_unit in self.compilation_units:
instance = detector_class(compilation_unit, self, logger_detector)
self._detectors.append(instance)

register_printer does not and needs to be updated

slither/slither/slither.py

Lines 201 to 208 in 776dcab

def register_printer(self, printer_class: Type[AbstractPrinter]) -> None:
"""
:param printer_class: Class inheriting from `AbstractPrinter`.
"""
_check_common_things("printer", printer_class, AbstractPrinter, self._printers)
instance = printer_class(self, logger_printer)
self._printers.append(instance)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions