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

Augie Fackler raf at durin42.com
Thu Nov 29 16:29:30 EST 2018


On Wed, Nov 28, 2018 at 7:13 AM Yuya Nishihara <yuya at tcha.org> wrote:
>
> On Tue, 27 Nov 2018 15:42:21 -0800, Gregory Szorc wrote:
> > I also have some issues with black's formatting. I dislike black's use of
> > double quotes for strings (maybe a holdover from my knowledge of shell,
> > Perl, and PHP, where different quotes matter). And I wish it didn't collect
> > imports on the same line.
>
> I don't care ' vs ", but I agree that the import style isn't nice. Merge
> conflicts will be more likely to occur because of that.
>
> > But my objections are insignificant compared to
> > the benefits of having consistently formatted source code. The research in
> > this area shows that the actual style matters less than consistency.
>
> Can we somehow reject patches automatically if they disagree with the
> formatter? I'm not interested in fixing test-check-* failure in flight.

Two possibilities here:

1) We configure `hg fix` and then maintainers can just have a habit of
running `hg fix` whenever they see test-check* failures. Not great,
but relatively low overhead.

2) We write a phabricator (and probably also email, though I'd expect
email contributors to be savvier) bot that checks for some basics like
code formatting consistency and robo-comments on the change.


More information about the Mercurial-devel mailing list