@@ -70,15 +70,15 @@ def run_scan(path_to_scan, output_file_name="",
7070 start_time = datetime .now ().strftime ('%Y%m%d_%H%M%S' )
7171
7272 if output_file_name == "" :
73- output_file = "FOSSLight-Report_" + start_time
74- output_json_file = "scancode_" + start_time
73+ output_file = f "FOSSLight-Report_{ start_time } "
74+ output_json_file = f "scancode_{ start_time } "
7575 output_dir = os .getcwd ()
7676 else :
7777 output_file = output_file_name
7878 output_json_file = output_file_name
7979 output_dir = os .path .dirname (os .path .abspath (output_file_name ))
8080
81- logger , _result_log = init_log (os .path .join (output_dir , "fosslight_src_log_" + start_time + " .txt" ),
81+ logger , _result_log = init_log (os .path .join (output_dir , f "fosslight_src_log_{ start_time } .txt" ),
8282 True , logging .INFO , logging .DEBUG , _PKG_NAME , path_to_scan )
8383
8484 if path_to_scan == "" :
@@ -91,7 +91,7 @@ def run_scan(path_to_scan, output_file_name="",
9191
9292 if os .path .isdir (path_to_scan ):
9393 try :
94- output_json_file = output_json_file + " .json" if _write_json_file \
94+ output_json_file = f" { output_json_file } .json" if _write_json_file \
9595 else ""
9696
9797 rc , results = cli .run_scan (path_to_scan , max_depth = 100 ,
@@ -127,16 +127,16 @@ def run_scan(path_to_scan, output_file_name="",
127127
128128 success_to_write , writing_msg = write_excel_and_csv (
129129 output_file , sheet_list )
130- logger .info ("Writing excel :" + str ( success_to_write ) + " " + writing_msg )
130+ logger .info (f "Writing excel : { success_to_write } { writing_msg } " )
131131 if success_to_write :
132- _result_log ["FOSSLight Report" ] = output_file + " .xlsx"
132+ _result_log ["FOSSLight Report" ] = f" { output_file } .xlsx"
133133 except Exception as ex :
134134 success = False
135135 msg = str (ex )
136- logger .error ("Analyze " + path_to_scan + ":" + msg )
136+ logger .error (f "Analyze { path_to_scan } : { msg } " )
137137 else :
138138 success = False
139- msg = "Check the path to scan. :" + path_to_scan
139+ msg = f "Check the path to scan. : { path_to_scan } "
140140
141141 if not return_results :
142142 result_list = []
@@ -148,7 +148,7 @@ def run_scan(path_to_scan, output_file_name="",
148148 _str_final_result_log = yaml .safe_dump (_result_log , allow_unicode = True , sort_keys = True )
149149 logger .info (_str_final_result_log )
150150 except Exception as ex :
151- logger .warning ("Failed to print result log. " + str ( ex ) )
151+ logger .warning (f "Failed to print result log. { ex } " )
152152 return success , _result_log ["Scan Result" ], result_list
153153
154154
0 commit comments