Auto-formatting code with black - object now if you have a strong opinion

Anton Shestakov av6 at dwimlabs.net
Fri Nov 30 01:32:41 EST 2018


On Tue, 27 Nov 2018 10:52:56 -0500
Augie Fackler <raf at durin42.com> wrote:

> In https://phab.mercurial-scm.org/D5064 we're talking about using the `black` formatter from Ɓukasz Langa on hg. This will imply a few style changes to our codebase, notably:
> 
>  * We'll use " everywhere instead of '
>  * Import formatting will change a bit
>  * We'll have two blank lines between top-level items in a module
> 
> Everything else is, as best I can tell, a minor style change of sorts. My preference at this point is to land the change and just give our formatting entirely to black, even if at the edges I disagree with some of black's decisions. Does anyone have a strong opinion _against_ using black to format our code?

It's still not clear to me why we're using black instead of a linter if
it just does minor style changes and ' -> ". I also like consistency,
but do we care about only ever using " for strings? Because D5064
indeed only highlights that we already have consistent code as far as
people are concerned, it's just one tool that's upset about tiniest
things -- that's how I see it.

Or how about YAPF, why not? At least it's configurable. So far I've
only heard that "we wouldn't argue about style rules if somebody else
chose them for us". We have clang-format rules, and I remember they
were worked out on the mailing list, and people who work on this
project decided on what's best for it. But now we don't like that idea?
What happened?


More information about the Mercurial-devel mailing list