diff --git a/MANIFEST.in b/MANIFEST.in index cc35a4d..f082564 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1,4 @@ include codecov/template_files/comment.md.j2 +include codecov/template_files/pr.md.j2 +include codecov/template_files/project.md.j2 +include codecov/template_files/macros.md.j2 diff --git a/codecov/template.py b/codecov/template.py index 35c0da3..18b4b3b 100644 --- a/codecov/template.py +++ b/codecov/template.py @@ -87,7 +87,7 @@ def get_comment_markdown( # pylint: disable=too-many-arguments,too-many-locals complete_project_report: bool = False, coverage_report_url: str | None = None, ): - env = SandboxedEnvironment() + env = SandboxedEnvironment(loader=jinja2.FileSystemLoader('codecov/template_files/')) env.filters['pct'] = pct env.filters['x100'] = x100 env.filters['generate_badge'] = badge.get_static_badge_url diff --git a/codecov/template_files/comment.md.j2 b/codecov/template_files/comment.md.j2 index 357a78d..c7ca538 100644 --- a/codecov/template_files/comment.md.j2 +++ b/codecov/template_files/comment.md.j2 @@ -7,7 +7,6 @@ {%- set text = "Coverage of the whole project for this PR is " ~ coverage.info.percent_covered_display ~ "%." -%} {%- set color = coverage.info.percent_covered | get_badge_color -%} - {%- endif -%} {%- endblock coverage_evolution_badge -%} @@ -16,442 +15,25 @@ {%- block diff_coverage_badge -%} {%- set text = (diff_coverage.total_percent_covered | pct) ~ " of the statement lines added by this PR are covered" -%} - {%- endblock diff_coverage_badge -%} {%- endblock coverage_badges -%} -{%- macro statements_badge(path, statements_count, base=false) -%} -{% set text = "The " ~ path ~ " contains " ~ statements_count ~ " statement" ~ (statements_count | pluralize) ~"." -%} -{% set color = "007ec6" -%} - - -{%- endmacro -%} - -{%- macro branches_badge(path, branches_count, base=false) -%} -{% set text = "The " ~ path ~ " contains " ~ branches_count ~ " branch" ~ (branches_count | pluralize(plural='es')) ~"." -%} -{% set color = "008080" -%} - - -{%- endmacro -%} - -{%- macro missing_branches_badge(path, missing_branches_count, base=false) -%} -{%- set text = missing_branches_count ~ " branch" ~ (missing_branches_count | pluralize(plural='es')) ~ " missing the coverage in " ~ path ~ "." -%} -{% if missing_branches_count == 0 -%} -{%- set color = "brightgreen" -%} -{% else -%} -{%- set color = "red" -%} -{% endif -%} - -{%- endmacro -%} - -{%- macro missing_lines_badge(path, missing_lines_count, base=false) -%} -{%- set text = missing_lines_count ~ " statement" ~ (statements_count | pluralize) ~ " missing the coverage in " ~ path ~ "." -%} -{% if missing_lines_count == 0 -%} -{%- set color = "brightgreen" -%} -{% else -%} -{%- set color = "red" -%} -{% endif -%} - -{%- endmacro -%} - -{%- macro coverage_rate_badge(path, percent_covered, percent_covered_display, covered_statements_count, statements_count, base=false) -%} -{%- set text = "The coverage rate of " ~ path ~ " is " ~ percent_covered_display ~ "% (" ~ covered_statements_count ~ "/" ~ statements_count ~ ")." -%} -{%- set label = percent_covered_display ~ "%" -%} -{%- set message = "(" ~ covered_statements_count ~ "/" ~ statements_count ~ ")" -%} -{%- set color = percent_covered | get_badge_color -%} - - -{%- endmacro -%} - -{%- macro diff_coverage_rate_badge(path, added_statements_count, covered_statements_count, percent_covered) -%} -{% if added_statements_count -%} -{% set text = "In this PR, " ~ (added_statements_count) ~ " new statement" ~ (added_statements_count | pluralize) ~ " " ~ (added_statements_count | pluralize(singular='is', plural='are')) ~ " added to " ~ path ~ ", and " ~ covered_statements_count ~ " statement" ~ (covered_statements_count | pluralize) ~ " "~ (covered_statements_count | pluralize(singular='is', plural='are')) ~ " covered (" ~ (percent_covered | pct) ~ ")." -%} -{% set label = (percent_covered | pct(precision=0)) -%} -{% set message = "(" ~ covered_statements_count ~ "/" ~ added_statements_count ~ ")" -%} -{%- set color = (percent_covered | x100 | get_badge_color()) -%} -{% else -%} -{% set text = "This PR does not seem to add statements to " ~ path ~ "." -%} -{% set label = "" -%} -{%- set color = "grey" -%} -{% set message = "N/A" -%} -{% endif -%} - - -{%- endmacro -%} - +{# macros #} +{% import 'macros.md.j2' as macros %} {# Individual file report #} {%- block coverage_by_file -%} -{%- if not files %} - -_This PR does not seem to contain any modification to coverable code._ -{%- else -%} -
Click to see coverage of changed files - - - {% if branch_coverage %}{% endif %} - - - {% if branch_coverage %}{% endif %} - - - -{%- for parent, files_in_folder in files|groupby(attribute="path.parent") -%} - - - - -{%- for file in files_in_folder -%} -{%- set path = file.coverage.path -%} - - - -{#- Statements cell -#} -{%- block statements_badge_cell scoped -%} -{{- statements_badge( - path=path, - statements_count=file.coverage.info.num_statements, -) -}} -{%- endblock statements_badge_cell-%} - -{#- Missing cell -#} -{%- block missing_lines_badge_cell scoped -%} -{{- missing_lines_badge( - path=path, - missing_lines_count=file.coverage.info.missing_lines, -) -}} -{%- endblock missing_lines_badge_cell -%} - -{% if branch_coverage %} -{#- Branches cell -#} -{%- block branches_badge_cell scoped -%} -{{- branches_badge( - path=path, - branches_count=file.coverage.info.num_branches, -) -}} -{%- endblock branches_badge_cell -%} - -{#- Missing cell -#} -{%- block missing_branches_badge_cell scoped -%} -{{- missing_branches_badge( - path=path, - missing_branches_count=file.coverage.info.missing_branches, -) -}} -{%- endblock missing_branches_badge_cell -%} -{% endif %} - -{#- Coverage rate -#} -{%- block coverage_rate_badge_cell scoped -%} -{{- coverage_rate_badge( - path=path, - percent_covered=file.coverage.info.percent_covered, - percent_covered_display=file.coverage.info.percent_covered_display, - covered_statements_count=file.coverage.info.covered_lines, - statements_count=file.coverage.info.num_statements, -) -}} -{%- endblock coverage_rate_badge_cell -%} - -{#- Coverage of added lines (new stmts) -#} -{%- block diff_coverage_rate_badge_cell scoped -%} -{{- diff_coverage_rate_badge( - path=path, - added_statements_count=((file.diff.added_statements | length) if file.diff else none), - covered_statements_count=((file.diff.covered_statements | length) if file.diff else none), - percent_covered=(file.diff.percent_covered if file.diff else none) -) -}} -{%- endblock diff_coverage_rate_badge_cell -%} - -{#- Link to lines missing -#} -{%- block link_to_missing_diff_lines_cell scoped -%} - - -{%- endblock link_to_missing_diff_lines_cell -%} - -{#- Link to branch missing lines -#} -{%- if branch_coverage -%} -{%- block link_to_branches_missing_lines_cell scoped -%} - -{%- endblock link_to_branches_missing_lines_cell -%} -{%- endif -%} - - -{%- endfor -%} -{%- endfor -%} - - - - - - -{#- Statements cell -#} -{%- block statements_badge_total_cell scoped -%} -{{- statements_badge( - path="whole project", - statements_count=coverage.info.num_statements, -) -}} -{%- endblock statements_badge_total_cell -%} - -{#- Missing cell -#} -{%- block missing_lines_badge_total_cell scoped -%} -{{- missing_lines_badge( - path="the whole project", - missing_lines_count=coverage.info.missing_lines, -) -}} -{%- endblock missing_lines_badge_total_cell -%} - -{% if branch_coverage %} -{#- Branches cell -#} -{%- block branches_badge_total_cell scoped -%} -{{- branches_badge( - path="the whole project", - branches_count=coverage.info.num_branches, -) -}} -{%- endblock branches_badge_total_cell -%} - -{#- Missing cell -#} -{%- block missing_branches_badge_total_cell scoped -%} -{{- missing_branches_badge( - path="the whole project", - missing_branches_count=coverage.info.missing_branches, -) -}} -{%- endblock missing_branches_badge_total_cell -%} -{% endif %} - -{#- Coverage rate -#} -{%- block coverage_rate_badge_total_cell scoped -%} -{{- coverage_rate_badge( - path="the whole project", - percent_covered=coverage.info.percent_covered, - percent_covered_display=coverage.info.percent_covered_display, - covered_statements_count=coverage.info.covered_lines, - statements_count=coverage.info.num_statements, -) -}} -{%- endblock coverage_rate_badge_total_cell -%} - -{# Coverage of added lines #} -{%- block diff_coverage_rate_badge_total_cell scoped -%} -{{- diff_coverage_rate_badge( - path="the whole project", - added_statements_count=diff_coverage.total_num_lines, - covered_statements_count=(diff_coverage.total_num_lines-diff_coverage.total_num_violations), - percent_covered=diff_coverage.total_percent_covered, -) -}} -{%- endblock diff_coverage_rate_badge_total_cell -%} - - -{% if branch_coverage %} - -{% endif %} - - -
FileStatementsMissingBranchesMissing
Coverage         
Coverage         
(new stmts)

Lines missing              

Branches missing              
  {{ parent }}
  {{ path.name }} - -{%- set comma = joiner() -%} -{%- for group in missing_diff_lines.get(path, []) -%} -{{- comma() -}} - - -{{- group.line_start -}} -{%- if group.line_start != group.line_end -%} -- -{{- group.line_end -}} -{%- endif -%} - - -{%- endfor -%} - -{%- set comma = joiner() -%} -{%- for branch in file.coverage.missing_branches -%} -{{- comma() -}} -{{- branch[0] | abs -}} -> {{- branch[1] | abs -}} -{%- endfor -%} -
Project Total  
- -{%- if max_files and count_files > max_files %} -_The report is truncated to {{ max_files }} files out of {{ count_files }}. -{% endif %} - -
-{%- endif -%} +{% include "pr.md.j2" %} {%- endblock coverage_by_file %} - - {# Whole project coverage file report #} {%- block project_coverage_by_file -%} -{%- if complete_project_report %} -{%- if not coverage_files %} - -_No additional project files to report the coverage._ -{%- else -%} -
Click to see whole project coverage -
- - - {% if branch_coverage %}{% endif %} - - - {% if branch_coverage %}{% endif %} - - - - -{%- for coverage_file in coverage_files -%} - - - -{#- Statements cell -#} -{%- block project_statements_badge_cell scoped -%} -{{- statements_badge( - path=coverage_file.path, - statements_count=coverage_file.coverage.info.num_statements, - base=true, -) -}} -{%- endblock project_statements_badge_cell-%} - -{#- Missing cell -#} -{%- block project_missing_lines_badge_cell scoped -%} -{{- missing_lines_badge( - path=coverage_file.path, - missing_lines_count=coverage_file.coverage.info.missing_lines, - base=true, -) -}} -{%- endblock project_missing_lines_badge_cell -%} - -{% if branch_coverage %} -{#- Branches cell -#} -{%- block project_branches_badge_cell scoped -%} -{{- branches_badge( - path=coverage_file.path, - branches_count=coverage_file.coverage.info.num_branches, - base=true, -) -}} -{%- endblock project_branches_badge_cell -%} - -{#- Missing cell -#} -{%- block project_missing_branches_badge_cell scoped -%} -{{- missing_branches_badge( - path=coverage_file.path, - missing_branches_count=coverage_file.coverage.info.missing_branches, - base=true, -) -}} -{%- endblock project_missing_branches_badge_cell -%} -{% endif %} - -{#- Coverage cell -#} -{%- block project_coverage_rate_badge_cell scoped -%} -{{- coverage_rate_badge( - path=coverage_file.path, - percent_covered=coverage_file.coverage.info.percent_covered, - percent_covered_display=coverage_file.coverage.info.percent_covered_display, - covered_statements_count=coverage_file.coverage.info.covered_lines, - statements_count=coverage_file.coverage.info.num_statements, - base=true, -) -}} -{%- endblock project_coverage_rate_badge_cell -%} - -{#- Link to missing lines -#} -{%- block project_link_to_missing_lines_cell scoped -%} - - -{%- endblock project_link_to_missing_lines_cell -%} - -{#- Link to branch missing lines -#} -{%- if branch_coverage -%} -{%- block project_link_to_branches_missing_lines_cell scoped -%} - -{%- endblock project_link_to_branches_missing_lines_cell -%} -{%- endif -%} - - -{%- endfor -%} - - - - - - -{#- Statements cell -#} -{%- block project_statements_badge_total_cell scoped -%} -{{- statements_badge( - path="whole project", - statements_count=coverage.info.num_statements, -) -}} -{%- endblock project_statements_badge_total_cell -%} - -{#- Missing cell -#} -{%- block project_missing_lines_badge_total_cell scoped -%} -{{- missing_lines_badge( - path="the whole project", - missing_lines_count=coverage.info.missing_lines, -) -}} -{%- endblock project_missing_lines_badge_total_cell -%} - -{% if branch_coverage %} -{#- Branches cell -#} -{%- block project_branches_badge_total_cell scoped -%} -{{- branches_badge( - path="the whole project", - branches_count=coverage.info.num_branches, -) -}} -{%- endblock project_branches_badge_total_cell -%} - -{#- Missing cell -#} -{%- block project_missing_branches_badge_total_cell scoped -%} -{{- missing_branches_badge( - path="the whole project", - missing_branches_count=coverage.info.missing_branches, -) -}} -{%- endblock project_missing_branches_badge_total_cell -%} -{% endif %} - -{#- Coverage rate -#} -{%- block project_coverage_rate_badge_total_cell scoped -%} -{{- coverage_rate_badge( - path="the whole project", - percent_covered=coverage.info.percent_covered, - percent_covered_display=coverage.info.percent_covered_display, - covered_statements_count=coverage.info.covered_lines, - statements_count=coverage.info.num_statements, -) -}} -{%- endblock project_coverage_rate_badge_total_cell -%} - - -{% if branch_coverage %} - -{% endif %} - - -
FileStatementsMissingBranchesMissing
Coverage         

Lines missing              

Branches missing              
  {{ coverage_file.path }} - -{%- set comma = joiner() -%} -{%- for group in missing_lines_for_whole_project.get(coverage_file.path, []) -%} -{{- comma() -}} - - -{{- group.line_start -}} -{%- if group.line_start != group.line_end -%} -- -{{- group.line_end -}} -{%- endif -%} - - -{%- endfor -%} - -{%- set comma = joiner() -%} -{%- for branch in coverage_file.coverage.missing_branches -%} -{{- comma() -}} -{{- branch[0] | abs -}} -> {{- branch[1] | abs -}} -{%- endfor -%} -
Project Total  
-
-{%- endif -%} -{%- endif -%} +{% include "project.md.j2" %} {%- endblock project_coverage_by_file %} {%- block full_coverage_report -%} {%- if coverage_report_url %} -#### See the full coverage report of the project here. +

See the full coverage report of the project here.

{%- endif -%} {%- endblock full_coverage_report %} diff --git a/codecov/template_files/macros.md.j2 b/codecov/template_files/macros.md.j2 new file mode 100644 index 0000000..a1182a5 --- /dev/null +++ b/codecov/template_files/macros.md.j2 @@ -0,0 +1,54 @@ +{%- macro statements_badge(path, statements_count, base=false) -%} +{% set text = "The " ~ path ~ " contains " ~ statements_count ~ " statement" ~ (statements_count | pluralize) ~"." -%} +{% set color = "007ec6" -%} + +{%- endmacro -%} + +{%- macro branches_badge(path, branches_count, base=false) -%} +{% set text = "The " ~ path ~ " contains " ~ branches_count ~ " branch" ~ (branches_count | pluralize(plural='es')) ~"." -%} +{% set color = "008080" -%} + +{%- endmacro -%} + +{%- macro missing_branches_badge(path, missing_branches_count, base=false) -%} +{%- set text = missing_branches_count ~ " branch" ~ (missing_branches_count | pluralize(plural='es')) ~ " missing the coverage in " ~ path ~ "." -%} +{% if missing_branches_count == 0 -%} +{%- set color = "brightgreen" -%} +{% else -%} +{%- set color = "red" -%} +{% endif -%} + +{%- endmacro -%} + +{%- macro missing_lines_badge(path, missing_lines_count, base=false) -%} +{%- set text = missing_lines_count ~ " statement" ~ (statements_count | pluralize) ~ " missing the coverage in " ~ path ~ "." -%} +{% if missing_lines_count == 0 -%} +{%- set color = "brightgreen" -%} +{% else -%} +{%- set color = "red" -%} +{% endif -%} + +{%- endmacro -%} + +{%- macro coverage_rate_badge(path, percent_covered, percent_covered_display, covered_statements_count, statements_count, base=false) -%} +{%- set text = "The coverage rate of " ~ path ~ " is " ~ percent_covered_display ~ "% (" ~ covered_statements_count ~ "/" ~ statements_count ~ ")." -%} +{%- set label = percent_covered_display ~ "%" -%} +{%- set message = "(" ~ covered_statements_count ~ "/" ~ statements_count ~ ")" -%} +{%- set color = percent_covered | get_badge_color -%} + +{%- endmacro -%} + +{%- macro diff_coverage_rate_badge(path, added_statements_count, covered_statements_count, percent_covered) -%} +{% if added_statements_count -%} +{% set text = "In this PR, " ~ (added_statements_count) ~ " new statement" ~ (added_statements_count | pluralize) ~ " " ~ (added_statements_count | pluralize(singular='is', plural='are')) ~ " added to " ~ path ~ ", and " ~ covered_statements_count ~ " statement" ~ (covered_statements_count | pluralize) ~ " "~ (covered_statements_count | pluralize(singular='is', plural='are')) ~ " covered (" ~ (percent_covered | pct) ~ ")." -%} +{% set label = (percent_covered | pct(precision=0)) -%} +{% set message = "(" ~ covered_statements_count ~ "/" ~ added_statements_count ~ ")" -%} +{%- set color = (percent_covered | x100 | get_badge_color()) -%} +{% else -%} +{% set text = "This PR does not seem to add statements to " ~ path ~ "." -%} +{% set label = "" -%} +{%- set color = "grey" -%} +{% set message = "N/A" -%} +{% endif -%} + +{%- endmacro -%} diff --git a/codecov/template_files/pr.md.j2 b/codecov/template_files/pr.md.j2 new file mode 100644 index 0000000..c77688b --- /dev/null +++ b/codecov/template_files/pr.md.j2 @@ -0,0 +1,192 @@ +{%- if not files %} + +_This PR does not seem to contain any modification to coverable code._ +{%- else -%} +
Click to see coverage of changed files +
+ + + {% if branch_coverage %}{% endif %} + + + {% if branch_coverage %}{% endif %} + + + +{%- for parent, files_in_folder in files|groupby(attribute="path.parent") -%} + + + + +{%- for file in files_in_folder -%} +{%- set path = file.coverage.path -%} + + + +{#- Statements cell -#} +{%- block statements_badge_cell scoped -%} +{{- macros.statements_badge( + path=path, + statements_count=file.coverage.info.num_statements, +) -}} +{%- endblock statements_badge_cell-%} + +{#- Missing cell -#} +{%- block missing_lines_badge_cell scoped -%} +{{- macros.missing_lines_badge( + path=path, + missing_lines_count=file.coverage.info.missing_lines, +) -}} +{%- endblock missing_lines_badge_cell -%} + +{% if branch_coverage %} +{#- Branches cell -#} +{%- block branches_badge_cell scoped -%} +{{- macros.branches_badge( + path=path, + branches_count=file.coverage.info.num_branches, +) -}} +{%- endblock branches_badge_cell -%} + +{#- Missing cell -#} +{%- block missing_branches_badge_cell scoped -%} +{{- macros.missing_branches_badge( + path=path, + missing_branches_count=file.coverage.info.missing_branches, +) -}} +{%- endblock missing_branches_badge_cell -%} +{% endif %} + +{#- Coverage rate -#} +{%- block coverage_rate_badge_cell scoped -%} +{{- macros.coverage_rate_badge( + path=path, + percent_covered=file.coverage.info.percent_covered, + percent_covered_display=file.coverage.info.percent_covered_display, + covered_statements_count=file.coverage.info.covered_lines, + statements_count=file.coverage.info.num_statements, +) -}} +{%- endblock coverage_rate_badge_cell -%} + +{#- Coverage of added lines (new stmts) -#} +{%- block diff_coverage_rate_badge_cell scoped -%} +{{- macros.diff_coverage_rate_badge( + path=path, + added_statements_count=((file.diff.added_statements | length) if file.diff else none), + covered_statements_count=((file.diff.covered_statements | length) if file.diff else none), + percent_covered=(file.diff.percent_covered if file.diff else none) +) -}} +{%- endblock diff_coverage_rate_badge_cell -%} + +{#- Link to lines missing -#} +{%- block link_to_missing_diff_lines_cell scoped -%} + + +{%- endblock link_to_missing_diff_lines_cell -%} + +{#- Link to branch missing lines -#} +{%- if branch_coverage -%} +{%- block link_to_branches_missing_lines_cell scoped -%} + +{%- endblock link_to_branches_missing_lines_cell -%} +{%- endif -%} + + +{%- endfor -%} +{%- endfor -%} + + + + + + +{#- Statements cell -#} +{%- block statements_badge_total_cell scoped -%} +{{- macros.statements_badge( + path="whole project", + statements_count=coverage.info.num_statements, +) -}} +{%- endblock statements_badge_total_cell -%} + +{#- Missing cell -#} +{%- block missing_lines_badge_total_cell scoped -%} +{{- macros.missing_lines_badge( + path="the whole project", + missing_lines_count=coverage.info.missing_lines, +) -}} +{%- endblock missing_lines_badge_total_cell -%} + +{% if branch_coverage %} +{#- Branches cell -#} +{%- block branches_badge_total_cell scoped -%} +{{- macros.branches_badge( + path="the whole project", + branches_count=coverage.info.num_branches, +) -}} +{%- endblock branches_badge_total_cell -%} + +{#- Missing cell -#} +{%- block missing_branches_badge_total_cell scoped -%} +{{- macros.missing_branches_badge( + path="the whole project", + missing_branches_count=coverage.info.missing_branches, +) -}} +{%- endblock missing_branches_badge_total_cell -%} +{% endif %} + +{#- Coverage rate -#} +{%- block coverage_rate_badge_total_cell scoped -%} +{{- macros.coverage_rate_badge( + path="the whole project", + percent_covered=coverage.info.percent_covered, + percent_covered_display=coverage.info.percent_covered_display, + covered_statements_count=coverage.info.covered_lines, + statements_count=coverage.info.num_statements, +) -}} +{%- endblock coverage_rate_badge_total_cell -%} + +{# Coverage of added lines #} +{%- block diff_coverage_rate_badge_total_cell scoped -%} +{{- macros.diff_coverage_rate_badge( + path="the whole project", + added_statements_count=diff_coverage.total_num_lines, + covered_statements_count=(diff_coverage.total_num_lines-diff_coverage.total_num_violations), + percent_covered=diff_coverage.total_percent_covered, +) -}} +{%- endblock diff_coverage_rate_badge_total_cell -%} + + +{% if branch_coverage %} + +{% endif %} + + +
FileStatementsMissingBranchesMissing
Coverage         
Coverage         
(new stmts)

Lines missing              

Branches missing              
  {{ parent }}
  {{ path.name }} + +{%- set comma = joiner() -%} +{%- for group in missing_diff_lines.get(path, []) -%} +{{- comma() -}} + + +{{- group.line_start -}} +{%- if group.line_start != group.line_end -%} +- +{{- group.line_end -}} +{%- endif -%} + + +{%- endfor -%} + +{%- set comma = joiner() -%} +{%- for branch in file.coverage.missing_branches -%} +{{- comma() -}} +{{- branch[0] | abs -}} -> {{- branch[1] | abs -}} +{%- endfor -%} +
Project Total  
+ +{%- if max_files and count_files > max_files %} +_The report is truncated to {{ max_files }} files out of {{ count_files }}. +{% endif %} + +
+{%- endif -%} diff --git a/codecov/template_files/project.md.j2 b/codecov/template_files/project.md.j2 new file mode 100644 index 0000000..7d42baa --- /dev/null +++ b/codecov/template_files/project.md.j2 @@ -0,0 +1,176 @@ +{%- if complete_project_report %} +{%- if not coverage_files %} + +_No additional project files to report the coverage._ +{%- else -%} +
Click to see whole project coverage +
+ + + {% if branch_coverage %}{% endif %} + + + {% if branch_coverage %}{% endif %} + + + + + +{%- for parent, coverage_files_in_folder in coverage_files|groupby(attribute="path.parent") -%} + + + + +{%- for coverage_file in coverage_files_in_folder -%} +{%- set coverage_file_path = coverage_file.coverage.path -%} + + + +{#- Statements cell -#} +{%- block project_statements_badge_cell scoped -%} +{{- macros.statements_badge( + path=coverage_file_path, + statements_count=coverage_file.coverage.info.num_statements, + base=true, +) -}} +{%- endblock project_statements_badge_cell-%} + +{#- Missing cell -#} +{%- block project_missing_lines_badge_cell scoped -%} +{{- macros.missing_lines_badge( + path=coverage_file_path, + missing_lines_count=coverage_file.coverage.info.missing_lines, + base=true, +) -}} +{%- endblock project_missing_lines_badge_cell -%} + +{% if branch_coverage %} +{#- Branches cell -#} +{%- block project_branches_badge_cell scoped -%} +{{- macros.branches_badge( + path=coverage_file_path, + branches_count=coverage_file.coverage.info.num_branches, + base=true, +) -}} +{%- endblock project_branches_badge_cell -%} + +{#- Missing cell -#} +{%- block project_missing_branches_badge_cell scoped -%} +{{- macros.missing_branches_badge( + path=coverage_file_path, + missing_branches_count=coverage_file.coverage.info.missing_branches, + base=true, +) -}} +{%- endblock project_missing_branches_badge_cell -%} +{% endif %} + +{#- Coverage cell -#} +{%- block project_coverage_rate_badge_cell scoped -%} +{{- macros.coverage_rate_badge( + path=coverage_file_path, + percent_covered=coverage_file.coverage.info.percent_covered, + percent_covered_display=coverage_file.coverage.info.percent_covered_display, + covered_statements_count=coverage_file.coverage.info.covered_lines, + statements_count=coverage_file.coverage.info.num_statements, + base=true, +) -}} +{%- endblock project_coverage_rate_badge_cell -%} + +{#- Link to missing lines -#} +{%- block project_link_to_missing_lines_cell scoped -%} + + +{%- endblock project_link_to_missing_lines_cell -%} + +{#- Link to branch missing lines -#} +{%- if branch_coverage -%} +{%- block project_link_to_branches_missing_lines_cell scoped -%} + +{%- endblock project_link_to_branches_missing_lines_cell -%} +{%- endif -%} + + +{%- endfor -%} +{%- endfor -%} + + + + + + +{#- Statements cell -#} +{%- block project_statements_badge_total_cell scoped -%} +{{- macros.statements_badge( + path="whole project", + statements_count=coverage.info.num_statements, +) -}} +{%- endblock project_statements_badge_total_cell -%} + +{#- Missing cell -#} +{%- block project_missing_lines_badge_total_cell scoped -%} +{{- macros.missing_lines_badge( + path="the whole project", + missing_lines_count=coverage.info.missing_lines, +) -}} +{%- endblock project_missing_lines_badge_total_cell -%} + +{% if branch_coverage %} +{#- Branches cell -#} +{%- block project_branches_badge_total_cell scoped -%} +{{- macros.branches_badge( + path="the whole project", + branches_count=coverage.info.num_branches, +) -}} +{%- endblock project_branches_badge_total_cell -%} + +{#- Missing cell -#} +{%- block project_missing_branches_badge_total_cell scoped -%} +{{- macros.missing_branches_badge( + path="the whole project", + missing_branches_count=coverage.info.missing_branches, +) -}} +{%- endblock project_missing_branches_badge_total_cell -%} +{% endif %} + +{#- Coverage rate -#} +{%- block project_coverage_rate_badge_total_cell scoped -%} +{{- macros.coverage_rate_badge( + path="the whole project", + percent_covered=coverage.info.percent_covered, + percent_covered_display=coverage.info.percent_covered_display, + covered_statements_count=coverage.info.covered_lines, + statements_count=coverage.info.num_statements, +) -}} +{%- endblock project_coverage_rate_badge_total_cell -%} + + +{% if branch_coverage %} + +{% endif %} + + +
FileStatementsMissingBranchesMissing
Coverage         

Lines missing              

Branches missing              
  {{ parent }}
  {{ coverage_file_path.name }} + +{%- set comma = joiner() -%} +{%- for group in missing_lines_for_whole_project.get(coverage_file_path, []) -%} +{{- comma() -}} + + +{{- group.line_start -}} +{%- if group.line_start != group.line_end -%} +- +{{- group.line_end -}} +{%- endif -%} + + +{%- endfor -%} + +{%- set comma = joiner() -%} +{%- for branch in coverage_file.coverage.missing_branches -%} +{{- comma() -}} +{{- branch[0] | abs -}} -> {{- branch[1] | abs -}} +{%- endfor -%} +
Project Total  
+
+{%- endif -%} +{%- endif -%}