Skip to content

Commit 4d14ca5

Browse files
committed
Drop orphaned command_from_stdin helper
The code-review suggestions rewired run() to read the payload directly via payload_from_stdin/command_of/cwd_of, leaving command_from_stdin used only by its own test and its docstring describing a run() path that no longer exists. Remove it and repoint the bad-input test at payload_from_stdin, the robustness boundary both run() and the dispatcher actually use. Relates to #27
1 parent 0e927fc commit 4d14ca5

2 files changed

Lines changed: 3 additions & 8 deletions

File tree

scripts/hooks/__init__.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@ def cwd_of(payload):
3030
return payload.get("cwd") or None
3131

3232

33-
def command_from_stdin():
34-
"""The Bash command string from the payload on stdin, or '' (single-check `run` path)."""
35-
return command_of(payload_from_stdin())
36-
37-
3833
def matches(command, *words):
3934
"""True if `command` runs `words` as a whitespace-separated token sequence.
4035

tests/test_hook_reminders.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import io
22
import json
33

4-
from scripts.hooks import command_from_stdin, matches, run
4+
from scripts.hooks import matches, payload_from_stdin, run
55
from scripts.hooks import __main__ as dispatcher
66
from scripts.hooks import git_commit, issue_create, pr_create
77

@@ -48,9 +48,9 @@ def test_git_commit_threads_cwd_into_git(monkeypatch):
4848
assert seen == ["/repo/sub", "/repo/sub", "/repo/sub"]
4949

5050

51-
def test_command_from_stdin_handles_bad_input(monkeypatch):
51+
def test_payload_from_stdin_handles_bad_input(monkeypatch):
5252
monkeypatch.setattr("sys.stdin", io.StringIO("not json"))
53-
assert command_from_stdin() == ""
53+
assert payload_from_stdin() == {}
5454

5555

5656
def test_run_emits_valid_hook_json(monkeypatch):

0 commit comments

Comments
 (0)