-
Notifications
You must be signed in to change notification settings - Fork 122
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
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Dummy body of the summary PR comment. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/* | ||
This should be called via nodejs from the repo root folder. | ||
|
||
node .github/scripts/pr_comment.test.js | ||
|
||
This is just a poor man's testing code for the script. | ||
Since the project is mostly python, is not easy to add nodeenv and a full | ||
testing suite like jest. | ||
*/ | ||
const process = require('process'); | ||
|
||
process.env.GITHUB_WORKSPACE = process.cwd() | ||
process.env.COMMENT_BODY = '.github/scripts/pr_comment.test.body.txt' | ||
process.env.REPORT_JSON = '.github/scripts/pr_comment.test.report.json' | ||
process.env.COMMENT_MARKER = '<!--- comment-marker -->' | ||
|
||
const script = require(process.cwd() + '/.github/scripts/pr_comment.js') | ||
const retry_delay = 0.1 | ||
|
||
var github = { | ||
issues: { | ||
listComments: (options) => { | ||
console.log('Retrieving comments...') | ||
console.log(options) | ||
return {data: [ | ||
{'id': 980, 'body': 'some-other-comment'}, | ||
// Comment the line below to trigger creating a new comment. | ||
{'id': 456, 'body': 'comment marker\n<!--- comment-marker -->'}, | ||
{'body': 'another-other-comment'}, | ||
|
||
]} | ||
}, | ||
updateComment: (options) => { | ||
console.log('Updating existing comment...') | ||
console.log(options) | ||
}, | ||
createComment: (options) => { | ||
console.log('Creating new comment...') | ||
console.log(options) | ||
}, | ||
}, | ||
pulls: { | ||
listReviews: (options) => { | ||
console.log('Listing existing reviews...') | ||
console.log(options) | ||
return {data: [ | ||
{'id': 120, 'body': 'some-other-pr-review'}, | ||
// Comment the line below to trigger creating a new comment. | ||
{'id': 156, 'body': 'review marker\n<!--- comment-marker -->'}, | ||
]} | ||
}, | ||
listReviewComments: (options) => { | ||
console.log('Listing existing review comments...') | ||
console.log(options) | ||
return {data: [ | ||
{'id': 120, 'body': 'some-other-pr-review'}, | ||
// Comment the line below to trigger creating a new comment. | ||
{'id': 156, 'body': 'review marker\n<!--- comment-marker -->'}, | ||
]} | ||
}, | ||
createReviewComment: (options) => { | ||
console.log('Creating new review comment...') | ||
console.log(options) | ||
}, | ||
deleteReviewComment: (options) => { | ||
console.log('Deleting review comment...') | ||
console.log(options) | ||
}, | ||
createReview: (options) => { | ||
console.log('Creating new review...') | ||
console.log(options) | ||
}, | ||
}, | ||
} | ||
|
||
var context = { | ||
eventName: 'pull_request', | ||
repo: { | ||
owner: 'dummy-org', | ||
repo: 'dummy-repo', | ||
}, | ||
payload: { | ||
number: 123, | ||
after: '123abc567', | ||
} | ||
} | ||
|
||
|
||
script({github, context, process, retry_delay}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"report_name": "File generate by diff-cover --json-report out.json", "diff_name": "trunk...HEAD, staged and unstaged changes", "src_stats": {"src/towncrier/build.py": {"percent_covered": 22.222222222222214, "violation_lines": [123, 125, 126, 138, 140, 141, 142], "violations": [[123, null], [125, null], [126, null], [138, null], [140, null], [141, null], [142, null]]}}, "total_num_lines": 9, "total_num_violations": 7, "total_percent_covered": 22, "num_changed_lines": 185} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,6 +119,12 @@ def __main( | |
|
||
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 | ||
|
@@ -128,6 +134,13 @@ def __main( | |
) | ||
fragment_directory = "newsfragments" | ||
|
||
if directory == "sdfasdf": | ||
bla = "some line not covered" | ||
# a comment | ||
bla = "some line not covered" | ||
bla = "some line not covered" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing coverage. |
||
fragment_directory = bla | ||
|
||
fragment_contents, fragment_filenames = find_fragments( | ||
fragment_base_directory, | ||
config.sections, | ||
|
Empty file.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing coverage.