Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

refactor(BaseCommitizen): remove unused process_commit #1468

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 8, 2025
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: 0 additions & 7 deletions commitizen/cz/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,3 @@ def schema_pattern(self) -> str:
def info(self) -> str:
"""Information about the standardized commit message."""
raise NotImplementedError("Not Implemented yet")

def process_commit(self, commit: str) -> str:
"""Process commit for changelog.

If not overwritten, it returns the first line of commit.
"""
return commit.split("\n")[0]
6 changes: 0 additions & 6 deletions commitizen/cz/conventional_commits/conventional_commits.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import re

from commitizen import defaults
from commitizen.cz.base import BaseCommitizen
Expand Down Expand Up @@ -198,8 +197,3 @@ def info(self) -> str:
filepath = os.path.join(dir_path, "conventional_commits_info.txt")
with open(filepath, encoding=self.config.settings["encoding"]) as f:
return f.read()

def process_commit(self, commit: str) -> str:
if m := re.match(self.schema_pattern(), commit):
return m.group(3).strip()
return ""
6 changes: 0 additions & 6 deletions tests/test_cz_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,3 @@ def test_info(config):
cz = DummyCz(config)
with pytest.raises(NotImplementedError):
cz.info()


def test_process_commit(config):
cz = DummyCz(config)
message = cz.process_commit("test(test_scope): this is test msg")
assert message == "test(test_scope): this is test msg"
23 changes: 0 additions & 23 deletions tests/test_cz_conventional_commits.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,26 +130,3 @@ def test_info(config):
conventional_commits = ConventionalCommitsCz(config)
info = conventional_commits.info()
assert isinstance(info, str)


@pytest.mark.parametrize(
("commit_message", "expected_message"),
[
(
"test(test_scope): this is test msg",
"this is test msg",
),
(
"test(test_scope)!: this is test msg",
"this is test msg",
),
(
"test!(test_scope): this is test msg",
"",
),
],
)
def test_process_commit(commit_message, expected_message, config):
conventional_commits = ConventionalCommitsCz(config)
message = conventional_commits.process_commit(commit_message)
assert message == expected_message