-
-
Notifications
You must be signed in to change notification settings - Fork 505
Blacken all python code for consistency in formatting #1318
Conversation
It seems the black tests pass when I run |
OK, tests pass and I've been using this reformatted code on my dev server without any ill effects. We should get this merged as soon as we can so we can get back to normal development. I just want an LGTM from both of you to make sure we are all aware of whats going on. |
It's OK with me if you merge this. I took a quick look and it seemed like everything was fine. |
I switch to the blackened version and it looks good! Thanks, Brad. |
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.
I approve.
Great! Done. There are still some errors that flake8 finds, that black does not deal with. These are errors like bad variable names. bad escape sequences, the use of bare except statements, multiple imports on one line... These are all things we can easily pick off and clean up. I've uploaded a .flake8 file that defines a bunch of extra builtins to help with web2pys global variables, sets the line length to match black and a couple of other minor things. |
Brad, great work! Having well-formatted code will be so helpful. I also appreciate a flake8 setup -- it will be good to squash those violations as well. Sigh -- web2py -- there will still be lots of undefined names coming from the automatic import of everything in |
This PR reformats EVERYTHING using the black tool.
It also adds a test to the test suite that will fail if code does not follow the correct format.
Its easy enough for developers to conform if they have black installed. For example editors like VSCode will automatically run black for you on save. Or when the test fails you simply run black on that file.
This cleans up a massive amount of lint, and should let us focus on cleaning up real errors instead of formatting errors.