55
55
from depscan .lib .logger import DEBUG , LOG , SPINNER , console , IS_CI
56
56
57
57
from reporting_lib .htmlgen import ReportGenerator
58
+
58
59
if sys .platform == "win32" and os .environ .get ("PYTHONIOENCODING" ) is None :
59
60
sys .stdin .reconfigure (encoding = "utf-8" )
60
61
sys .stdout .reconfigure (encoding = "utf-8" )
@@ -101,6 +102,7 @@ def vdr_analyze_summarize(
101
102
scoped_pkgs ,
102
103
bom_file ,
103
104
bom_dir ,
105
+ reports_dir ,
104
106
pkg_list ,
105
107
reachability_analyzer ,
106
108
reachability_options ,
@@ -116,6 +118,7 @@ def vdr_analyze_summarize(
116
118
:param scoped_pkgs: Dict containing package scopes.
117
119
:param bom_file: Single BOM file.
118
120
:param bom_dir: Directory containining bom files.
121
+ :param reports_dir: Directory containining report files.
119
122
:param pkg_list: Direct list of packages when the bom file is empty.
120
123
:param reachability_analyzer: Reachability Analyzer specified.
121
124
:param reachability_options: Reachability Analyzer options.
@@ -166,7 +169,11 @@ def vdr_analyze_summarize(
166
169
)
167
170
ds_version = get_version ()
168
171
vdr_result = VDRAnalyzer (vdr_options = options ).process ()
169
- vdr_file = bom_file .replace (".cdx.json" , ".vdr.json" ) if bom_file else None
172
+ # Set vdr_file in report folder
173
+ vdr_file = (
174
+ os .path .join (reports_dir , os .path .basename (bom_file )) if bom_file else None
175
+ )
176
+ vdr_file = vdr_file .replace (".cdx.json" , ".vdr.json" ) if vdr_file else None
170
177
if not vdr_file and bom_dir :
171
178
vdr_file = os .path .join (bom_dir , DEPSCAN_DEFAULT_VDR_FILE )
172
179
if vdr_result .success :
@@ -931,6 +938,7 @@ def run_depscan(args):
931
938
scoped_pkgs = scoped_pkgs ,
932
939
bom_file = bom_files [0 ] if len (bom_files ) == 1 else None ,
933
940
bom_dir = args .bom_dir ,
941
+ reports_dir = args .reports_dir ,
934
942
pkg_list = pkg_list ,
935
943
reachability_analyzer = reachability_analyzer ,
936
944
reachability_options = reachability_options ,
@@ -973,7 +981,11 @@ def run_depscan(args):
973
981
)
974
982
console .save_text (txt_report_file , clear = False )
975
983
# Prettify the rich html report
976
- html_report_generator = ReportGenerator (input_rich_html_path = html_report_file , report_output_path = html_report_file , raw_content = False )
984
+ html_report_generator = ReportGenerator (
985
+ input_rich_html_path = html_report_file ,
986
+ report_output_path = html_report_file ,
987
+ raw_content = False ,
988
+ )
977
989
html_report_generator .parse_and_generate_report ()
978
990
# This logic needs refactoring
979
991
# render report into template if wished
0 commit comments