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

Update coverage report to add inline PR comments. #451

Closed
wants to merge 3 commits into from

Conversation

adiroiban
Copy link
Member

@adiroiban adiroiban commented Nov 6, 2022

Description

Fixes #450

Try to add inline comments for PR coverage

To make it easier to develop. I added some testing code for JS.
I guess that if all is ok, we can move it into a separate dedicated shared action.

In theory, we can convert this to Python code.

@adiroiban adiroiban changed the title 450 coverage pr inline comments Update coverage report to add inline PR comments. Nov 6, 2022
@adiroiban adiroiban marked this pull request as draft November 6, 2022 14:55
@codecov
Copy link

codecov bot commented Nov 6, 2022

Codecov Report

Base: 100.00% // Head: 99.44% // Decreases project coverage by -0.55% ⚠️

Coverage data is based on head (e847dc8) compared to base (9554985).
Patch coverage: 0.00% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff             @@
##             trunk     #451      +/-   ##
===========================================
- Coverage   100.00%   99.44%   -0.56%     
===========================================
  Files           22       22              
  Lines         1607     1616       +9     
  Branches       286      288       +2     
===========================================
  Hits          1607     1607              
- Misses           0        7       +7     
- Partials         0        2       +2     
Impacted Files Coverage Δ
src/towncrier/build.py 90.21% <0.00%> (-9.79%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@adiroiban adiroiban force-pushed the 450-coverage-pr-inline-comments branch from 83a9401 to 64e9c0e Compare November 6, 2022 15:01
@github-actions
Copy link

github-actions bot commented Nov 6, 2022

Name                     Stmts   Miss Branch BrPart  Cover   Missing
--------------------------------------------------------------------
src/towncrier/build.py      92      7     28      2    92%   123-126, 138-142
--------------------------------------------------------------------
TOTAL                     1616      7    234      2    99%

22 files skipped due to complete coverage.

Diff Coverage

Diff: origin/trunk...HEAD, staged and unstaged changes

  • src/towncrier/build.py (22.2%): Missing lines 123,125-126,138,140-142

Summary

  • Total: 9 lines
  • Missing: 7 lines
  • Coverage: 22%

src/towncrier/build.py

Lines 119-130

    click.echo("Finding news fragments...", err=to_err)

    if directory == "sdfafsdfasd":
        bla = "some line not covered"
        # a comment
        bla = "some line not covered"
        bla = "some line not covered"

    if config.directory is not None:
        fragment_base_directory = os.path.abspath(config.directory)
        fragment_directory = None

Lines 134-146

        )
        fragment_directory = "newsfragments"

    if directory == "sdfasdf":
        bla = "some line not covered"
        # a comment
        bla = "some line not covered"
        bla = "some line not covered"
        fragment_directory = bla

    fragment_contents, fragment_filenames = find_fragments(
        fragment_base_directory,
        config.sections,

@adiroiban adiroiban force-pushed the 450-coverage-pr-inline-comments branch from 5bd0965 to 7bb88f4 Compare November 6, 2022 15:14
bla = "some line not covered"
# a comment
bla = "some line not covered"
bla = "some line not covered"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing coverage.

@adiroiban adiroiban force-pushed the 450-coverage-pr-inline-comments branch from f41363d to e847dc8 Compare November 6, 2022 15:42
@@ -119,6 +119,12 @@

click.echo("Finding news fragments...", err=to_err)

if directory == "sdfafsdfasd":
bla = "some line not covered"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing coverage.

@adiroiban
Copy link
Member Author

I see that codecov.io is not using PR comments, but commit check warnings

image

I will continue working on this and try to use the checks API

@adiroiban
Copy link
Member Author

I tried to see how to use the GitHub Check Annotations, but it is not clear how to add annotations

https://docs.github.com/en/rest/checks/runs#list-check-run-annotations

At the same time, I think that we should not rely too much on GitHub Api.

Instead, we should dedicated our time to improve the diff-cover project so that the markdown report is helpful.

I am going to close this PR.

@adiroiban adiroiban closed this Nov 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Have inline PR comments for coverage
1 participant