Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions commit_check/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@
from commit_check import RED, GREEN, YELLOW, RESET_COLOR


def _find_check(checks: list, check_type: str) -> dict | None:
"""Return the first check dict matching check_type, else None."""
for check in checks:
if check.get("check") == check_type:
return check
return None


def _print_failure(
check: dict,
actual: str,
Expand Down
27 changes: 0 additions & 27 deletions tests/util_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
print_error_header,
print_error_message,
print_suggestion,
_find_check,
)
from subprocess import CalledProcessError, PIPE
from unittest.mock import MagicMock
Expand Down Expand Up @@ -615,32 +614,6 @@ def test_print_suggestion_exit1(self, capfd):
stdout, _ = capfd.readouterr()
assert "commit-check does not support" in stdout

class TestHelperFunctions:
"""Tests for utility helper functions to improve coverage."""

def test_find_check_found(self):
"""Test _find_check when check is found."""
checks = [
{"check": "commit-message", "regex": ".*"},
{"check": "branch-name", "regex": ".*"},
]
result = _find_check(checks, "commit-message")
assert result == {"check": "commit-message", "regex": ".*"}

def test_find_check_not_found(self):
"""Test _find_check when check is not found."""
checks = [
{"check": "commit-message", "regex": ".*"},
]
result = _find_check(checks, "author-name")
assert result is None

def test_find_check_empty_list(self):
"""Test _find_check with empty list."""
checks = []
result = _find_check(checks, "commit-message")
assert result is None


class TestGetGitConfigValue:
"""Tests for get_git_config_value utility function."""
Expand Down