Use black for formatting#145
Conversation
|
Rebased to the latest main, please let me all know what kind of changes you do not like so we can discuss them |
| urljoin(self.url, "/mockserver/expectation"), | ||
| verify=False, | ||
| timeout=5, | ||
| json={ |
There was a problem hiding this comment.
JSON one-line formatting is arguably worse readable.
There was a problem hiding this comment.
There is an option to leave dictionary formatting in the "traditional way" if black sees a trailing comma after the last element.
There was a problem hiding this comment.
That would be great, but black can't be configured if I remember correctly. Its rules are set (that is what is good about black). But we can still use ignore
There was a problem hiding this comment.
@averevki You are right! Thanks for the suggestions. https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html#the-magic-trailing-comma. It is not a config option, but if you have a comma after the last element in dict/Func call/Tuple it won't get squashed to a oneliner. @jsmolar Could you show me all locations where you would like to get rid of oneliners?
|
I like the overall consistency of the code. I believe long one-liners can be solved by setting a shorter line length (e.g. to black default 88 characters), if this is an option. |
|
As the saying goes "new year, new me", after the new year I somehow started to feel that black is a welcome change in our project hence I approved this PR. |
3702230 to
3d45538
Compare
I consider a length of 120 to be still reasonable also thanks to your suggestion with the magic trailing comma we have an option to "disable" one-liners. |
This is what black looks like with --line-length set to 120
This is an experimental PR which showcases what black would look like and I would like to hear what you think about code quality.
For Pycharm users, see
https://black.readthedocs.io/en/stable/integrations/editors.htmlfor configuring support for black.