Skip to content

Adding files flag and fixing bug with return code#28

Merged
vsoch merged 1 commit into
masterfrom
add/files-flag
Apr 10, 2020
Merged

Adding files flag and fixing bug with return code#28
vsoch merged 1 commit into
masterfrom
add/files-flag

Conversation

@vsoch

@vsoch vsoch commented Apr 10, 2020

Copy link
Copy Markdown
Collaborator

This PR will address the following issues:

There is more work to be done with other issues, but these issues need to be triaged to fix the currently broken library and action.

Signed-off-by: vsoch vsochat@stanford.edu

@codecov

codecov Bot commented Apr 10, 2020

Copy link
Copy Markdown

Codecov Report

Merging #28 into master will decrease coverage by 0.62%.
The diff coverage is 53.12%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #28      +/-   ##
==========================================
- Coverage   72.94%   72.31%   -0.63%     
==========================================
  Files          15       15              
  Lines         499      513      +14     
==========================================
+ Hits          364      371       +7     
- Misses        135      142       +7     
Impacted Files Coverage Δ
urlchecker/core/urlproc.py 88.88% <ø> (+1.85%) ⬆️
urlchecker/core/whitelist.py 100.00% <ø> (ø)
urlchecker/main/github.py 100.00% <ø> (ø)
urlchecker/client/check.py 25.00% <9.09%> (-2.28%) ⬇️
urlchecker/logger.py 42.85% <50.00%> (ø)
urlchecker/core/fileproc.py 89.28% <75.00%> (-4.47%) ⬇️
urlchecker/client/__init__.py 75.92% <100.00%> (+0.45%) ⬆️
urlchecker/core/check.py 83.33% <100.00%> (ø)
urlchecker/version.py 100.00% <100.00%> (ø)

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 cec4424...a49b28d. Read the comment docs.

@vsoch

vsoch commented Apr 10, 2020

Copy link
Copy Markdown
Collaborator Author

@SuperKogito please review but let's not address code cov for now, this is an urgent fix because the library and action have a bu.

@vsoch

vsoch commented Apr 10, 2020

Copy link
Copy Markdown
Collaborator Author

@SuperKogito did you mean to review this, or just thumbs up?

@SuperKogito SuperKogito left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The PR looks good overall, I have one comment to the force pass bug.
The rest looks okay and since they passed the tests it should be fine.

for failed_url in check_results["failed"]:
print_failure(failed_url)
sys.exit(1)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This will work fine but the final output is very helpful and the force pass is more about the sys.exit(). Wouldn't it make sense, to keep the print and just change the exit status?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

What do you mean? The print is still there, the change just shows changing the quotation style.

@SuperKogito SuperKogito Apr 10, 2020

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

no I mean in case there is force pass is true, and there are failed links, the urlchecker will force the pass but no urls are printed, which actually helpful to see imo. idk if is that big, might be a matter of preference. My idea is that the force pass is just to exit with 1 and it should not change the prints.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Oh I understand! Yes let me fix this now. You'll need to approve it again so don't approve it again yet :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

okay perfect ;)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

okay take a look!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I think I might have run it accidentally, but the code is so neat the changes were very minimal!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am just asking because I noticed that we use different styles and it might be good for the future to figure out a general standard ;)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I used to have my own weird style many years ago, and then I was using pylint for a while (and it was quite arduous) and when I noticed snakemake using black, and then tried it myself and thought that it made the code lovely, I started using black. It does have minor changes between versions, but it's so easy to use and add to CI I use it for most of my python projects. Locally I just do:

black <project>

and then in CI you can do:

black --check <project>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I personally like https://github.com/google/yapf but I also have my hybrid style based on some weird preferences that I am trying to get rid of xD I will take a look at black -which is trending these days- and see how is it.

@SuperKogito

Copy link
Copy Markdown
Member

The thumbs up = as in I am reviewing it. The force-pass comment, do you want to address it/discuss it now or in a separate issue?

SuperKogito
SuperKogito previously approved these changes Apr 10, 2020
@vsoch

vsoch commented Apr 10, 2020

Copy link
Copy Markdown
Collaborator Author

@SuperKogito the bug was that the force-pass needed a not before it, so the bug is fixed here. What are you referring to specifically?

I just pushed a commit that updates the README.md to include the new flag, and fixes a spelling mistake I saw for save so you'll have to approve again :)

@SuperKogito

Copy link
Copy Markdown
Member

I just explained this a bit in the review thread/ comments.

Signed-off-by: vsoch <vsochat@stanford.edu>
@vsoch vsoch requested a review from SuperKogito April 10, 2020 19:58

# Case 1: We didn't find any urls to check
if not check_results['failed'] and not check_results['passed']:
if not check_results["failed"] and not check_results["passed"]:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@SuperKogito I hope this better matches what you had in mind:

  1. If there aren't any passing or failing urls, we exit with code 0
  2. If there are failed urls, regardless of force pass, we print them for the user in red
  3. Then if there are failed and there is no force pass, we exit with error
  4. Finally, we exit with 0 (the last condition given that there are either failed urls with force pass, or there were none) but we modify the message printed so the user knows if it was a conditional pass.

@SuperKogito SuperKogito left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks correct 👍 👏

@vsoch

vsoch commented Apr 10, 2020

Copy link
Copy Markdown
Collaborator Author

Woot! Let's get this deployed, I'll open my PR for urlchecker-action asap!

@vsoch vsoch merged commit 6b754eb into master Apr 10, 2020
@vsoch vsoch deleted the add/files-flag branch April 10, 2020 20:14
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.

2 participants