From 8497a60b3c4b9d8cd7fea487e97f5ebc9281b2a8 Mon Sep 17 00:00:00 2001 From: rilesdun Date: Mon, 18 Sep 2023 23:41:32 +0000 Subject: [PATCH] fix: updated conversion script fields --- .github/workflows/release.yml | 5 ++++- json_to_html.py | 22 +++++++++++++++++++--- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cc49804..27e1472 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,7 @@ -name: CI/CD Workflow +name: Semantic Release + +permissions: + contents: write on: push: diff --git a/json_to_html.py b/json_to_html.py index f68d32e..51fb1ec 100644 --- a/json_to_html.py +++ b/json_to_html.py @@ -1,5 +1,5 @@ """ -File for storing json to html formatting of bandit scans +Script to convert a JSON file bandit report to an HTML file """ import json @@ -27,18 +27,35 @@ def json_to_html(input_file, output_file): File Lines of Code Skipped Tests + Confidence High + Confidence Low + Confidence Medium + Confidence Undefined + Severity High + Severity Low + Severity Medium + Severity Undefined + Nosec """ - # Add table rows for each file's metrics for file, metrics in data['metrics'].items(): html_content += f""" {file} {metrics['loc']} {metrics['skipped_tests']} + {metrics['CONFIDENCE.HIGH']} + {metrics['CONFIDENCE.LOW']} + {metrics['CONFIDENCE.MEDIUM']} + {metrics['CONFIDENCE.UNDEFINED']} + {metrics['SEVERITY.HIGH']} + {metrics['SEVERITY.LOW']} + {metrics['SEVERITY.MEDIUM']} + {metrics['SEVERITY.UNDEFINED']} + {metrics['nosec']} """ @@ -49,7 +66,6 @@ def json_to_html(input_file, output_file): """ - # save the HTML content with open(output_file, 'w', encoding='utf-8') as f: # pylint: disable=invalid-name f.write(html_content)