-
-
Notifications
You must be signed in to change notification settings - Fork 774
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
Use black for formatting the code #887
Conversation
Pull Request Test Coverage Report for Build 1503
💛 - Coveralls |
@tevansuk personally I am a big fan of black, I don't mean I like all the styles it applies but the fact that I don't have to worry about code formatting is a big thing to me. Will mark this as a potential 1.4.0 patch waiting for others to chime in a say what they think about it |
I am +1 for black, I also like the addition of a pre-commit hook. I find this very helpful. A couple of small comments. I see you've added flake8-black. What are the benefits of this over the inbuilt check functionality of black? |
Thanks for the review :)
This just matches the current maximum line length specified in On my own projects I always change the line length because the default number in PS: I probably won't keep chasing |
@tevansuk I think this is good to go, do you mind updating your branch? I am gonna merge it after that |
Sounds good 👍 - I'll start updating it now |
* Add black configuration * Run black as part of flake8 testenv in tox * Add editorconfig to ensure indent style in tox.ini/setup.cfg * Add pre-commit hooks to check flake8, black, isort and common errors * Update isort configuration to be black-compatible * Update contributing documentation * Add myself to AUTHORS * Skip migrations in black/isort/pre-commit
This is the result of running `black .` over the repository. By-hand improvements of the blackened code will be in follow up commits, to make it easier to reapply this commit to future updates, if necessary - IE to remove this commit and re-run black over a fresh tree, rather than trying to merge new changes in to this commit.
Some minor hand tweaks: oauth2_provider/contrib/rest_framework/authentication.py oauth2_provider/oauth2_validators.py Construct OrderedDict in a clearer, still black compliant way (one line per dict entry) tests/test_token_revocation.py Remove empty method docstrings
3761c3a
to
63d705f
Compare
Use black to format the code
I know this can be a little subjective; some people aren't keen on
black
formatting, and it's tedious to review..I really did this because I'm looking at the failed merge of OpenID Connect support, and a lot of the changes in #859 appear to not be related to the OIDC support, but seem to be black autoformatting, so this will be useful for me to pull out the actual diff from that PR, even if this isn't accepted.
One bone of contention might be on the imports. Previously, isort was set to a lower line length limit than flake8 was; black cannot understand this, so the line-length has to be the same in black/flake8/isort. This has altered some of the import lines a bit.
Checklist
CHANGELOG.md
updated (only for user relevant changes)AUTHORS
Current line length histogram, for information