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
7 changes: 2 additions & 5 deletions commit_check/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def _print_failure(
print_error_header()
print_error_message(check["check"], check.get("error", ""), actual)
if check.get("suggest"):
print_suggestion(check.get("suggest"))
print_suggestion(check["suggest"])


def get_branch_name() -> str:
Expand Down Expand Up @@ -301,7 +301,7 @@ def print_error_message(check_type: str, error: str, reason: str):
print(error)


def print_suggestion(suggest: str | None) -> None:
def print_suggestion(suggest: str) -> None:
"""Print suggestion to user
:param suggest: what message to print out
"""
Expand All @@ -310,7 +310,4 @@ def print_suggestion(suggest: str | None) -> None:
f"Suggest: {GREEN}{suggest}{RESET_COLOR} ",
end="",
)
else:
print(f"commit-check does not support {suggest} yet.")
raise SystemExit(1)
print("\n")
9 changes: 0 additions & 9 deletions tests/util_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,15 +605,6 @@ def test_print_suggestion(self, capfd):
stdout, _ = capfd.readouterr()
assert "Suggest:" in stdout

@pytest.mark.benchmark
def test_print_suggestion_exit1(self, capfd):
# Must exit with 1 when "" passed
with pytest.raises(SystemExit) as e:
print_suggestion("")
assert e.value.code == 1
stdout, _ = capfd.readouterr()
assert "commit-check does not support" in stdout


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