@@ -98,12 +98,21 @@ def set_issue_detected_by_scan_results(context: click.Context, scan_results: Lis
9898    set_issue_detected (context , any (scan_result .issue_detected  for  scan_result  in  scan_results ))
9999
100100
101- def  _should_use_scan_service (scan_type : str , scan_parameters : Optional [ dict ]  =   None ) ->  bool :
102-     return  scan_type  ==  consts .SECRET_SCAN_TYPE  and  scan_parameters   is   not   None   and   scan_parameters [ 'report' ]  is  True 
101+ def  _should_use_scan_service (scan_type : str , scan_parameters : dict ) ->  bool :
102+     return  scan_type  ==  consts .SECRET_SCAN_TYPE  and  scan_parameters . get ( 'report' )  is  True 
103103
104104
105- def  _should_use_sync_flow (scan_type : str , sync_options : bool , scan_parameters : Optional [dict ] =  None ) ->  bool :
106-     return  sync_options  and  scan_type  ==  consts .SCA_SCAN_TYPE  and  scan_parameters .get ('report' ) is  not True 
105+ def  _should_use_sync_flow (scan_type : str , sync_option : bool , scan_parameters : Optional [dict ] =  None ) ->  bool :
106+     if  not  sync_option :
107+         return  False 
108+ 
109+     if  scan_type  not  in consts .SCA_SCAN_TYPE ,):
110+         raise  ValueError (f'Sync scan is not available for { scan_type }  )
111+ 
112+     if  scan_parameters .get ('report' ) is  True :
113+         raise  ValueError ('You can not use sync flow with report option. Either remove "report" or "sync" option.' )
114+ 
115+     return  True 
107116
108117
109118def  _enrich_scan_result_with_data_from_detection_rules (
@@ -156,6 +165,7 @@ def _scan_batch_thread_func(batch: List[Document]) -> Tuple[str, CliError, Local
156165
157166        scan_id  =  str (_generate_unique_id ())
158167        scan_completed  =  False 
168+ 
159169        should_use_scan_service  =  _should_use_scan_service (scan_type , scan_parameters )
160170        should_use_sync_flow  =  _should_use_sync_flow (scan_type , sync_option , scan_parameters )
161171
0 commit comments