Auto-formatting code with black - object now if you have a strong opinion
Anton Shestakov
av6 at dwimlabs.net
Fri Nov 30 06:59:51 UTC 2018
On Thu, 29 Nov 2018 16:29:30 -0500
Augie Fackler <raf at durin42.com> wrote:
> On Wed, Nov 28, 2018 at 7:13 AM Yuya Nishihara <yuya at tcha.org> wrote:
> > 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.
If right now somebody accepts a patch that's not formatted ideally --
no big deal, we can fix it later. But if everything is black and we
take a patch that's not, then working on those files could get messy,
because black works on whole files.
We'd also be redefining what "formatted ideally" means from "looks
kinda PEP8-ish" to "just run black all the time or you'll miss a
whitespace or use a wrong quote mark". This imposes quite a lot more on
new contributions.
Considering all that, I think 1) would be a bare minimum.
More information about the Mercurial-devel
mailing list