Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

perf(cmd-version): re-order operations for faster parsing in version determination#1310

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Changes fromall 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 deletionssrc/semantic_release/version/algorithm.py
View file
Open in desktop
Original file line numberDiff line numberDiff 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

[8]ページ先頭

©2009-2025 Movatter.jp