Skip to content

Commit 6cbe580

Browse files
bearomorphismLee-W
authored andcommitted
refactor(conventional_commits): use TypedDict for answers
1 parent 965f34e commit 6cbe580

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

commitizen/cz/conventional_commits/conventional_commits.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
from typing import TypedDict
23

34
from commitizen import defaults
45
from commitizen.cz.base import BaseCommitizen
@@ -16,6 +17,15 @@ def _parse_subject(text: str) -> str:
1617
return required_validator(text.strip(".").strip(), msg="Subject is required.")
1718

1819

20+
class ConventionalCommitsAnswers(TypedDict):
21+
prefix: str
22+
scope: str
23+
subject: str
24+
body: str
25+
footer: str
26+
is_breaking_change: bool
27+
28+
1929
class ConventionalCommitsCz(BaseCommitizen):
2030
bump_pattern = defaults.BUMP_PATTERN
2131
bump_map = defaults.BUMP_MAP
@@ -136,7 +146,7 @@ def questions(self) -> list[CzQuestion]:
136146
},
137147
]
138148

139-
def message(self, answers: dict) -> str:
149+
def message(self, answers: ConventionalCommitsAnswers) -> str: # type: ignore[override]
140150
prefix = answers["prefix"]
141151
scope = answers["scope"]
142152
subject = answers["subject"]

0 commit comments

Comments
 (0)