-
-
Notifications
You must be signed in to change notification settings - Fork 739
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
Reformat the code using black, enforce black code formatting #5156
Conversation
comforms to black formatting rules and run it on CI.
conflict with black.
Oh please! I have been reformatting files with black, and then manually adjusting the diff so that I only submit PRs for lines I've touched. I really hope we can use it in the exchange as well, because lint configs are difficult to use while developing a pack. It will be so much simpler when we standardize on black, dropping most of the lint config files. Black does not handle some things, like import alphabetizing, but it is very consistent for everything else. |
LOL! the bot hasn't signed the CLA. ha ha ha.
|
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.
LGTM. I probably wait until post v3.4 release to merge this.
I recommend we add a Then, hopefully when github adds support we will be set to benefit from it. |
@cognifloyd Yeah, that works for me. I also pushed a pre-commit config (705d585) which runs all the lint checks (flake8, pylint, black) on modified / added files when committing - this should come very handy during development since it's much faster than running those checks on the whole code base (there should be no need to do that when developing locally since the base copy aka non modified files should be clean). I will add some info to the docs on how to use it. |
While at it, I also added two additional pre-commit checks which verify filess contain no trailing whitespace and that all the YAML files are valid + hooked it up to the make targets + CI. |
For a response template for existing PRs, we can use something like this:
|
For PRs that allow commits from maintainers, we can also push the reformat. |
Please let me know when v3.4.0 is out so I can merge this to avoid more conflicts on my side. |
This pull request reformats all the code using black tool and also adds a corresponding Make target and CI check which enforces code contains black compliant style / formatting.
To prevent large non functional formatting only change being attributed to myself and confusing git blame, etc. I made that change under a different author (8496bb2).
I had quite some issues trying to black to pass on all the files - I needed to manually fix formatting in files first before black could proceed (on some files it would fail with an error that second pass produced different result than the first one).
Open PRs
There is no way around it - such change will always cause some issues with merge conflicts and open PRs. But the sooner we do it the better,
The easiest way to get that resolved is for people who have opened PRs to run black on their code + changes and then merge latest master with formatting changes into that branch - this should result in least amount of merge conflicts.
So something like this (once this PR is merged):
TODO