Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions audit_engine/core/report_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ def __init__(self, auditor_name: str = None, contract_name: str = None):
self.audit_timestamp = self._get_current_timestamp()
self.auditor_name = auditor_name
self.contract_name = contract_name
self.recommendations = []
def add_recommendation(self, recommendation: str):
self.recommendations.append(recommendation)

def add_recommendations(self, recommendations: list):
self.recommendations.extend(recommendations)

def _get_current_timestamp(self):
return self.datetime.datetime.now().isoformat()
Expand Down Expand Up @@ -79,6 +85,7 @@ def generate_report(self) -> Dict[str, Any]:
"static_analysis": self.static_results,
"dynamic_analysis": self.dynamic_results,
"scores": self.scores,
"recommendations": self.recommendations,
}
report["summary_statistics"] = self._get_summary_statistics(report)
return report
Expand Down Expand Up @@ -109,6 +116,10 @@ def _to_markdown(self, report: Dict[str, Any]) -> str:
md += "- Severity Breakdown:\n"
for sev, count in report['summary_statistics'].get('severity_breakdown', {}).items():
md += f" - {sev}: {count}\n"
if report.get("recommendations"):
md += "\n## Recommendations / Remediation Steps\n"
for rec in report["recommendations"]:
md += f"- {rec}\n"
md += "\n## Static Analysis Findings\n"
for finding in report["static_analysis"]:
md += f"- {finding}\n"
Expand Down Expand Up @@ -138,6 +149,11 @@ def _to_html(self, report: Dict[str, Any]) -> str:
for sev, count in report['summary_statistics'].get('severity_breakdown', {}).items():
html.append(f"<li>{sev}: {count}</li>")
html.append("</ul></li></ul>")
if report.get("recommendations"):
html.append("<h2>Recommendations / Remediation Steps</h2><ul>")
for rec in report["recommendations"]:
html.append(f"<li>{rec}</li>")
html.append("</ul>")
html.append("<h2>Static Analysis Findings</h2><ul>")
for finding in report["static_analysis"]:
html.append(f"<li>{finding}</li>")
Expand Down