Skip to content
Snippets Groups Projects
Commit 396c67e2 authored by Ondřej Borýsek's avatar Ondřej Borýsek
Browse files

Pass args as Scan2ReportConfig

parent cc753d9f
No related branches found
No related tags found
No related merge requests found
......@@ -403,22 +403,23 @@ def process_scanner_result_using_scan2report(folder_name: str) -> bool:
ps.add_msg('error', "Don't specify --output as a parameter, use selector of audit ID instead.")
return False
output_path = ps.get_result_path()
combined_args = ['--output', output_path]
if not ("-l" in args or "--lang" in args):
combined_args += ['--lang', ps.locale]
if "-l" in args or "--lang" in args:
ps.add_msg('error', "Don't specify --lang as a parameter, use selector instead.")
return False
combined_args += args + files
s2r_config = scan2report.Scan2ReportConfig()
s2r_config.lang = ps.locale
s2r_config.outfile = ps.get_result_path()
logger.debug(f"Running scan2report with: {combined_args}")
combined_args = args + files
logger.debug(f"Running scan2report with: {combined_args} and passing additional options as part of config struct")
# todo: the http connection might time out - do as async?
count_of_known_templates_before = len(TemplateScan2Report.list_files_in_locale_folder(ps.locale, original=False))
ps.set_step_status(ProcessingSteps.PREPARATIONS_FOR_SCAN2REPORT, ProcessingStatus.DONE)
ps.set_step_status(ProcessingSteps.SCAN2REPORT_FIRST_PASS, ProcessingStatus.RUNNING)
scan2report.main(combined_args, reinit_global_vars=True) # First run to generates OG templates
scan2report.main(combined_args, s2r=s2r_config) # First run to generates OG templates
# Metadata from the first load - extract the missing templates.
meta_data = ps.load_meta_file()
......@@ -441,7 +442,7 @@ def process_scanner_result_using_scan2report(folder_name: str) -> bool:
count_of_known_templates_after = len(TemplateScan2Report.list_files_in_locale_folder(ps.locale, original=False))
if count_of_known_templates_before != count_of_known_templates_after:
ps.set_step_status(ProcessingSteps.SCAN2REPORT_SECOND_PASS, ProcessingStatus.RUNNING)
scan2report.main(combined_args, reinit_global_vars=True) # Second run to regenerate the findings if during the first run we found OG templates
scan2report.main(combined_args, s2r=s2r_config) # Second run to regenerate the findings if during the first run we found OG templates
ps.set_step_status(ProcessingSteps.SCAN2REPORT_SECOND_PASS, ProcessingStatus.DONE)
else:
ps.set_step_status(ProcessingSteps.SCAN2REPORT_SECOND_PASS, ProcessingStatus.SKIPPED)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment