refactor: split opencode runtime and tests #17

Merged
masi merged 2 commits from refactor/split-opencode-modules into main 2026-09-01 03:35:19 +00:00
Showing only changes of commit e6cb7d01a6 - Show all commits
-12
View File
@@ -55,18 +55,6 @@ def default_reviewers() -> list[ReviewerSpec]:
] ]
def _coerce_str(v, default: str = "") -> str:
return str(v).strip() if isinstance(v, (str, int, float)) else default
def _coerce_int(v, default: int, lo: int, hi: int) -> int:
try:
n = int(v)
except (TypeError, ValueError):
return default
return max(lo, min(hi, n))
def parse_reviewers_config(raw: dict) -> list[ReviewerSpec]: def parse_reviewers_config(raw: dict) -> list[ReviewerSpec]:
masi marked this conversation as resolved
Review

🟡 [MEDIUM] _coerce_str is defined twice in this module — lines 29-30 and lines 58-59. The second definition shadows the first with an identical implementation. Same applies to _coerce_int at lines 33-38 and 62-67. This is a merge artifact that leaves dead code and could confuse future maintainers about which definition is authoritative.

Fix: Remove the duplicate definitions at lines 58-67; keep the first definitions at lines 29-38.

def _coerce_str(v, default: str = "") -> str:
    return str(v).strip() if isinstance(v, (str, int, float)) else default


def _coerce_int(v, default: int, lo: int, hi: int) -> int:
    try:
        n = int(v)
    except (TypeError, ValueError):
        return default
    return max(lo, min(hi, n))

🪙 ~9,003 (9.0K) tok (100% · attributed output)

🟡 [MEDIUM] _coerce_str is defined twice in this module — lines 29-30 and lines 58-59. The second definition shadows the first with an identical implementation. Same applies to _coerce_int at lines 33-38 and 62-67. This is a merge artifact that leaves dead code and could confuse future maintainers about which definition is authoritative. **Fix:** Remove the duplicate definitions at lines 58-67; keep the first definitions at lines 29-38. ```suggestion def _coerce_str(v, default: str = "") -> str: return str(v).strip() if isinstance(v, (str, int, float)) else default def _coerce_int(v, default: int, lo: int, hi: int) -> int: try: n = int(v) except (TypeError, ValueError): return default return max(lo, min(hi, n)) ``` 🪙 ~9,003 (9.0K) tok (100% · attributed output)
"""Read `.pr-review.json:reviewers[]` into `list[ReviewerSpec]`. """Read `.pr-review.json:reviewers[]` into `list[ReviewerSpec]`.