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 .pre-commit-config.yaml #175

Merged
merged 8 commits into from
Mar 30, 2022
Merged

Conversation

valberg
Copy link
Contributor

@valberg valberg commented Mar 30, 2022

No description provided.

@valberg valberg requested a review from brylie March 30, 2022 14:58
@valberg valberg mentioned this pull request Mar 30, 2022
@valberg valberg requested a review from MrCordeiro March 30, 2022 15:41
Copy link
Contributor

@MrCordeiro MrCordeiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The git-commit is failing :(

Specifically:
invitations/adapters.py:7:1: F401 'django.utils.encoding.force_str' imported but unused
invitations/adapters.py:28:25: F821 undefined name 'force_text'

(i.e. force_text should be force_str)

Opinion: at this point, we keep the git-config - and this PR - small.
There were changes in practically all pages because of Black, which makes reviewing it super hard. I will for sure let something slip by.

Opinion: this is to be ignored if the PR is kept small, but I would remove migrations files from getting styled by Black as these are auto-generated

@valberg
Copy link
Contributor Author

valberg commented Mar 30, 2022

The git-commit is failing :(

Specifically: invitations/adapters.py:7:1: F401 'django.utils.encoding.force_str' imported but unused invitations/adapters.py:28:25: F821 undefined name 'force_text'

(i.e. force_text should be force_str)

This will be fixed when merging #174 either before or after this PR.

Opinion: at this point, we keep the git-config - and this PR - small. There were changes in practically all pages because of Black, which makes reviewing it super hard. I will for sure let something slip by.

I'm thinking that's why we have tests?

Opinion: this is to be ignored if the PR is kept small, but I would remove migrations files from getting styled by Black as these are auto-generated

Good point! Adding it now!

@MrCordeiro
Copy link
Contributor

MrCordeiro commented Mar 30, 2022

I'm thinking that's why we have tests?

Tests are only good for detecting things we considered testing though.

I'm not very familiar with all those hooks. It makes me feel uncomfortable about them doing something unpredictable. Btw add-trailing-comma seems unnecessary with black in there.

@valberg
Copy link
Contributor Author

valberg commented Mar 30, 2022

I'm not very familiar with all those hooks. It makes me feel uncomfortable about them doing something unpredictable. Btw add-trailing-comma seems unnecessary with black in there.

I can vouch for the pre-commit configuration not doing any harm - I've been running with it on other project for quite some time now.

The benefits of add-trailing-comma can be read here: https://github.com/asottile/add-trailing-comma#multi-line-method-invocation-style----why

@MrCordeiro
Copy link
Contributor

MrCordeiro commented Mar 30, 2022 via email

@valberg
Copy link
Contributor Author

valberg commented Mar 30, 2022

But Black already does all those benefits listed at those docs. Am I missing anything?

Black reacts to trailing commas (by putting code with trailing commas on multiple lines) - add-trailing-comma adds them :)

@valberg valberg requested a review from MrCordeiro March 30, 2022 19:00
@valberg
Copy link
Contributor Author

valberg commented Mar 30, 2022

@MrCordeiro @brylie Everything is green now :)

@MrCordeiro
Copy link
Contributor

But look at the Black docs: it adds a comma too.

Screenshot_20220330-201852.jpg

Anyways this is a non blocker. If it's green, it's good.

@valberg
Copy link
Contributor Author

valberg commented Mar 30, 2022

But look at the Black docs: it adds a comma too.

Ahh that is just if the line is too long and has to wrapped. add-trailing-comma does it whatever the length of the line.

This ties into https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html?highlight=trailing%20comma#the-magic-trailing-comma

Anyway, great! I'll merge it!

@valberg valberg merged commit b8bac5b into jazzband:master Mar 30, 2022
@valberg valberg deleted the add_pre_commit branch March 30, 2022 19:30
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 this pull request may close these issues.

2 participants