diff --git a/src/semantic_release/version/algorithm.py b/src/semantic_release/version/algorithm.py index fa24e3fa1..0057cfcce 100644 --- a/src/semantic_release/version/algorithm.py +++ b/src/semantic_release/version/algorithm.py @@ -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, @@ -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 pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

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