|
|
@ -91,18 +91,19 @@ class ComplexFunction(AbstractDetector): |
|
|
|
func, cause = issue.values() |
|
|
|
func, cause = issue.values() |
|
|
|
func_name = func.name |
|
|
|
func_name = func.name |
|
|
|
|
|
|
|
|
|
|
|
txt = "Complex function in {} Contract: {}, Function: {}" |
|
|
|
txt = "Complex function in {}\n\t- {}.{} ({})\n" |
|
|
|
|
|
|
|
|
|
|
|
if cause == self.CAUSE_EXTERNAL_CALL: |
|
|
|
if cause == self.CAUSE_EXTERNAL_CALL: |
|
|
|
txt += ", Reason: High number of external calls" |
|
|
|
txt += "\t- Reason: High number of external calls" |
|
|
|
if cause == self.CAUSE_CYCLOMATIC: |
|
|
|
if cause == self.CAUSE_CYCLOMATIC: |
|
|
|
txt += ", Reason: High number of branches" |
|
|
|
txt += "\t- Reason: High number of branches" |
|
|
|
if cause == self.CAUSE_STATE_VARS: |
|
|
|
if cause == self.CAUSE_STATE_VARS: |
|
|
|
txt += ", Reason: High number of modified state variables" |
|
|
|
txt += "\t- Reason: High number of modified state variables" |
|
|
|
|
|
|
|
|
|
|
|
info = txt.format(self.filename, |
|
|
|
info = txt.format(self.filename, |
|
|
|
contract.name, |
|
|
|
contract.name, |
|
|
|
func_name) |
|
|
|
func_name, |
|
|
|
|
|
|
|
func.source_mapping_str) |
|
|
|
self.log(info) |
|
|
|
self.log(info) |
|
|
|
|
|
|
|
|
|
|
|
results.append({'vuln': 'ComplexFunc', |
|
|
|
results.append({'vuln': 'ComplexFunc', |
|
|
|