-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
[format] Using Black #7769
[format] Using Black #7769
Conversation
I've been meaning to do this for a while. Black is the way to go. We could do a 2 phase rollout with Happy to just byte the bullet and go for it. +1 |
@mistercrunch I can try the two phase rollout to minimize the change. Regarding |
04c0fa7
to
83bbfab
Compare
Codecov Report
@@ Coverage Diff @@
## master #7769 +/- ##
==========================================
- Coverage 65.71% 65.71% -0.01%
==========================================
Files 459 459
Lines 21981 21980 -1
Branches 2415 2415
==========================================
- Hits 14445 14444 -1
Misses 7415 7415
Partials 121 121
Continue to review full report at Codecov.
|
Now thinking about it I'm thinking making it straight black is best, two phases would just be more confusing... There will be lots of conflicts, but resolving them is easy: just run black. |
@mistercrunch are you ok with me merging this? I realize that the PR will cause a number of conflicts in existing PRs, though as you pointed out, resolving these are trivial. |
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.
LGTM - deterministic code style FTW!
ecaa317
to
0f249a4
Compare
CATEGORY
Choose one
SUMMARY
Though for Python we currently use
flake8
andpylint
for linting and error checking these don't auto-format the code and thus it's still relatively hard to try to enforce a common code style/format.There seems to be three main auto-formatters:
Here's a fairly good comparison of the three tools. Note that YAPF supports a number of styles including "pep8" (which is what autopep8 uses). The "Facebook" style is similar to Black.
Though I don't necessarily agree with all of Black's style formatting (including the 88 character line length, non-trailing commas, double-quotes, etc.) it seems this has gained popularity(it currently has over 11,000 GitHub stars) over the likes of YAPF mostly because it isn't configurable (and thus ensures consistency) which is a plus if the goal is to align on a style/format across numerous repos.
This PR performs the following:
Note the
flake8
andpylint
CI remains asflake8
includes checks for import ordering as well as type checking.pylint
additionally checks for numerous errors. In the future there would be merit in further cleaning up the code and reducing the number offlake8
codes we ignore.TEST PLAN
CI.
ADDITIONAL INFORMATION
REVIEWERS
to: @betodealmeida @michellethomas @mistercrunch @villebro