From 5de23602fb814b1c85807fd1d04654f97f8a87db Mon Sep 17 00:00:00 2001 From: Ngalim Siregar Date: Sun, 31 Mar 2024 19:40:12 +0700 Subject: [PATCH] Filter name-reused detector to only run on Truffle projects (#2390) --- slither/detectors/slither/name_reused.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/slither/detectors/slither/name_reused.py b/slither/detectors/slither/name_reused.py index babce6389f..ca5b7cb5d9 100644 --- a/slither/detectors/slither/name_reused.py +++ b/slither/detectors/slither/name_reused.py @@ -1,6 +1,8 @@ from collections import defaultdict from typing import List +from crytic_compile.platform import Type as PlatformType + from slither.core.compilation_unit import SlitherCompilationUnit from slither.core.declarations import Contract from slither.detectors.abstract_detector import ( @@ -61,6 +63,8 @@ class NameReused(AbstractDetector): def _detect(self) -> List[Output]: results = [] compilation_unit = self.compilation_unit + if compilation_unit.core.crytic_compile.platform != PlatformType.TRUFFLE: + return [] all_contracts = compilation_unit.contracts all_contracts_name = [c.name for c in all_contracts]