-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add line wrapping to summaries of docstrings #14
Conversation
I like how it auto-formatted our own test examples 😄 |
e6290d6
to
3119958
Compare
3119958
to
fa9e092
Compare
fa9e092
to
ba25d4e
Compare
Pull Request Test Coverage Report for Build 2190458152
💛 - Coveralls |
61d705b
to
3544bb7
Compare
@Pierre-Sassoulas I have started working some more on this as it is a nice little job I can do in between other (personal) stuff. This is still WIP, but in order for this to remain manageable I'd like to focus on wrapping summaries for now. In this PR we should add that basic functionality with the line length as ordered by PEP 8 (which is 72 😮). One thing I haven't yet fixed is how to handle docstrings that haven't been split. For example: """My beautiful docstring
This function will do a number of things:
bla di bla
""" Should be """My beautiful docstring
This function will do a number of things:
bla di bla
""" That makes it much easier for this to line wrap. However since the """My beautiful docstring This function will do a number of things: bla di bla.""" |
Yes, let's not do too much at once.
I think this is unreasonable and we should use 88 by default (black's default).
Is it really problematic ? I mean if we encounter an end of sentence punctuation we could cut easily after it then line wrap. Maybe we should first add end of sentence punctuation if there's a |
Personally I'd like to strictly adhere to the PEP's and make it very clear how to avoid this (awful) default. Something like "we recommend running with
We do cut in We could also think: let's wrap everything and if the user doesn't want us to they should clearly indicate what is a summary and what isn't. However, I think that's not the most user-friendly approach. I'll think about this some more and hopefully come up with something elegant. |
Hmm, why put the bad default value in the first place if we think everyone need to change it ? black is pretty successful with a "sane default" and the possibility to change it to the value from pep8 if you're a purist (and 79 is more reasonable than 72 too). Having good default values is pretty important imo.
If the default is sane it's going make the discussion less likely. I think that if black default was 79, the first thing to do when adopting black would be to discuss between 79, 80, 90, 100, 110, 120 for line length. As it's reasonable, I think discussions happen less often. Also it would not be a problem if we go check the line length for black/pylint/flake8 ourselves in the configuration files later on.
Pretty much agree with that, if the docstring is bad we cannot make it good magically. crap in, crap out ! |
8af69f5
to
ca86e45
Compare
This comment has been minimized.
This comment has been minimized.
ca86e45
to
dcca3bb
Compare
This comment has been minimized.
This comment has been minimized.
dcca3bb
to
1ed0fa7
Compare
This comment has been minimized.
This comment has been minimized.
1ed0fa7
to
cbc637a
Compare
@Pierre-Sassoulas Could you review this 😄 |
This comment has been minimized.
This comment has been minimized.
cbc637a
to
5ac722b
Compare
According to the primer, this change has no effect on the checked open source code. 🤖🎉 |
Partially handles #7, it's not even close right now 😄 The line wrapping fail because there are space before and after the leading string.