From 900fda77c1fecb6d88404552b51886e29fbdd7b7 Mon Sep 17 00:00:00 2001 From: alpharush <0xalpharush@protonmail.com> Date: Wed, 5 Jun 2024 18:20:30 -0500 Subject: [PATCH 1/2] fix: sort by impact --- slither/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slither/__main__.py b/slither/__main__.py index 886d392c0..58d276e1d 100644 --- a/slither/__main__.py +++ b/slither/__main__.py @@ -239,6 +239,7 @@ def choose_detectors( set(detectors_to_run), args.detectors_to_include, detectors ) + detectors_to_run = sorted(detectors_to_run, key=lambda x: x.IMPACT) return detectors_to_run @@ -255,7 +256,6 @@ def __include_detectors( else: raise ValueError(f"Error: {detector} is not a detector") - detectors_to_run = sorted(detectors_to_run, key=lambda x: x.IMPACT) return detectors_to_run From 2e6508f28b18d6a9c88ff5c2bae8961bc9169ed7 Mon Sep 17 00:00:00 2001 From: alpharush <0xalpharush@protonmail.com> Date: Wed, 5 Jun 2024 18:20:48 -0500 Subject: [PATCH 2/2] fix: do not report libraries as dead code --- slither/detectors/functions/dead_code.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/slither/detectors/functions/dead_code.py b/slither/detectors/functions/dead_code.py index 98eb97ff7..7a2c6dbc4 100644 --- a/slither/detectors/functions/dead_code.py +++ b/slither/detectors/functions/dead_code.py @@ -71,9 +71,10 @@ contract Contract{ continue if isinstance(function, FunctionContract) and ( function.contract_declarer.is_from_dependency() + or function.contract_declarer.is_library ): continue - # Continue if the functon is not implemented because it means the contract is abstract + # Continue if the function is not implemented because it means the contract is abstract if not function.is_implemented: continue info: DETECTOR_INFO = [function, " is never used and should be removed\n"]