Merge remote-tracking branch 'crytic/slither/dev' into dev-compare-upgrades

pull/1699/head
webthethird 2 years ago
commit 6b0124c9a0
  1. 4
      slither/core/declarations/function_contract.py
  2. 17
      slither/printers/summary/function.py

@ -6,6 +6,7 @@ from typing import Dict, TYPE_CHECKING, List, Tuple
from slither.core.children.child_contract import ChildContract
from slither.core.children.child_inheritance import ChildInheritance
from slither.core.declarations import Function
from slither.utils.code_complexity import compute_cyclomatic_complexity
# pylint: disable=import-outside-toplevel,too-many-instance-attributes,too-many-statements,too-many-lines
@ -73,7 +74,7 @@ class FunctionContract(Function, ChildContract, ChildInheritance):
def get_summary(
self,
) -> Tuple[str, str, str, List[str], List[str], List[str], List[str], List[str]]:
) -> Tuple[str, str, str, List[str], List[str], List[str], List[str], List[str], int]:
"""
Return the function summary
Returns:
@ -89,6 +90,7 @@ class FunctionContract(Function, ChildContract, ChildInheritance):
[str(x) for x in self.state_variables_written],
[str(x) for x in self.internal_calls],
[str(x) for x in self.external_calls_as_expressions],
compute_cyclomatic_complexity(self),
)
# endregion

@ -48,6 +48,7 @@ class FunctionSummary(AbstractPrinter):
"Write",
"Internal Calls",
"External Calls",
"Cyclomatic Complexity",
]
)
for (
@ -59,6 +60,7 @@ class FunctionSummary(AbstractPrinter):
write,
internal_calls,
external_calls,
cyclomatic_complexity,
) in func_summaries:
read = self._convert(sorted(read))
write = self._convert(sorted(write))
@ -73,6 +75,7 @@ class FunctionSummary(AbstractPrinter):
write,
internal_calls,
external_calls,
cyclomatic_complexity,
]
)
txt += "\n \n" + str(table)
@ -84,6 +87,7 @@ class FunctionSummary(AbstractPrinter):
"Write",
"Internal Calls",
"External Calls",
"Cyclomatic Complexity",
]
)
for (
@ -95,12 +99,23 @@ class FunctionSummary(AbstractPrinter):
write,
internal_calls,
external_calls,
cyclomatic_complexity,
) in modif_summaries:
read = self._convert(sorted(read))
write = self._convert(sorted(write))
internal_calls = self._convert(sorted(internal_calls))
external_calls = self._convert(sorted(external_calls))
table.add_row([f_name, visi, read, write, internal_calls, external_calls])
table.add_row(
[
f_name,
visi,
read,
write,
internal_calls,
external_calls,
cyclomatic_complexity,
]
)
txt += "\n\n" + str(table)
txt += "\n"
self.info(txt)

Loading…
Cancel
Save