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

Use black to auto format code #710

Closed
wants to merge 3 commits into from
Closed

Use black to auto format code #710

wants to merge 3 commits into from

Conversation

SanketDG
Copy link
Contributor

@SanketDG SanketDG commented Aug 5, 2020

Description

Use black to reformat code, and add instructions for README

Fixes #701

Type of Change:

  • Code

Code/Quality Assurance Only

  • New feature (non-breaking change which adds functionality pre-approved by mentors)

Checklist:

  • My PR follows the style guidelines of this project
  • I have performed a self-review of my own code or materials
  • I have commented my code or provided relevant documentation, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • Any dependent changes have been merged
  • Update Postman API at /docs folder
  • Update Swagger documentation and the exported file at /docs folder
  • Update requirements.txt ( I did not do this because requirements.txt should only contain production + dev deps and I also didn't want to pin a specific version of linting tool )

Code/Quality Assurance Only

  • My changes generate no new warnings
  • My PR currently breaks something (fix or feature that would cause existing functionality to not work as expected)
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been published in downs

@SanketDG SanketDG requested a review from isabelcosta August 5, 2020 13:22
@codecov
Copy link

codecov bot commented Aug 5, 2020

Codecov Report

Merging #710 into develop will not change coverage.
The diff coverage is 90.90%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop     #710   +/-   ##
========================================
  Coverage    95.84%   95.84%           
========================================
  Files           95       95           
  Lines         5200     5200           
========================================
  Hits          4984     4984           
  Misses         216      216           
Impacted Files Coverage Δ
app/api/dao/admin.py 95.91% <ø> (ø)
app/api/models/user.py 100.00% <ø> (ø)
app/api/resources/admin.py 88.13% <ø> (ø)
app/database/models/task_comment.py 95.00% <ø> (ø)
app/schedulers/delete_unverified_users_cron_job.py 100.00% <ø> (ø)
app/utils/validation_utils.py 100.00% <ø> (ø)
tests/admin/test_api_remove_admin_user.py 98.21% <ø> (ø)
tests/tasks/test_dao_create_task.py 96.87% <ø> (ø)
tests/test_data.py 100.00% <ø> (ø)
tests/users/test_api_get_other_user.py 97.05% <ø> (ø)
... and 17 more

@isabelcosta
Copy link
Member

@SanketDG can you add the rest of the PR template in your description (relevant parts only)?

@SanketDG
Copy link
Contributor Author

SanketDG commented Aug 6, 2020

@isabelcosta Done!

@isabelcosta
Copy link
Member

@SanketDG any idea on why this lowers the code coverage by 5%? I feel we have no way around it right 🤔
I am just curious, if we can't go around it, I am ok and can approve

@SanketDG
Copy link
Contributor Author

SanketDG commented Aug 6, 2020

It does not seem to pick up the diff correctly, that's strange. We might have to go with the warning 🙁

@isabelcosta
Copy link
Member

@Tlazypanda do you know why style fixes would lower the test coverage? 🤔
If we don't find out why, but the code works fine, I will still merge it I guess.

@Tlazypanda
Copy link
Contributor

Hey @isabelcosta the codecov report above shows no change am I missing something? 😅

@isabelcosta
Copy link
Member

@Tlazypanda true 😅 but the code cov check for patch is failing somehow 🤔

@isabelcosta
Copy link
Member

@SanketDG will you do the GH action step for black formatting on a separate PR or this one?

@SanketDG
Copy link
Contributor Author

@isabelcosta Updated!

Unfortunately, Black's github action does not work now 🙁 , it needs a new release psf/black#1520

We can choose to proceed with one of the hacks as mentioned in the issue to get this merged.

@Tlazypanda
Copy link
Contributor

Hey @isabelcosta @SanketDG Ohh my bad I didn't see the test just the comment 😅 I started digging through the issue and found that the codecov/patch check sometimes results in incorrect results and other Opensource orgs have also raised issues to disable this check and only check the codecov/project check for measuring code coverage 😅 Here are some references:-
mozilla-mobile/firefox-tv#779
kata-containers/tests#508

Should we go ahead and remove this check as these Orgs have also done? Thanks ✌️

@SanketDG
Copy link
Contributor Author

SanketDG commented Aug 14, 2020

@Tlazypanda Oh interesting! I think we do not need to switch it off since it will work correctly in most cases, but just make the "right" decision to merge the PR irrespective of a false positive check failing.

@isabelcosta
Copy link
Member

@Tlazypanda thank you so much for taking a deeper look at the issue!
@SanketDG can you make the GH action for linting work? do you need any help on it?

@SanketDG
Copy link
Contributor Author

Been travelling for the past three days

@isabelcosta This is updated!

isabelcosta
isabelcosta previously approved these changes Aug 18, 2020
Copy link
Member

@isabelcosta isabelcosta left a comment

Choose a reason for hiding this comment

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

Great work @SanketDG 👏 🎉 So excited about this!

@isabelcosta isabelcosta requested review from a team, rpattath, urvashigupta7, foongminwong, gaurivn and Tlazypanda and removed request for a team August 21, 2020 00:40
@isabelcosta isabelcosta added the Status: Needs Review PR needs an additional review or a maintainer's review. label Aug 21, 2020
@isabelcosta isabelcosta requested review from ramitsawhney27 and removed request for urvashigupta7 August 28, 2020 22:26
@SanketDG SanketDG mentioned this pull request Nov 18, 2020
4 tasks
@SanketDG
Copy link
Contributor Author

This has gone stale after a cleanup so I have opened #928

@SanketDG SanketDG closed this Nov 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Review PR needs an additional review or a maintainer's review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Integrate black and black's github action
3 participants