diff --git a/commit_check/util.py b/commit_check/util.py index af68cf07..f0be979a 100644 --- a/commit_check/util.py +++ b/commit_check/util.py @@ -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: @@ -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 """ @@ -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") diff --git a/tests/util_test.py b/tests/util_test.py index 2a106b00..33651195 100644 --- a/tests/util_test.py +++ b/tests/util_test.py @@ -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."""