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

pre-commit: adopt black hook #2152

Closed
wants to merge 2 commits into from
Closed

Conversation

bjlittle
Copy link
Member

This PR adds support for the black pre-commit git hook to enforce opinionated code formatting throughout the code-base.

Reference: #1934

@bjlittle bjlittle changed the title pre-commit: adopt black pre-commit: adopt black hook Mar 12, 2023
@bjlittle
Copy link
Member Author

I'll resolve the conflicts in this PR once #2150 is merged

@greglucas
Copy link
Contributor

In general, 👍 from me. I also looked into it a couple years ago :) https://github.com/greglucas/cartopy/tree/black (2021) This should get more buy-in from other devs though too.

@dopplershift
Copy link
Contributor

I think black turns too much sensibly formatted code into outright garbage.

With that said, I won't stand in the way. But I'm also not going to be clicking the green button on this.

@bjlittle
Copy link
Member Author

bjlittle commented Mar 15, 2023

I think black turns too much sensibly formatted code into outright garbage.

With that said, I won't stand in the way. But I'm also not going to be clicking the green button on this.

@dopplershift Yup, totally understand your PoV 👍

Thanks for your candid honesty. I appreciate that black is one of those divisive packages that people generally love or hate.

I'm happy either way, if this PR lands or not.

What I'm attracted to about black is that it's opinionated (and yup, some of its decisions I don't quite agree with, but in general seems relatively fine to me), applies consistency regardless, but most importantly takes the burden of any formatting decisions/debate out of the equation for the core devs when reviewing pull-requests i.e., one thing less to think about.

I appreciate that this PR will be a bit marmite, and I don't want to rock the cartopy boat... so it would be great if anyone who has an opinion on this has their say and we can roll with the wisdom of the crowd 👍

@bjlittle
Copy link
Member Author

bjlittle commented Mar 15, 2023

GitHub Discussions now offers Polls, where it's super easy to garner opinions from the community.

I was just wondering whether it was worth while enabling GH Discussions for cartopy and have a poll to ask whether we should adopt black formatting or not?

I'm conscious that cartopy already has several community channels, so perhaps another wouldn't be ideal? Dunno 🤔

@SciTools/cartopy-admins How do you guys typically field community wide opinion, or isn't it a done thing?

@greglucas
Copy link
Contributor

I am one of the semi-indifferent people on Black, neither greatly for nor against it, but probably slightly lean in favor because of a similar sentiment to your comment about removing discussion/debate about formatting:

What I'm attracted to about black is that it's opinionated (and yup, some of its decisions I don't quite agree with, but in general seems relatively fine to me), applies consistency regardless, but most importantly takes the burden of any formatting decisions/debate out of the equation for the core devs when reviewing pull-requests i.e., one thing less to think about.

I personally don't think we need another avenue for communication. Cartopy doesn't get a ton of use from the current channels available, so adding another one probably wouldn't get much response either is my guess.

@bjlittle
Copy link
Member Author

Conflicts resolved 👍

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.

3 participants