@@ -133,6 +133,14 @@ def _select_pull_request_provider(integration_type: str, scm_type: str) -> str:
133133 return scm_type if scm_type in ("github" , "gitlab" ) else integration_type
134134
135135
136+ def _should_create_scm_diff (
137+ event_type : str ,
138+ enable_diff : bool = False ,
139+ force_diff_mode : bool = False ,
140+ ) -> bool :
141+ return event_type == "diff" or enable_diff or force_diff_mode
142+
143+
136144def build_socket_sdk (config : CliConfig ) -> socketdev :
137145 cli_user_agent_string = f"SocketPythonCLI/{ config .version } "
138146 return socketdev (
@@ -680,7 +688,8 @@ def _is_unprocessed(c):
680688 return False
681689 return True
682690
683- if scm is not None and scm .check_event_type () == "comment" :
691+ scm_event_type = scm .check_event_type () if scm is not None else None
692+ if scm_event_type == "comment" :
684693 # FIXME: This entire flow should be a separate command called "filter_ignored_alerts_in_comments"
685694 # It's not related to scanning or diff generation - it just:
686695 # 1. Triggers on comments in GitHub/GitLab
@@ -734,9 +743,13 @@ def _is_unprocessed(c):
734743 else :
735744 log .info ("Ignore commands disabled (--disable-ignore), skipping comment processing" )
736745
737- elif scm is not None and scm . check_event_type () != "comment" and not force_api_mode :
746+ elif scm is not None and not force_api_mode :
738747 log .info ("Push initiated flow" )
739- if scm .check_event_type () == "diff" :
748+ if _should_create_scm_diff (
749+ scm_event_type ,
750+ enable_diff = config .enable_diff ,
751+ force_diff_mode = force_diff_mode ,
752+ ):
740753 log .info ("Starting comment logic for PR/MR event" )
741754 diff = core .create_new_diff (
742755 scan_paths ,
@@ -874,15 +887,14 @@ def _is_unprocessed(c):
874887 )
875888 else :
876889 log .info ("Starting non-PR/MR flow" )
877- diff = core .create_new_diff (
890+ diff = core .create_full_scan_with_report_url (
878891 scan_paths ,
879892 params ,
880893 no_change = should_skip_scan ,
881894 save_files_list_path = config .save_submitted_files_list ,
882895 save_manifest_tar_path = config .save_manifest_tar ,
883896 base_paths = base_paths ,
884897 explicit_files = scan_explicit_files ,
885- external_href = pr_context .url ,
886898 )
887899
888900 output_handler .handle_output (diff )
0 commit comments