Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 5 additions & 18 deletions src/semantic_release/version/algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,24 +346,7 @@ def next_version(
# Step 5. apply the parser to each commit in the history (could return multiple results per commit)
parsed_results = list(map(commit_parser.parse, commits_since_last_release))

# Step 5A. Validation type check for the parser results (important because of possible custom parsers)
for parsed_result in parsed_results:
if not any(
(
isinstance(parsed_result, (ParseError, ParsedCommit)),
type(parsed_result) == list
and validate_types_in_sequence(
parsed_result, (ParseError, ParsedCommit)
),
type(parsed_result) == tuple
and validate_types_in_sequence(
parsed_result, (ParseError, ParsedCommit)
),
)
):
raise TypeError("Unexpected type returned from commit_parser.parse")

# Step 5B. Accumulate all parsed results into a single list accounting for possible multiple results per commit
# Step 5A. Accumulate all parsed results into a single list accounting for possible multiple results per commit
consolidated_results: list[ParseResult] = reduce(
lambda accumulated_results, p_results: [
*accumulated_results,
Expand All @@ -378,6 +361,10 @@ def next_version(
[],
)

# Step 5B. Validation type check for the parser results (important because of possible custom parsers)
if not validate_types_in_sequence(consolidated_results, (ParseError, ParsedCommit)):
raise TypeError("Unexpected type returned from commit_parser.parse")

# Step 5C. Parse the commits to determine the bump level that should be applied
parsed_levels: set[LevelBump] = {
parsed_result.bump # type: ignore[union-attr] # too complex for type checkers
Expand Down
Loading