pull/819/head
Josselin 4 years ago
parent 6d8eb58534
commit 8d823c4b6e
  1. 8
      slither/utils/command_line.py
  2. 8
      slither/utils/output.py

@ -150,7 +150,7 @@ def output_results_to_markdown(all_results):
info = defaultdict(dict) info = defaultdict(dict)
for results in all_results: for results in all_results:
checks[results["check"]].append(results) checks[results["check"]].append(results)
info[results["check"]] = {"impact" : results["impact"], "confidence": results["confidence"]} info[results["check"]] = {"impact": results["impact"], "confidence": results["confidence"]}
print("Summary") print("Summary")
for check in checks: for check in checks:
@ -162,14 +162,12 @@ def output_results_to_markdown(all_results):
print(f'Impact: {info[check]["impact"]}') print(f'Impact: {info[check]["impact"]}')
print(f'Confidence: {info[check]["confidence"]}') print(f'Confidence: {info[check]["confidence"]}')
for result in results: for result in results:
print( print(" - [ ] ID-" + f"{counter}")
" - [ ] ID-"+f"{counter}"
)
counter = counter + 1 counter = counter + 1
print(result["markdown"]) print(result["markdown"])
if result["first_markdown_element"]: if result["first_markdown_element"]:
print(result["first_markdown_element"]) print(result["first_markdown_element"])
print('\n') print("\n")
def output_wiki(detector_classes, filter_wiki): def output_wiki(detector_classes, filter_wiki):

@ -239,11 +239,11 @@ class Output:
self._data["first_markdown_element"] = "" self._data["first_markdown_element"] = ""
self._markdown_root = markdown_root self._markdown_root = markdown_root
first_element_for_mardown = None
if info: if info:
for elem in info: for elem in info:
if not isinstance(elem, str): if not isinstance(elem, str):
first_element_for_mardown = elem self._data["first_markdown_element"] = elem
break
id_txt = "".join(_convert_to_id(d) for d in info) id_txt = "".join(_convert_to_id(d) for d in info)
self._data["id"] = hashlib.sha3_256(id_txt.encode("utf-8")).hexdigest() self._data["id"] = hashlib.sha3_256(id_txt.encode("utf-8")).hexdigest()
@ -259,7 +259,9 @@ class Output:
def add(self, add: SupportedOutput, additional_fields: Optional[Dict] = None): def add(self, add: SupportedOutput, additional_fields: Optional[Dict] = None):
if not self._data["first_markdown_element"]: if not self._data["first_markdown_element"]:
self._data["first_markdown_element"] = add.source_mapping_to_markdown(self._markdown_root) self._data["first_markdown_element"] = add.source_mapping_to_markdown(
self._markdown_root
)
if isinstance(add, Variable): if isinstance(add, Variable):
self.add_variable(add, additional_fields=additional_fields) self.add_variable(add, additional_fields=additional_fields)
elif isinstance(add, Contract): elif isinstance(add, Contract):

Loading…
Cancel
Save