Skip to content

Commit 95483f3

Browse files
committed
fix(ci): restrict SCM diffs to pull requests
1 parent 167554f commit 95483f3

2 files changed

Lines changed: 4 additions & 18 deletions

File tree

‎socketsecurity/socketcli.py‎

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,8 @@ def _select_pull_request_provider(integration_type: str, scm_type: str) -> str:
139139
return scm_type if scm_type in ("github", "gitlab") else integration_type
140140

141141

142-
def _should_create_scm_diff(
143-
event_type: str,
144-
enable_diff: bool = False,
145-
force_diff_mode: bool = False,
146-
) -> bool:
147-
return event_type == "diff" or enable_diff or force_diff_mode
142+
def _should_create_scm_diff(event_type: str) -> bool:
143+
return event_type == "diff"
148144

149145

150146
def build_socket_sdk(config: CliConfig) -> socketdev:
@@ -749,11 +745,7 @@ def _is_unprocessed(c):
749745

750746
elif scm is not None and not force_api_mode:
751747
log.info("Push initiated flow")
752-
if _should_create_scm_diff(
753-
scm_event_type,
754-
enable_diff=config.enable_diff,
755-
force_diff_mode=force_diff_mode,
756-
):
748+
if _should_create_scm_diff(scm_event_type):
757749
log.info("Starting comment logic for PR/MR event")
758750
diff = core.create_new_diff(
759751
scan_paths,

‎tests/unit/test_socketcli.py‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,10 @@ def test_scm_merge_request_event_creates_diff():
7878
assert socketcli._should_create_scm_diff("diff") is True
7979

8080

81-
def test_scm_branch_event_defaults_to_full_scan():
81+
def test_scm_branch_event_always_uses_full_scan():
8282
assert socketcli._should_create_scm_diff("main") is False
8383

8484

85-
@pytest.mark.parametrize("override", ["enable_diff", "force_diff_mode"])
86-
def test_scm_branch_event_honors_diff_override(override):
87-
options = {override: True}
88-
assert socketcli._should_create_scm_diff("main", **options) is True
89-
90-
9185
# ---------------------------------------------------------------------------
9286
# Buildkite-aware infrastructure error formatting.
9387
# ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)