Skip to content

Commit 85dc362

Browse files
committed
📜Improve markdown support
1 parent b5729dd commit 85dc362

22 files changed

+222
-41
lines changed

templates/main_template.html renamed to html_templates/main_template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ <h1>Audit Report</h1>
1313
</div>
1414
{% endfor %}
1515
</body>
16-
</html>
16+
</html>

templates/modules/mypy_report_template.html renamed to html_templates/modules/mypy_report_template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,4 @@ <h3>Categories with most messages</h3>
5858
{% endfor %}
5959
</tbody>
6060
</table>
61-
</section>
61+
</section>

markdown_templates/main_template.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Audit Report
2+
3+
**Project:** {{ project_name }}
4+
5+
**Date:** {{ audit_date }}
6+
7+
{% for name, report_markdown in reports.items() %}
8+
9+
{{ report_markdown }}
10+
11+
{% endfor %}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
## Bandit Security Report
2+
3+
### Report Summary
4+
Report generated at: {{ data.vulnerabilities.generated_at }}
5+
Total number of files analyzed: {{ data.vulnerabilities.metrics | length }}
6+
7+
### Error Details
8+
{% if data.vulnerabilities.errors %}
9+
{% for error in data.vulnerabilities.errors %}
10+
- {{ error }}
11+
{% endfor %}
12+
{% else %}
13+
No errors found.
14+
{% endif %}
15+
16+
### Metrics Summary
17+
18+
| File | LOC | High Confidence | Medium Confidence | Low Confidence | Undefined Confidence | High Severity | Medium Severity | Low Severity | Undefined Severity | NoSec | Skipped Tests |
19+
|------|-----|-----------------|-------------------|----------------|----------------------|---------------|-----------------|--------------|--------------------|-------|---------------|
20+
{% for file_path, metric in data.vulnerabilities.metrics.items() -%}
21+
| {{ file_path }} | {{ metric.loc }} | {{ metric.CONFIDENCE_HIGH }} | {{ metric.CONFIDENCE_MEDIUM }} | {{ metric.CONFIDENCE_LOW }} | {{ metric.CONFIDENCE_UNDEFINED }} | {{ metric.SEVERITY_HIGH }} | {{ metric.SEVERITY_MEDIUM }} | {{ metric.SEVERITY_LOW }} | {{ metric.SEVERITY_UNDEFINED }} | {{ metric.nosec }} | {{ metric.skipped_tests }} |
22+
{% endfor -%}
23+
24+
### Detailed Findings
25+
{% for result in data.vulnerabilities.results %}
26+
#### Issue in File: {{ result.filename }} at line: {{ result.line_number }}
27+
**Issue Severity:** {{ result.issue_severity }}
28+
**Issue Confidence:** {{ result.issue_confidence }}
29+
**CWE ID:** [CWE-{{ result.issue_cwe.id }}]({{ result.issue_cwe.link }})
30+
**Issue Description:** {{ result.issue_text }}
31+
**Code:**
32+
33+
{{ result.code | replace('\n', '\n ') }}
34+
35+
**More Info:** [Click here]({{ result.more_info }})
36+
**Test ID:** {{ result.test_id }}
37+
**Test Name:** {{ result.test_name }}
38+
39+
{% endfor %}

0 commit comments

Comments
 (0)