File tree 5 files changed +11
-22
lines changed
5 files changed +11
-22
lines changed Original file line number Diff line number Diff line change @@ -190,7 +190,7 @@ def process_commit_message(
190
190
def order_changelog_tree (tree : Iterable , change_type_order : list [str ]) -> Iterable :
191
191
if len (set (change_type_order )) != len (change_type_order ):
192
192
raise InvalidConfigurationError (
193
- f"Change types contain duplicates types ({ change_type_order } )"
193
+ f"Change types contain duplicated types ({ change_type_order } )"
194
194
)
195
195
196
196
sorted_tree = []
Original file line number Diff line number Diff line change @@ -633,14 +633,10 @@ def main():
633
633
extra_args = " " .join (unknown_args [1 :])
634
634
arguments ["extra_cli_args" ] = extra_args
635
635
636
- if args .config :
637
- conf = config .read_cfg (args .config )
638
- else :
639
- conf = config .read_cfg ()
640
-
636
+ conf = config .read_cfg (args .config or None )
641
637
if args .name :
642
638
conf .update ({"name" : args .name })
643
- elif not args . name and not conf .path :
639
+ elif not conf .path :
644
640
conf .update ({"name" : "cz_conventional_commits" })
645
641
646
642
if args .debug :
Original file line number Diff line number Diff line change 5
5
from commitizen import git
6
6
from commitizen .cz import exceptions
7
7
8
+ _RE_LOCAL_VERSION = re .compile (r"\+.+" )
9
+
8
10
9
11
def required_validator (answer , msg = None ):
10
12
if not answer :
@@ -17,16 +19,11 @@ def multiple_line_breaker(answer, sep="|"):
17
19
18
20
19
21
def strip_local_version (version : str ) -> str :
20
- return re .sub (r"\+.+" , "" , version )
22
+ return _RE_LOCAL_VERSION .sub ("" , version )
21
23
22
24
23
25
def get_backup_file_path () -> str :
24
26
project_root = git .find_git_project_root ()
25
-
26
- if project_root is None :
27
- project = ""
28
- else :
29
- project = project_root .as_posix ().replace ("/" , "%" )
30
-
27
+ project = "" if project_root is None else project_root .as_posix ().replace ("/" , "%" )
31
28
user = os .environ .get ("USER" , "" )
32
29
return os .path .join (tempfile .gettempdir (), f"cz.commit%{ user } %{ project } .backup" )
Original file line number Diff line number Diff line change @@ -142,7 +142,7 @@ class Settings(TypedDict, total=False):
142
142
def get_tag_regexes (
143
143
version_regex : str ,
144
144
) -> dict [str , str ]:
145
- regexs = {
145
+ regexes = {
146
146
"version" : version_regex ,
147
147
"major" : r"(?P<major>\d+)" ,
148
148
"minor" : r"(?P<minor>\d+)" ,
@@ -151,6 +151,6 @@ def get_tag_regexes(
151
151
"devrelease" : r"(?P<devrelease>\.dev\d+)?" ,
152
152
}
153
153
return {
154
- ** {f"${ k } " : v for k , v in regexs .items ()},
155
- ** {f"${{{ k } }}" : v for k , v in regexs .items ()},
154
+ ** {f"${ k } " : v for k , v in regexes .items ()},
155
+ ** {f"${{{ k } }}" : v for k , v in regexes .items ()},
156
156
}
Original file line number Diff line number Diff line change @@ -172,11 +172,7 @@ def include_in_changelog(self, tag: GitTag) -> bool:
172
172
version = self .extract_version (tag )
173
173
except InvalidVersion :
174
174
return False
175
-
176
- if self .merge_prereleases and version .is_prerelease :
177
- return False
178
-
179
- return True
175
+ return not (self .merge_prereleases and version .is_prerelease )
180
176
181
177
def search_version (self , text : str , last : bool = False ) -> VersionTag | None :
182
178
"""
You can’t perform that action at this time.
0 commit comments