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

Adds summary statistics to coverage report #5474

Merged

Conversation

jorgecarleitao
Copy link
Contributor

@jorgecarleitao jorgecarleitao commented Sep 23, 2018

Subject: Adds a table with a summary of the coverage report:

+-----------------------+----------+--------------+
| Module                | Coverage | Undocumented |
+=======================+==========+==============+
| schemaflow.exceptions | 100.00%  | 0            |
+-----------------------+----------+--------------+
| schemaflow.pipe       | 83.33%   | 1            |
+-----------------------+----------+--------------+
| schemaflow.pipeline   | 100.00%  | 0            |
+-----------------------+----------+--------------+
| schemaflow.types      | 70.00%   | 3            |
+-----------------------+----------+--------------+
| TOTAL                 | 82.61%   | 4            |
+-----------------------+----------+--------------+

Feature or Bugfix

  • Feature

Purpose

The current implementation of ext.coverage outputs which methods/classes/functions are documented. This PR adds a short summary of this report in terms of documented objects / total number of objects, both per module and total.

The purpose of this is to support a currently not mainstream but relevant use-case: a coverage report on the number of objects that are documented.

By having the statistics on the report or on the stdout, a regex expression can capture the coverage percentage (re.search(r'TOTAL.*?([0-9.]{4,6}\%)', d).group(1) in Python regex) and use it e.g. as another CI report, in a Badge, etc.

The current version of this PR does not do anything by default to not break backward compatibility. Two options were added to the configuration to allow a table to be outputted to the report and/or to stdout.

There are still steps missing:

  1. simplify code
  2. unit-test
  3. documentation

however, I have the following questions before proceeding:

  1. is this something that you would like to have?
  2. should we make the coverage report to contain the statistics by default?
  3. should we make the coverage to output the table to stdout by default?

My hypothesis is that the answer is affirmative for all 3 cases: the most common usage of coverage is to know how the coverage of docs is and a nice table as output seems a good output for the command. However, I am not sure about backward compatibility.

Temporary while decision is made to go forward, on which
tests must be written.
@codecov
Copy link

codecov bot commented Sep 25, 2018

Codecov Report

Merging #5474 into master will decrease coverage by 0.11%.
The diff coverage is 25.92%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5474      +/-   ##
==========================================
- Coverage   83.07%   82.95%   -0.12%     
==========================================
  Files         289      291       +2     
  Lines       38820    38886      +66     
  Branches     5840     5854      +14     
==========================================
+ Hits        32250    32259       +9     
- Misses       5207     5255      +48     
- Partials     1363     1372       +9
Impacted Files Coverage Δ
tests/test_ext_coverage.py 100% <100%> (ø) ⬆️
sphinx/ext/coverage.py 65.98% <24.52%> (-10.86%) ⬇️
sphinx/environment/__init__.py 76.71% <0%> (-1.57%) ⬇️
sphinx/environment/collectors/__init__.py 77.77% <0%> (-1.17%) ⬇️
sphinx/locale/__init__.py 76.76% <0%> (-0.33%) ⬇️
sphinx/environment/collectors/asset.py 91.46% <0%> (-0.11%) ⬇️
sphinx/cmd/quickstart.py 66.86% <0%> (-0.1%) ⬇️
sphinx/registry.py 74.46% <0%> (-0.1%) ⬇️
sphinx/util/__init__.py 67.97% <0%> (-0.08%) ⬇️
sphinx/application.py 77.74% <0%> (-0.07%) ⬇️
... and 29 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 408219c...453aed3. Read the comment docs.

@jorgecarleitao jorgecarleitao changed the title WIP: Added statistics to coverage report Adds summary statistics to coverage report Sep 27, 2018
@AA-Turner AA-Turner added type:enhancement enhance or introduce a new feature extensions labels May 23, 2022
@AA-Turner AA-Turner added this to the some future version milestone May 23, 2022
@AA-Turner AA-Turner changed the base branch from master to 5.x October 5, 2022 13:34
@AA-Turner
Copy link
Member

Probably need to bump the env version here so that old pickle files are ignored.

A

@AA-Turner AA-Turner changed the base branch from 5.x to master October 16, 2022 15:23
sphinx/ext/coverage.py Outdated Show resolved Hide resolved
@AA-Turner AA-Turner merged commit 99f9209 into sphinx-doc:master Jul 28, 2023
27 checks passed
@AA-Turner
Copy link
Member

Thank you @jorgecarleitao!

A

@AA-Turner AA-Turner modified the milestones: some future version, 7.2.0 Aug 11, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
extensions type:enhancement enhance or introduce a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants