Skip to content
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

fix: Grammar for codecov comment when missing coverage #481

Merged
merged 3 commits into from
Jun 3, 2024
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
3 changes: 2 additions & 1 deletion services/notification/notifiers/mixins/message/sections.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,9 @@ async def do_write_section(self, comparison, diff, changes, links, behind_by=Non
misses_and_partials = None
patch_coverage = None
if misses_and_partials:
ln_text = "lines" if misses_and_partials > 1 else "line"
yield (
f"Attention: Patch coverage is `{patch_coverage}%` with `{misses_and_partials} lines` in your changes are missing coverage. Please review."
f"Attention: Patch coverage is `{patch_coverage}%` with `{misses_and_partials} {ln_text}` in your changes missing coverage. Please review."
)
else:
yield "All modified and coverable lines are covered by tests :white_check_mark:"
Expand Down
3 changes: 2 additions & 1 deletion services/notification/notifiers/mixins/message/writers.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ def header_lines(self, comparison: ComparisonProxy, diff, settings) -> List[str]
misses_and_partials = None
patch_coverage = None
if misses_and_partials:
ln_text = "lines" if misses_and_partials > 1 else "line"
lines.append(
f"Attention: Patch coverage is `{patch_coverage}%` with `{misses_and_partials} lines` in your changes are missing coverage. Please review."
f"Attention: Patch coverage is `{patch_coverage}%` with `{misses_and_partials} {ln_text}` in your changes missing coverage. Please review."
)
else:
lines.append(
Expand Down
6 changes: 3 additions & 3 deletions services/notification/notifiers/tests/unit/test_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1508,7 +1508,7 @@ async def test_build_default_payload(
"text": "\n".join(
[
f"## [Codecov](test.example.br/gh/test_build_default_payload/{repo.name}/pull/{sample_comparison.pull.pullid}?dropdown=coverage&src=pr&el=h1) Report",
"Attention: Patch coverage is `66.66667%` with `1 lines` in your changes are missing coverage. Please review.",
"Attention: Patch coverage is `66.66667%` with `1 line` in your changes missing coverage. Please review.",
f"> Project coverage is 60.00%. Comparing base [(`{base_commit.commitid[:7]}`)](test.example.br/gh/test_build_default_payload/{repo.name}/commit/{base_commit.commitid}?dropdown=coverage&el=desc) to head [(`{head_commit.commitid[:7]}`)](test.example.br/gh/test_build_default_payload/{repo.name}/commit/{head_commit.commitid}?dropdown=coverage&el=desc)."
f"",
f"",
Expand Down Expand Up @@ -1551,7 +1551,7 @@ async def test_build_default_payload_with_flags(
"text": "\n".join(
[
f"## [Codecov](test.example.br/gh/test_build_default_payload_with_flags/{repo.name}/pull/{sample_comparison.pull.pullid}?dropdown=coverage&src=pr&el=h1) Report",
"Attention: Patch coverage is `66.66667%` with `1 lines` in your changes are missing coverage. Please review.",
"Attention: Patch coverage is `66.66667%` with `1 line` in your changes missing coverage. Please review.",
f"> Project coverage is 60.00%. Comparing base [(`{base_commit.commitid[:7]}`)](test.example.br/gh/test_build_default_payload_with_flags/{repo.name}/commit/{base_commit.commitid}?dropdown=coverage&el=desc) to head [(`{head_commit.commitid[:7]}`)](test.example.br/gh/test_build_default_payload_with_flags/{repo.name}/commit/{head_commit.commitid}?dropdown=coverage&el=desc)."
f"",
f"",
Expand Down Expand Up @@ -1595,7 +1595,7 @@ async def test_build_default_payload_with_flags_and_footer(
"text": "\n".join(
[
f"## [Codecov](test.example.br/gh/{test_name}/{repo.name}/pull/{sample_comparison.pull.pullid}?dropdown=coverage&src=pr&el=h1) Report",
"Attention: Patch coverage is `66.66667%` with `1 lines` in your changes are missing coverage. Please review.",
"Attention: Patch coverage is `66.66667%` with `1 line` in your changes missing coverage. Please review.",
f"> Project coverage is 60.00%. Comparing base [(`{base_commit.commitid[:7]}`)](test.example.br/gh/test_build_default_payload_with_flags_and_footer/{repo.name}/commit/{base_commit.commitid}?dropdown=coverage&el=desc) to head [(`{head_commit.commitid[:7]}`)](test.example.br/gh/test_build_default_payload_with_flags_and_footer/{repo.name}/commit/{head_commit.commitid}?dropdown=coverage&el=desc).",
f"",
f"| [Files](test.example.br/gh/{test_name}/{repo.name}/pull/{sample_comparison.pull.pullid}?dropdown=coverage&src=pr&el=tree) | Coverage Δ | Complexity Δ | |",
Expand Down
Loading
Loading