pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/commitizen-tools/commitizen/commit/815f514b00300e628fad49e0400da760ab517bfb

ous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/global-5efd63e783ac04bb.css" /> refactor: misc cleanup · commitizen-tools/commitizen@815f514 · GitHub
Skip to content

Commit 815f514

Browse files
bearomorphismLee-W
authored andcommitted
refactor: misc cleanup
1 parent 74d3bc5 commit 815f514

2 files changed

Lines changed: 9 additions & 18 deletions

File tree

commitizen/cz/conventional_commits/conventional_commits.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class ConventionalCommitsCz(BaseCommitizen):
4141
changelog_pattern = defaults.BUMP_PATTERN
4242

4343
def questions(self) -> Questions:
44-
questions: Questions = [
44+
return [
4545
{
4646
"type": "list",
4747
"name": "prefix",
@@ -146,7 +146,6 @@ def questions(self) -> Questions:
146146
),
147147
},
148148
]
149-
return questions
150149

151150
def message(self, answers: dict) -> str:
152151
prefix = answers["prefix"]
@@ -165,9 +164,7 @@ def message(self, answers: dict) -> str:
165164
if footer:
166165
footer = f"\n\n{footer}"
167166

168-
message = f"{prefix}{scope}: {subject}{body}{footer}"
169-
170-
return message
167+
return f"{prefix}{scope}: {subject}{body}{footer}"
171168

172169
def example(self) -> str:
173170
return (
@@ -188,25 +185,21 @@ def schema(self) -> str:
188185
)
189186

190187
def schema_pattern(self) -> str:
191-
PATTERN = (
188+
return (
192189
r"(?s)" # To explicitly make . match new line
193190
r"(build|ci|docs|feat|fix|perf|refactor|style|test|chore|revert|bump)" # type
194191
r"(\(\S+\))?!?:" # scope
195192
r"( [^\n\r]+)" # subject
196193
r"((\n\n.*)|(\s*))?$"
197194
)
198-
return PATTERN
199195

200196
def info(self) -> str:
201197
dir_path = os.path.dirname(os.path.realpath(__file__))
202198
filepath = os.path.join(dir_path, "conventional_commits_info.txt")
203199
with open(filepath, encoding=self.config.settings["encoding"]) as f:
204-
content = f.read()
205-
return content
200+
return f.read()
206201

207202
def process_commit(self, commit: str) -> str:
208-
pat = re.compile(self.schema_pattern())
209-
m = re.match(pat, commit)
210-
if m is None:
211-
return ""
212-
return m.group(3).strip()
203+
if m := re.match(self.schema_pattern(), commit):
204+
return m.group(3).strip()
205+
return ""

commitizen/cz/jira/jira.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
class JiraSmartCz(BaseCommitizen):
1010
def questions(self) -> Questions:
11-
questions = [
11+
return [
1212
{
1313
"type": "input",
1414
"name": "message",
@@ -42,7 +42,6 @@ def questions(self) -> Questions:
4242
"filter": lambda x: "#comment " + x if x else "",
4343
},
4444
]
45-
return questions
4645

4746
def message(self, answers: dict) -> str:
4847
return " ".join(
@@ -77,5 +76,4 @@ def info(self) -> str:
7776
dir_path = os.path.dirname(os.path.realpath(__file__))
7877
filepath = os.path.join(dir_path, "jira_info.txt")
7978
with open(filepath, encoding=self.config.settings["encoding"]) as f:
80-
content = f.read()
81-
return content
79+
return f.read()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy