fixed call-graph printer output filename (#973)

fixed call-graph printer output filename
pull/983/head
Devashish Tomar 3 years ago committed by GitHub
parent 698387a32a
commit 3c9fbb49bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      slither/printers/call/call_graph.py

@ -218,7 +218,12 @@ class PrinterCallGraph(AbstractPrinter):
all_contracts_filename = ""
if not filename.endswith(".dot"):
all_contracts_filename = f"{filename}.all_contracts.call-graph.dot"
if filename in ("", "."):
filename = ""
else:
filename += "."
all_contracts_filename = f"{filename}all_contracts.call-graph.dot"
if filename == ".dot":
all_contracts_filename = "all_contracts.dot"
@ -227,7 +232,7 @@ class PrinterCallGraph(AbstractPrinter):
with open(all_contracts_filename, "w", encoding="utf8") as f:
info += f"Call Graph: {all_contracts_filename}\n"
# Avoid dupplicate funcitons due to different compilation unit
# Avoid duplicate functions due to different compilation unit
all_functionss = [
compilation_unit.functions for compilation_unit in self.slither.compilation_units
]
@ -242,7 +247,7 @@ class PrinterCallGraph(AbstractPrinter):
results.append((all_contracts_filename, content))
for derived_contract in self.slither.contracts_derived:
derived_output_filename = f"{filename}.{derived_contract.name}.call-graph.dot"
derived_output_filename = f"{filename}{derived_contract.name}.call-graph.dot"
with open(derived_output_filename, "w", encoding="utf8") as f:
info += f"Call Graph: {derived_output_filename}\n"
content = "\n".join(

Loading…
Cancel
Save