@@ -30,16 +30,20 @@ def find_increment(
3030 increment : str | None = None
3131
3232 for commit in commits :
33- for message in commit . message . split ( " \n " ):
34- result = select_pattern .search ( message )
35-
36- if result :
33+ for message in filter (
34+ None , map ( select_pattern .search , commit . message . split ( " \n " ) )
35+ ):
36+ if result := select_pattern . search ( message ) :
3737 found_keyword = result .group (1 )
38- new_increment = None
39- for match_pattern in increments_map .keys ():
40- if re .match (match_pattern , found_keyword ):
41- new_increment = increments_map [match_pattern ]
42- break
38+
39+ new_increment = next (
40+ (
41+ increment_type
42+ for match_pattern , increment_type in increments_map .items ()
43+ if re .match (match_pattern , found_keyword )
44+ ),
45+ None ,
46+ )
4347
4448 if new_increment is None :
4549 logger .debug (
@@ -76,7 +80,7 @@ def update_version_in_files(
7680 """
7781 # TODO: separate check step and write step
7882 updated = []
79- for path , regex in files_and_regexs (files , current_version ):
83+ for path , regex in _files_and_regexes (files , current_version ):
8084 current_version_found , version_file = _bump_with_regex (
8185 path ,
8286 current_version ,
@@ -99,7 +103,7 @@ def update_version_in_files(
99103 return updated
100104
101105
102- def files_and_regexs (patterns : list [str ], version : str ) -> list [tuple [str , str ]]:
106+ def _files_and_regexes (patterns : list [str ], version : str ) -> list [tuple [str , str ]]:
103107 """
104108 Resolve all distinct files with their regexp from a list of glob patterns with optional regexp
105109 """
0 commit comments