diff --git a/valkyrie/core/formatters/__init__.py b/valkyrie/core/formatters/__init__.py new file mode 100644 index 0000000..d850010 --- /dev/null +++ b/valkyrie/core/formatters/__init__.py @@ -0,0 +1,7 @@ +from .base import ResultFormatter +from .sarif import SARIFFormatter + +__all__ = [ + ResultFormatter, + SARIFFormatter +] \ No newline at end of file diff --git a/valkyrie/core/formatters/html.py b/valkyrie/core/formatters/html.py new file mode 100644 index 0000000..65daa74 --- /dev/null +++ b/valkyrie/core/formatters/html.py @@ -0,0 +1,134 @@ +""" +Valkyrie - HTML Scan Result Formatter +""" + +from valkyrie.core.types import ( + SeverityLevel, ScanResult, ScanStatus +) + +from .base import ResultFormatter + + +#### +## HTML SCAN RESUT FORMATTER +##### +class HTMLFormatter(ResultFormatter): + """HTML report formatter""" + + def format(self, result: ScanResult) -> str: + """Format results as HTML report""" + + html = f""" + + +
+ + +Scan completed on {result.timestamp.strftime('%Y-%m-%d %H:%M:%S')}
+Duration: {result.scan_duration:.2f}s | Files scanned: {len(result.scanned_files)}
+Check logs for details
Total Issues
+Critical
+High
+Medium
+Low
+All scanned files are secure.
{finding.description}
+ {f'Remediation: {finding.remediation_advice}
' if finding.remediation_advice else ''} +Rule ID: {finding.rule_id} | Confidence: {finding.confidence:.1%}
+