"Good PR" mechanical check

Mathias Lang via Digitalmars-d digitalmars-d at puremagic.com
Tue Jan 12 12:04:33 PST 2016


On Tuesday, 12 January 2016 at 13:34:25 UTC, Andrei Alexandrescu 
wrote:
> Related to 
> https://github.com/D-Programming-Language/dlang.org/pull/1191:
>
> A friend who is in the GNU community told me a while ago they 
> have a mechanical style checker that people can run against 
> their proposed patches to make sure the patches have a style 
> consistent with the one enforced by the GNU style. I forgot the 
> name, something like "good-patch". I'll shoot him an email.
>
> Similarly, I think it would help us to release a tool in the 
> tools/ repo that analyzes a would-be Phobos pull request and 
> ensures it's styled the same way as most of Phobos: braces on 
> their own lines, whitespace inserted a specific way, no hard 
> tabs, etc. etc. Then people can run the tool before even 
> submitting a PR to make sure there's no problem of that kind.
>
> Over the years I've developed some adaptability to style, and I 
> can do Phobos' style no problem even though it wouldn't be my 
> first preference (I favor Egyptian braces). But seeing a 
> patchwork of styles within the same project, same file, and 
> sometimes even the same pull request is quite jarring at least 
> to me.
>
> Who would like to embark on writing such a tool?
>
>
> Thanks,
>
> Andrei

There is already an attempt to it in DMD: 
https://github.com/D-Programming-Language/dmd/blob/master/src/checkwhitespace.d
Agree it would be useful to have a tool which needs to be part of 
the auto-tester (I think it's called from the Makefile for DMD).

We could also provide a `post-commit-hook` that people can use so 
git checks it automatically. It needs to be checked on a 
per-commit basis because else we'll end up with commits affecting 
each other, which is no good either.


More information about the Digitalmars-d mailing list