Add option to format compatible with black:#166
Add option to format compatible with black:#166NickHilton wants to merge 11 commits intoPyCQA:masterfrom
Conversation
Pull Request Test Coverage Report for Build 4326573190
💛 - Coveralls |
Pull Request Test Coverage Report for Build 4326573190Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
|
Another necessary change for As for configuration, it would be nice if a config like this would work. Or [tool.black]
line-length = 99
[tool.docformatter]
black = true
wrap-summaries = 99
wrap-descriptions = 99Sorry for the unasked 2 cents, but |
|
@s-weigand I think you'll see from my comments, that's exactly the way I'd like
Adding two lines, one time to a configuration file doesn't seem overly burdensome to me (of course, I walked up hill both ways to school when I was a kid, so....). This keeps the tools configurations separate which is what I prefer until convinced otherwise. |
|
@NickHilton @s-weigand pointed out a behavior that needs to be modified by the this should not be executed when the |
|
I have addressed the blank lines after method issue: When black runs it strips blank lines after method docstrings up to 1 blank line. I wanted to replicate that behaviour rather than not format the blank lines at all after method docstrings:
|
weibullguy
left a comment
There was a problem hiding this comment.
I presume the tests are passing on your end? For some reason they're not on GH. Also, there are some pycodestyle errors that need addressing.
The one thats failing does... Although I can't get all the tests to pass on master branch so probably have something odd with my local set up. Will see if I can get it fixed Will address the pycodestyle errors |
weibullguy
left a comment
There was a problem hiding this comment.
I plan to release v1.6.0 this weekend which handles URLs. My plan is to then merge this PR and tag as v1.7.0-rc1. If retaining the blank lines in empty functions is going to be a heavy lift, I'd propose we NOT include it in this PR.
|
@NickHilton I just released v1.6.0. You'll want to merge those changes and make sure everything is still working. |
- Adds CLI arg --black to respect black formatting rules - Adds CLI arg --black-line-length to format line lengths consistently and with the black default - Updates _do_format_docstring to respect black formatting rules w.r.t. leading " - Adds unittest for _do_format_docstring for the black case - Updates docs
da9e9e1 to
919699d
Compare
|
Sorry for the delay - Have rebased but I need to edit a few things to fix the tests, will do so asap and then we can reassess which version it will roll out in |
Summary
Attempts to address the issue in #94 by adding a CLI arg to allow compatibility with black. This does not implement everything (i.e. pyproject.toml specifications) as I wanted feedback before continuing with this to finish the PR.
This adds a
--blackargument to the CLI args which, when passed, ensure that the issue from #94 is addressed. I'm not aware of any further discrepancies with black which need to be addressed but please let me know if there areUpdated
I also added a--black-line-lengtharg, only available if you specify--blackwhich will automatically set--wrap-summariesand--wrap-descriptionsto the value specified whilst defaulting to88, consistent with black. I wasn't sure this was strictly necessary as the changes would be compatible with black even setting custom line lengths, however this was raised in the original issue as desiredPer comments - have left default behaviour of line length as 88 when
--blackis specified, otherwise use the current PEP8 defaults, and allow the user to specifywrap-summariesandwrap-descriptionsas desired to overwrite this.I added a unittest and tested the full script passing in the
--blackargument and got an expected resultChanges