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

Suggest using black formatter on the code #113

Closed
iserko opened this issue Nov 12, 2019 · 3 comments · Fixed by #116
Closed

Suggest using black formatter on the code #113

iserko opened this issue Nov 12, 2019 · 3 comments · Fixed by #116
Milestone

Comments

@iserko
Copy link
Contributor

iserko commented Nov 12, 2019

Black is an opinionated code formatter for Python projects
It's use was accepted by the Django framework 5 months ago ... I like their foreword :)

The gist of it is ... you let black deal with any formatting questions and no arguments about which comma or new line should go where or when.

As for why you would want this ... when you have external contributors with various different styles, this makes the conversation more on point about what the code is supposed to do and not how it looks.

@DylanBaker
Copy link
Collaborator

Thanks @iserko. @joshtemple and I have Black enabled on save on our machines. How does this typically work with external contributors? Is it just that we tell them that is the formatting that we insist on, or do we actually have something on Github that amends the code post-commit?

@DylanBaker DylanBaker added this to the 0.1.1 milestone Nov 12, 2019
@iserko
Copy link
Contributor Author

iserko commented Nov 12, 2019

@DylanBaker usually the CI runs black and you provide it --check, so you just make it part of the linting along flake8. So if a CI build fails for a Pull Request you won't merge it.

From the docs:

  --check                         Don't write the files back, just return the
                                  status.  Return code 0 means nothing would
                                  change.  Return code 1 means some files
                                  would be reformatted.  Return code 123 means
                                  there was an internal error.

iserko pushed a commit to iserko/spectacles that referenced this issue Nov 12, 2019
@iserko
Copy link
Contributor Author

iserko commented Nov 12, 2019

@DylanBaker
Screenshot 2019-11-12 at 14 39 53

iserko pushed a commit to iserko/spectacles that referenced this issue Nov 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants