From 5629c7fa0fafd1200d988c02b890c3d9b3afa4a7 Mon Sep 17 00:00:00 2001 From: Pradeep Tammali Date: Sat, 13 Jun 2026 15:50:34 +0200 Subject: [PATCH] refactor: remove deprecated SUBPROJECT_ID support Simplify the coverage comment marker and footer by dropping the unused subproject ID configuration. --- README.md | 1 - codecov/config.py | 1 - codecov/main.py | 6 +----- codecov/template.py | 6 +----- codecov/template_files/comment.md.j2 | 2 +- tests/test_config.py | 2 -- tests/test_template.py | 15 --------------- 7 files changed, 3 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 22587d2..8d00ba4 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,6 @@ Note: Either `GITHUB_PR_NUMBER` or `GITHUB_REF` is required. `GITHUB_PR_NUMBER` ## Optional Environment Variables -- `SUBPROJECT_ID`: The ID or URL of the subproject or report. - `MINIMUM_GREEN`: The minimum coverage percentage for green status. Default is 100. - `MINIMUM_ORANGE`: The minimum coverage percentage for orange status. Default is 70. - `BRANCH_COVERAGE`: Show branch coverage in the report. Default is False. diff --git a/codecov/config.py b/codecov/config.py index c55079e..659b8ca 100644 --- a/codecov/config.py +++ b/codecov/config.py @@ -48,7 +48,6 @@ class Config: # Branch to create the comment on (alternate to get PR number if not provided) # Example Organisation:branch-name (Company:sample-branch) or User:branch-name (user:sample-branch) GITHUB_REF: str | None = None - SUBPROJECT_ID: str | None = None # Deprecated MINIMUM_GREEN: decimal.Decimal = decimal.Decimal('100') MINIMUM_ORANGE: decimal.Decimal = decimal.Decimal('70') TEST_FRAMEWORK: TestFramework = TestFramework.PYTEST diff --git a/codecov/main.py b/codecov/main.py index d31c8df..0e1f43a 100644 --- a/codecov/main.py +++ b/codecov/main.py @@ -19,7 +19,7 @@ def __init__(self): self._init_log() self.github = self._init_github() self.coverage_module = self._init_coverage_module() - self.marker: str = self._init_marker() + self.marker: str = template.MARKER self.comment: str = '' self.coverage: PytestCoverage | JestCoverage self.diff_coverage: DiffCoverage @@ -48,9 +48,6 @@ def _init_coverage_module(self) -> BaseCoverageHandler: log.error('Error initializing coverage module. Please check the test framework and try again.') raise CoreProcessingException from e - def _init_marker(self) -> str: - return template.get_marker(marker_id=self.config.SUBPROJECT_ID) - def run(self): self._process_coverage() self._render_comment_markdown() @@ -105,7 +102,6 @@ def _render_comment_markdown(self) -> None: self.github.pr_number, self.github.base_ref, self.marker, - subproject_id=self.config.SUBPROJECT_ID, branch_coverage=self.config.BRANCH_COVERAGE, complete_project_report=self.config.COMPLETE_PROJECT_REPORT, coverage_report_url=self.config.COVERAGE_REPORT_URL, diff --git a/codecov/template.py b/codecov/template.py index df89203..dbeda09 100644 --- a/codecov/template.py +++ b/codecov/template.py @@ -18,11 +18,7 @@ from codecov.log import log # TODO: Move all the helpers to utils.py -MARKER = """""" - - -def get_marker(marker_id: str | None): - return MARKER.format(id_part=f' (id: {marker_id})' if marker_id else '') +MARKER = """""" def pluralize(number, singular='', plural='s'): diff --git a/codecov/template_files/comment.md.j2 b/codecov/template_files/comment.md.j2 index 180e022..9bea4c3 100644 --- a/codecov/template_files/comment.md.j2 +++ b/codecov/template_files/comment.md.j2 @@ -40,7 +40,7 @@ {%- block footer %} - This report was generated by [codecov] + This report was generated by codecov {% endblock footer -%} {{ marker -}} diff --git a/tests/test_config.py b/tests/test_config.py index 3fcb3ef..e883908 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -50,7 +50,6 @@ def test_config_from_environ_sample(): 'GITHUB_TOKEN': token, 'GITHUB_PR_NUMBER': '123', 'GITHUB_REF': 'main', - 'SUBPROJECT_ID': 'your_subproject_id', 'MINIMUM_GREEN': '90', 'MINIMUM_ORANGE': '70', 'SKIP_COVERAGE': 'False', @@ -68,7 +67,6 @@ def test_config_from_environ_sample(): GITHUB_TOKEN=token, # noqa: S106 GITHUB_PR_NUMBER=123, GITHUB_REF='main', - SUBPROJECT_ID='your_subproject_id', MINIMUM_GREEN=decimal.Decimal('90'), MINIMUM_ORANGE=decimal.Decimal('70'), SKIP_COVERAGE=False, diff --git a/tests/test_template.py b/tests/test_template.py index c3e0efa..fac6b21 100644 --- a/tests/test_template.py +++ b/tests/test_template.py @@ -55,20 +55,6 @@ def test_pluralize(number, singular, plural, expected): assert template.pluralize(number=number, singular=singular, plural=plural) == expected -@pytest.mark.parametrize( - 'marker_id, result', - [ - (None, ''), - ( - 'foo', - '', - ), - ], -) -def test_get_marker(marker_id, result): - assert template.get_marker(marker_id=marker_id) == result - - def test_template_no_marker(coverage_obj, diff_coverage_obj): with pytest.raises(MissingMarker): marker = '' @@ -234,7 +220,6 @@ def test_template_no_files(coverage_obj): coverage_files=[], count_coverage_files=0, max_files=25, - subproject_id='foo', ) assert '_This PR does not include changes to coverable code or code with missing coverage.' in result assert 'code.py' not in result