From 2aee0555b43ae733e227510fc25dc197fcc916ac Mon Sep 17 00:00:00 2001 From: Daniel Von Fange Date: Tue, 12 Nov 2024 08:57:23 -0500 Subject: [PATCH 1/2] Boxes + horizonal flow makes for more readable call graphs. --- slither/printers/call/call_graph.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/slither/printers/call/call_graph.py b/slither/printers/call/call_graph.py index 38225e6d7a..4f13a7d44b 100644 --- a/slither/printers/call/call_graph.py +++ b/slither/printers/call/call_graph.py @@ -256,6 +256,8 @@ def output(self, filename: str) -> Output: } content = "\n".join( ["strict digraph {"] + + ["rankdir=\"LR\""] + + ["node [shape=box]"] + [_process_functions(list(all_functions_as_dict.values()))] + ["}"] ) @@ -267,7 +269,11 @@ def output(self, filename: str) -> Output: with open(derived_output_filename, "w", encoding="utf8") as f: info += f"Call Graph: {derived_output_filename}\n" content = "\n".join( - ["strict digraph {"] + [_process_functions(derived_contract.functions)] + ["}"] + ["strict digraph {"] + + ["rankdir=\"LR\""] + + ["node [shape=box]"] + + [_process_functions(derived_contract.functions)] + + ["}"] ) f.write(content) results.append((derived_output_filename, content)) From ce496c73464b85051c70e87ed783752aa4ebaae7 Mon Sep 17 00:00:00 2001 From: Feist Josselin Date: Fri, 6 Dec 2024 16:50:27 +0100 Subject: [PATCH 2/2] Run black --- slither/printers/call/call_graph.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/slither/printers/call/call_graph.py b/slither/printers/call/call_graph.py index ec502d2efe..377f69ad27 100644 --- a/slither/printers/call/call_graph.py +++ b/slither/printers/call/call_graph.py @@ -257,7 +257,7 @@ def output(self, filename: str) -> Output: } content = "\n".join( ["strict digraph {"] - + ["rankdir=\"LR\""] + + ['rankdir="LR"'] + ["node [shape=box]"] + [_process_functions(list(all_functions_as_dict.values()))] + ["}"] @@ -270,10 +270,10 @@ def output(self, filename: str) -> Output: with open(derived_output_filename, "w", encoding="utf8") as f: info += f"Call Graph: {derived_output_filename}\n" content = "\n".join( - ["strict digraph {"] - + ["rankdir=\"LR\""] + ["strict digraph {"] + + ['rankdir="LR"'] + ["node [shape=box]"] - + [_process_functions(derived_contract.functions)] + + [_process_functions(derived_contract.functions)] + ["}"] ) f.write(content)