Skip to content

Commit

Permalink
Add link to missing lines in diff coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
kieferro committed Aug 25, 2023
1 parent f008093 commit 1afb389
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion coverage_comment/template_files/comment.md.j2
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ _None of the new lines are part of the tested code. Therefore, there is no cover
{%- if diff_file_coverage.violation_lines -%}
{% block single_file_missing_lines_wording scoped -%}
{% set separator = joiner(", ") %}
Missing lines: {% for line in diff_file_coverage.violation_lines_collapsed %}{{ separator() }}`{{ line[0] }}{{ '-' ~ line[1] if line[1] > line[0] }}`{% endfor %}
Missing lines: {% for line in diff_file_coverage.violation_lines_collapsed %}{{ separator() }}[`{{ line[0] }}{{ '-' ~ line[1] if line[1] > line[0] }}`]({{ filename | file_url(line[0], line[1]) }}){% endfor %}
{%- endblock single_file_missing_lines_wording %}
{%- endif %}
{% endblock coverage_single_file -%}
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/test_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def test_template(coverage_obj, diff_coverage_obj):
### [codebase/code.py](https://github.com/org/repo/pull/5/files#diff-c05d5557f0c1ff3761df2f49e3b541cfc161f4f0d63e2a66d568f090065bc3d3)
`80%` of new lines are covered (`75%` of the complete file).
Missing lines: `3`, `7-9`, `12`
Missing lines: [`3`](https://github.com/org/repo/pull/5/files#diff-c05d5557f0c1ff3761df2f49e3b541cfc161f4f0d63e2a66d568f090065bc3d3R3), [`7-9`](https://github.com/org/repo/pull/5/files#diff-c05d5557f0c1ff3761df2f49e3b541cfc161f4f0d63e2a66d568f090065bc3d3R7-R9), [`12`](https://github.com/org/repo/pull/5/files#diff-c05d5557f0c1ff3761df2f49e3b541cfc161f4f0d63e2a66d568f090065bc3d3R12)
</details>
<!-- foo -->"""
Expand Down Expand Up @@ -170,7 +170,7 @@ def test_template_full():
### [codebase/code.py](https://github.com/org/repo/pull/12/files#diff-c05d5557f0c1ff3761df2f49e3b541cfc161f4f0d63e2a66d568f090065bc3d3)
`50%` of new lines are covered (`83.33%` of the complete file).
Missing lines: `12-14`, `22`
Missing lines: [`12-14`](https://github.com/org/repo/pull/12/files#diff-c05d5557f0c1ff3761df2f49e3b541cfc161f4f0d63e2a66d568f090065bc3d3R12-R14), [`22`](https://github.com/org/repo/pull/12/files#diff-c05d5557f0c1ff3761df2f49e3b541cfc161f4f0d63e2a66d568f090065bc3d3R22)
### [codebase/other.py](https://github.com/org/repo/pull/12/files#diff-30cad827f61772ec66bb9ef8887058e6d8443a2afedb331d800feaa60228a26e)
`100%` of new lines are covered (`100%` of the complete file).
Expand Down Expand Up @@ -232,7 +232,7 @@ def test_template__no_branch_no_previous(coverage_obj_no_branch, diff_coverage_o
### [codebase/code.py](https://github.com/org/repo/pull/3/files#diff-c05d5557f0c1ff3761df2f49e3b541cfc161f4f0d63e2a66d568f090065bc3d3)
`80%` of new lines are covered (`75%` of the complete file).
Missing lines: `3`, `7-9`, `12`
Missing lines: [`3`](https://github.com/org/repo/pull/3/files#diff-c05d5557f0c1ff3761df2f49e3b541cfc161f4f0d63e2a66d568f090065bc3d3R3), [`7-9`](https://github.com/org/repo/pull/3/files#diff-c05d5557f0c1ff3761df2f49e3b541cfc161f4f0d63e2a66d568f090065bc3d3R7-R9), [`12`](https://github.com/org/repo/pull/3/files#diff-c05d5557f0c1ff3761df2f49e3b541cfc161f4f0d63e2a66d568f090065bc3d3R12)
</details>
<!-- foo -->"""
Expand Down

0 comments on commit 1afb389

Please sign in to comment.