-
-
Notifications
You must be signed in to change notification settings - Fork 944
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
style: adopt black #1876
style: adopt black #1876
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1876 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 63 63
Lines 6610 6610
Branches 1067 1067
=========================================
Hits 6610 6610
Continue to review full report at Codecov.
|
I am going to delay this for post 3.0 but I do think we should move in this direction. Let's just make sure we have as part of the process a review to tweak the occasional oddity. |
yes sure, I was not targeting this release, it was just to start looking into it |
a742c49
to
9d1de91
Compare
I've updated the change with the latest black. Regarding the line length it can easily customized. I personally usually use 100, but also black default of 88 is fine. I find 79-80 a bit on the narrow side. |
The default of 88 is fine, and avoids excessive line wrapping esp. for deeply nested control structures. If we increased the limit much further I would argue for a separate standard for keeping comments shorter (even if we have to write our own checker for it). Regardless, I'll take a look through the diff soon and see how things look now. |
I'll re-reun with the 88 line. If you are not familiar with black, note that you can tell it to split things in multiple lines by setting a comma at the end. def foo(x,):
pass
# becomes
def foo(
x,
):
pass So we may need to add / remove some to get the desired formatting. |
I'm a bit orthodox when it comes to line length, 100+ sounds a bit too long. But I'm fine with |
Ok, I initially went with 100 both because we do have some lines that are on the long side in the source and it's what I usually use. I'll re-run with the default 88 and update this. |
Updated with 88. From the change lines it seems that our average line was a bit longer, since this version adds a 1000 new lines. For reference the previous with length 100 was more or less a wash regarding line count |
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.
Comments inline. I am still favorable to adopting black modulo a few tweaks. Also, note that f we miss any strange formatting issues before merging this, we can always fix those up over time, as we discover them in the course of maintaining the project.
I'll wait for #1709 before rebasing and polishing this |
@@ -85,7 +85,7 @@ filterwarnings = | |||
[flake8] | |||
max-complexity = 15 | |||
exclude = .ecosystem,.eggs,.git,.tox,.venv,build,dist,docs,examples,falcon/bench/nuts | |||
ignore = F403,W504 | |||
extend-ignore = F403,W504,E203,I202 | |||
max-line-length = 99 |
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.
Shouldn't we now decrease this to 88?
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.
Yes, I guess so
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.
Note that we have quite a bit of comment/documentation that are over 88 chars
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.
💥
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.
This is getting almost ready 👍
I just had a handful of open questions (commented inline).
And a more general question: should we try updating Cython code for the delimited stream reader etc? When I wrote it, it was loosely based on the Python version, with changes specific to Cython. Right now, that parity would be disturbed a bit. OTOH mangling that code now after the fact is just a (an unnecessary?) risk to introduce regressions.
black does not support cython, so the formatting would be manual. Personally I think we could leave it as is or update as needed as a follow on change (maybe in the same issue as the one setting flake line length to 88) |
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.
👍
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.
Here we go then...
I've opened #1926 to do the follow up on this change. Please add there if there were other deferred points from this change. I'll try to get to it this we |
Just to get the ball rolling.
Tried to run black
20.8b121.5b1 with the configurationThe
skip-string-normalization
avoids the conversion'
to"
if we want to keep the current flake8 rulesTODO:
'foo bar ' 'baz foobar'
)Closes #1453