Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1bb40c7

Browse files
bearomorphismLee-W
authored andcommitted
refactor(BaseCommitizen): remove NotImplementedError and make them abstract method
1 parent be14a32 commit 1bb40c7

File tree

3 files changed

+28
-50
lines changed

3 files changed

+28
-50
lines changed

‎commitizen/cz/base.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,18 @@ def style(self) -> Style:
8484
]
8585
)
8686

87+
@abstractmethod
8788
def example(self) -> str:
8889
"""Example of the commit message."""
89-
raise NotImplementedError("Not Implemented yet")
9090

91+
@abstractmethod
9192
def schema(self) -> str:
9293
"""Schema definition of the commit message."""
93-
raise NotImplementedError("Not Implemented yet")
9494

95+
@abstractmethod
9596
def schema_pattern(self) -> str:
9697
"""Regex matching the schema used for message validation."""
97-
raise NotImplementedError("Not Implemented yet")
9898

99+
@abstractmethod
99100
def info(self) -> str:
100101
"""Information about the standardized commit message."""
101-
raise NotImplementedError("Not Implemented yet")

‎tests/conftest.py‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,18 @@ def message(self, answers: Mapping) -> str:
215215
subject = answers.get("subject", "default message").trim()
216216
return f"{prefix}: {subject}"
217217

218+
def example(self) -> str:
219+
return ""
220+
221+
def schema(self) -> str:
222+
return ""
223+
224+
def schema_pattern(self) -> str:
225+
return ""
226+
227+
def info(self) -> str:
228+
return ""
229+
218230

219231
@pytest.fixture()
220232
def use_cz_semver(mocker):
@@ -229,6 +241,18 @@ def questions(self) -> list[CzQuestion]:
229241
def message(self, answers: Mapping) -> str:
230242
return ""
231243

244+
def example(self) -> str:
245+
return ""
246+
247+
def schema(self) -> str:
248+
return ""
249+
250+
def schema_pattern(self) -> str:
251+
return ""
252+
253+
def info(self) -> str:
254+
return ""
255+
232256

233257
@pytest.fixture
234258
def mock_plugin(mocker: MockerFixture, config: BaseConfig) -> BaseCommitizen:

‎tests/test_cz_base.py‎

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /