Skip to content

chore: update in code todos for v10 #1266

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/semantic_release/cli/changelog_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def generate_release_notes(
environment(autoescape=False, template_dir=tpl_dir)
)

# TODO: Remove in v10
# TODO: Remove in v11
release_notes_env.globals["context"] = release_notes_env.globals["ctx"] = {
"history": history,
"mask_initial_release": mask_initial_release,
Expand Down
10 changes: 5 additions & 5 deletions src/semantic_release/cli/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def interpret_output_format(self) -> Self:


class ChangelogConfig(BaseModel):
# TODO: BREAKING CHANGE v10, move to DefaultChangelogTemplatesConfig
# TODO: BREAKING CHANGE v11, move to DefaultChangelogTemplatesConfig
changelog_file: str = ""
"""Deprecated! Moved to 'default_templates.changelog_file'"""

Expand Down Expand Up @@ -191,7 +191,7 @@ def changelog_file_deprecation_warning(cls, val: str) -> str:

@model_validator(mode="after")
def move_changelog_file(self) -> Self:
# TODO: Remove this method in v10
# TODO: Remove this method in v11
if not self.changelog_file:
return self

Expand Down Expand Up @@ -441,7 +441,7 @@ def set_default_opts(self) -> Self:
parser_opts_type = None
# If the commit parser is a known one, pull the default options object from it
if self.commit_parser in _known_commit_parsers:
# TODO: BREAKING CHANGE v10
# TODO: BREAKING CHANGE v11
# parser_opts_type = (
# _known_commit_parsers[self.commit_parser]
# .get_default_options()
Expand All @@ -454,7 +454,7 @@ def set_default_opts(self) -> Self:
try:
# if its a custom parser, try to import it and pull the default options object type
custom_class = dynamic_import(self.commit_parser)
# TODO: BREAKING CHANGE v10
# TODO: BREAKING CHANGE v11
# parser_opts_type = custom_class.get_default_options().__class__
if hasattr(custom_class, "parser_options"):
parser_opts_type = custom_class.parser_options
Expand Down Expand Up @@ -695,7 +695,7 @@ def from_raw_config( # noqa: C901
) from err

commit_parser_opts_class = commit_parser_cls.parser_options
# TODO: Breaking change v10
# TODO: Breaking change v11
# commit_parser_opts_class = commit_parser_cls.get_default_options().__class__
try:
commit_parser = commit_parser_cls(
Expand Down
2 changes: 1 addition & 1 deletion src/semantic_release/commit_parser/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def __init__(self, options: _OPTS | None = None) -> None:
options if options is not None else self.get_default_options()
)

# TODO: BREAKING CHANGE v10, add abstract method for all custom parsers
# TODO: BREAKING CHANGE v11, add abstract method for all custom parsers
# @staticmethod
# @abstractmethod
def get_default_options(self) -> _OPTS:
Expand Down
11 changes: 0 additions & 11 deletions src/semantic_release/commit_parser/angular.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,9 @@ class AngularParserOptions(ParserOptions):
default_bump_level: LevelBump = LevelBump.NO_RELEASE
"""The minimum bump level to apply to valid commit message."""

# TODO: breaking change v10, change default to True
parse_squash_commits: bool = False
"""Toggle flag for whether or not to parse squash commits"""

# TODO: breaking change v10, change default to True
ignore_merge_commits: bool = False
"""Toggle flag for whether or not to ignore merge commits"""

Expand Down Expand Up @@ -236,15 +234,11 @@ def commit_body_components_separator(
) -> dict[str, list[str]]:
if (match := breaking_re.match(text)) and (brk_desc := match.group(1)):
accumulator["breaking_descriptions"].append(brk_desc)
# TODO: breaking change v10, removes breaking change footers from descriptions
# return accumulator

elif (match := self.notice_selector.match(text)) and (
notice := match.group("notice")
):
accumulator["notices"].append(notice)
# TODO: breaking change v10, removes notice footers from descriptions
# return accumulator

elif match := self.issue_selector.search(text):
# if match := self.issue_selector.search(text):
Expand All @@ -265,8 +259,6 @@ def commit_body_components_separator(
accumulator["linked_issues"] = sort_numerically(
set(accumulator["linked_issues"]).union(new_issue_refs)
)
# TODO: breaking change v10, removes resolution footers from descriptions
# return accumulator

# Prevent appending duplicate descriptions
if text not in accumulator["descriptions"]:
Expand All @@ -287,9 +279,6 @@ def parse_message(self, message: str) -> ParsedMessageResult | None:
linked_merge_request = ""
if mr_match := self.mr_selector.search(parsed_subject):
linked_merge_request = mr_match.group("mr_number")
# TODO: breaking change v10, removes PR number from subject/descriptions
# expects changelog template to format the line accordingly
# parsed_subject = self.pr_selector.sub("", parsed_subject).strip()

body_components: dict[str, list[str]] = reduce(
self.commit_body_components_separator,
Expand Down
4 changes: 2 additions & 2 deletions src/semantic_release/commit_parser/scipy.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class ScipyParserOptions(ParserOptions):
one of these prefixes, it will not be considered a valid commit message.
"""

# TODO: breaking v10, make consistent with AngularParserOptions
# TODO: breaking v11, make consistent with AngularParserOptions
default_level_bump: LevelBump = LevelBump.NO_RELEASE
"""The minimum bump level to apply to valid commit message."""

Expand All @@ -161,7 +161,7 @@ def tag_to_level(self) -> dict[str, LevelBump]:
return self._tag_to_level

def __post_init__(self) -> None:
# TODO: breaking v10, remove as the name is now consistent
# TODO: breaking v11, remove as the name is now consistent
self.default_bump_level = self.default_level_bump
self._tag_to_level: dict[str, LevelBump] = {
str(tag): level
Expand Down
2 changes: 1 addition & 1 deletion src/semantic_release/commit_parser/token.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def from_parsed_message_result(
"""A convience method to create a ParsedCommit object from a ParsedMessageResult object and a Commit object."""
return ParsedCommit(
bump=parsed_message_result.bump,
# TODO: breaking v10, swap back to type rather than category
# TODO: breaking v11, swap back to type rather than category
type=parsed_message_result.category,
scope=parsed_message_result.scope,
descriptions=list(parsed_message_result.descriptions),
Expand Down
2 changes: 1 addition & 1 deletion src/semantic_release/commit_parser/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from re import MULTILINE, compile as regexp
from typing import TYPE_CHECKING

# TODO: remove in v10
# TODO: remove in v11
from semantic_release.helpers import (
sort_numerically, # noqa: F401 # TODO: maintained for compatibility
)
Expand Down
14 changes: 6 additions & 8 deletions tests/unit/semantic_release/commit_parser/test_conventional.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def test_parser_squashed_commit_bitbucket_squash_style(
assert expected["type"] == result.type
# Optional
assert expected.get("scope", "") == result.scope
# TODO: v10 change to tuples
# TODO: v11 change to tuples
assert expected.get("descriptions", []) == result.descriptions
assert expected.get("breaking_descriptions", []) == result.breaking_descriptions
assert expected.get("linked_issues", ()) == result.linked_issues
Expand Down Expand Up @@ -388,7 +388,7 @@ def test_parser_squashed_commit_git_squash_style(
assert expected["type"] == result.type
# Optional
assert expected.get("scope", "") == result.scope
# TODO: v10 change to tuples
# TODO: v11 change to tuples
assert expected.get("descriptions", []) == result.descriptions
assert expected.get("breaking_descriptions", []) == result.breaking_descriptions
assert expected.get("linked_issues", ()) == result.linked_issues
Expand Down Expand Up @@ -549,7 +549,7 @@ def test_parser_squashed_commit_github_squash_style(
assert expected["type"] == result.type
# Optional
assert expected.get("scope", "") == result.scope
# TODO: v10 change to tuples
# TODO: v11 change to tuples
assert expected.get("descriptions", []) == result.descriptions
assert expected.get("breaking_descriptions", []) == result.breaking_descriptions
assert expected.get("linked_issues", ()) == result.linked_issues
Expand Down Expand Up @@ -699,7 +699,6 @@ def test_parser_return_subject_from_commit_message(

@pytest.mark.parametrize(
"message, subject, merge_request_number",
# TODO: in v10, we will remove the merge request number from the subject line
[
# GitHub, Gitea style
(
Expand Down Expand Up @@ -1109,10 +1108,9 @@ def test_parser_return_release_notices_from_commit_message(
assert isinstance(result, ParsedCommit)
assert tuple(notices) == result.release_notices

# TODO: v10, remove this
# full_description = str.join("\n\n", result.descriptions)
# full_notice = str.join("\n\n", result.release_notices)
# assert full_notice not in full_description
full_description = str.join("\n\n", result.descriptions)
full_notice = str.join("\n\n", result.release_notices)
assert full_notice not in full_description


##############################
Expand Down
14 changes: 6 additions & 8 deletions tests/unit/semantic_release/commit_parser/test_emoji.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ def test_parser_return_linked_merge_request_from_commit_message(

@pytest.mark.parametrize(
"message, linked_issues",
# TODO: in v10, we will remove the issue reference footers from the descriptions
[
*[
# GitHub, Gitea, GitLab style
Expand Down Expand Up @@ -510,10 +509,9 @@ def test_parser_return_release_notices_from_commit_message(
assert isinstance(result, ParsedCommit)
assert tuple(notices) == result.release_notices

# TODO: v10, remove this
# full_description = str.join("\n\n", result.descriptions)
# full_notice = str.join("\n\n", result.release_notices)
# assert full_notice not in full_description
full_description = str.join("\n\n", result.descriptions)
full_notice = str.join("\n\n", result.release_notices)
assert full_notice not in full_description


@pytest.mark.parametrize(
Expand Down Expand Up @@ -689,7 +687,7 @@ def test_parser_squashed_commit_bitbucket_squash_style(
assert expected["type"] == result.type
# Optional
assert expected.get("scope", "") == result.scope
# TODO: v10 change to tuples
# TODO: v11 change to tuples
assert expected.get("descriptions", []) == result.descriptions
assert expected.get("breaking_descriptions", []) == result.breaking_descriptions
assert expected.get("linked_issues", ()) == result.linked_issues
Expand Down Expand Up @@ -878,7 +876,7 @@ def test_parser_squashed_commit_git_squash_style(
assert expected["type"] == result.type
# Optional
assert expected.get("scope", "") == result.scope
# TODO: v10 change to tuples
# TODO: v11 change to tuples
assert expected.get("descriptions", []) == result.descriptions
assert expected.get("breaking_descriptions", []) == result.breaking_descriptions
assert expected.get("linked_issues", ()) == result.linked_issues
Expand Down Expand Up @@ -1042,7 +1040,7 @@ def test_parser_squashed_commit_github_squash_style(
assert expected["type"] == result.type
# Optional
assert expected.get("scope", "") == result.scope
# TODO: v10 change to tuples
# TODO: v11 change to tuples
assert expected.get("descriptions", []) == result.descriptions
assert expected.get("breaking_descriptions", []) == result.breaking_descriptions
assert expected.get("linked_issues", ()) == result.linked_issues
Expand Down
14 changes: 6 additions & 8 deletions tests/unit/semantic_release/commit_parser/test_scipy.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ def test_parser_squashed_commit_bitbucket_squash_style(
assert expected["type"] == result.type
# Optional
assert expected.get("scope", "") == result.scope
# TODO: v10 change to tuples
# TODO: v11 change to tuples
assert expected.get("descriptions", []) == result.descriptions
assert expected.get("breaking_descriptions", []) == result.breaking_descriptions
assert expected.get("linked_issues", ()) == result.linked_issues
Expand Down Expand Up @@ -798,7 +798,7 @@ def test_parser_squashed_commit_git_squash_style(
assert expected["type"] == result.type
# Optional
assert expected.get("scope", "") == result.scope
# TODO: v10 change to tuples
# TODO: v11 change to tuples
assert expected.get("descriptions", []) == result.descriptions
assert expected.get("breaking_descriptions", []) == result.breaking_descriptions
assert expected.get("linked_issues", ()) == result.linked_issues
Expand Down Expand Up @@ -959,7 +959,7 @@ def test_parser_squashed_commit_github_squash_style(
assert expected["type"] == result.type
# Optional
assert expected.get("scope", "") == result.scope
# TODO: v10 change to tuples
# TODO: v11 change to tuples
assert expected.get("descriptions", []) == result.descriptions
assert expected.get("breaking_descriptions", []) == result.breaking_descriptions
assert expected.get("linked_issues", ()) == result.linked_issues
Expand All @@ -968,7 +968,6 @@ def test_parser_squashed_commit_github_squash_style(

@pytest.mark.parametrize(
"message, linked_issues",
# TODO: in v10, we will remove the issue reference footers from the descriptions
[
*[
# GitHub, Gitea, GitLab style
Expand Down Expand Up @@ -1331,10 +1330,9 @@ def test_parser_return_release_notices_from_commit_message(
assert isinstance(result, ParsedCommit)
assert tuple(notices) == result.release_notices

# TODO: v10, remove this
# full_description = str.join("\n\n", result.descriptions)
# full_notice = str.join("\n\n", result.release_notices)
# assert full_notice not in full_description
full_description = str.join("\n\n", result.descriptions)
full_notice = str.join("\n\n", result.release_notices)
assert full_notice not in full_description


def test_parser_ignore_merge_commit(
Expand Down