From b1d22b19f73c9dcbc8142c9324142b6f2f0af02a Mon Sep 17 00:00:00 2001 From: penenadpi <penenadpi@gmail.com> Date: Thu, 1 Sep 2022 16:03:49 -0400 Subject: [PATCH] Refactoring and fixing code according to review comments --- src/iac_scan_runner/scan_runner.py | 4 ---- src/iac_scan_runner/utils.py | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/iac_scan_runner/scan_runner.py b/src/iac_scan_runner/scan_runner.py index 199de7d..87fbd1f 100644 --- a/src/iac_scan_runner/scan_runner.py +++ b/src/iac_scan_runner/scan_runner.py @@ -155,21 +155,17 @@ class ScanRunner: scan_output[selected_check] = check_output.to_dict() write_string_to_file(check.name, dir_name, scan_output[check.name]["output"]) self.results_summary.summarize_outcome(selected_check, scan_output[check.name]["output"], self.compatibility_matrix.scanned_files, Compatibility.compatibility_matrix) - else: non_compatible_checks.append(check.name) write_string_to_file(check.name, dir_name, "No files to scan") self.results_summary.summarize_no_files(check.name) - self.results_summary.dump_outcomes(random_uuid) self.results_summary.generate_html_prioritized(random_uuid) - else: for iac_check in self.iac_checks.values(): if iac_check.enabled: check_output = iac_check.run(self.iac_dir) scan_output[iac_check.name] = check_output.to_dict() - # TODO: Discuss the format of this output write_string_to_file( iac_check.name, dir_name, scan_output[iac_check.name]["output"] diff --git a/src/iac_scan_runner/utils.py b/src/iac_scan_runner/utils.py index b93cc2a..5ca8727 100644 --- a/src/iac_scan_runner/utils.py +++ b/src/iac_scan_runner/utils.py @@ -99,7 +99,7 @@ def write_html_to_file(file_name: str, output_value: str): raise Exception(f"Error storing HTML to file: {str(e)}.") -def file_to_string(file_path: str): +def file_to_string(file_path: str) -> str: """ Reads the file given by path and returns its contents as string output :param file_path: Path of the file -- GitLab