Skip to content
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

Add python autoformatter #5751

Merged
merged 5 commits into from
Jun 24, 2020
Merged

Add python autoformatter #5751

merged 5 commits into from
Jun 24, 2020

Conversation

mx-psi
Copy link
Member

@mx-psi mx-psi commented Jun 16, 2020

What does this PR do?

  • Add black as pre-commit hook
  • Add black to CircleCI
  • Apply black to existing files

Motivation

  • Enforce readability
  • Reduce merge conflicts
  • (Almost) consistent code style with integrations repos

Additional Notes

  • Configuration mostly follows that of Add style checker and formatter integrations-core#3299
  • black includes safety checks to verify no AST changes, so feel free to rely on the pipeline passing for reviewing
  • If you still want to review, it is best reviewed hiding whitespace changes

How to merge this changes to your branch

This PR will likely provoke merge conflicts with existing PRs that modify .py files.
To help with this, do the following:

  1. Cherry-pick da5c846
  2. Install pre-commit (pip install pre-commit) and activate it (pre-commit install --install-hooks).
  3. Run pre-commit hook manually on all files pre-commit run black -a (look at --from-ref and --to-ref options if you want to just format the files you modified)
  4. Merge master into your branch

@mx-psi mx-psi added this to the 7.21.0 milestone Jun 16, 2020
@mx-psi mx-psi force-pushed the mx-psi/python-autoformat branch 2 times, most recently from 2f65dcb to 4ee1d56 Compare June 17, 2020 09:07
@mx-psi mx-psi force-pushed the mx-psi/python-autoformat branch from 4ee1d56 to 819a403 Compare June 17, 2020 14:48
@mx-psi mx-psi marked this pull request as ready for review June 17, 2020 15:17
@mx-psi mx-psi requested review from a team as code owners June 17, 2020 15:17
@mx-psi mx-psi merged commit fd65c5f into master Jun 24, 2020
@mx-psi mx-psi deleted the mx-psi/python-autoformat branch June 24, 2020 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants