OT: Rejecting whitespace-only changes at github

Chris Angelico rosuav at gmail.com
Thu Aug 10 05:50:02 EDT 2017


On Thu, Aug 10, 2017 at 7:42 PM, Ned Batchelder <ned at nedbatchelder.com> wrote:
> On 8/10/17 4:47 AM, Hartmut Goebel wrote:
>> Hello,
>>
>> Is there some tool or online-service which can check patches if they
>> contain white-space-only changes and all test-wrapping changes?
>>
>> One of the projects I'm maintaining (pyinstaller) wants to forbid
>> changes of theses types. If we could integrate resp. checks into the
>> tooling (github), this would give contributors feedback quickly and ease
>> the burden for the maintainers.
>>
>> Sorry for this off-topic question, but I assume to find a competent
>> answer here. And thanks for any pointer.
>>
>
> I don't think you can run code on GitHub like that.  You can write a bot
> that listens for new pull requests, and comments on them, but you have
> to find your own place to run that bot.
>
> I'm curious though: are you getting enough pull requests that are
> whitespace-only changes that it will be worth doing this?

I suspect it's not "that *are*" so much as "that *have*". I've seen a
number of submissions around the place where you have a certain amount
of substantive change, but also a good number of whitespace-only
changes in the same patch. It's just noise and unnecessary merge
failures.

One solution is to apply the patch, then run "git diff -w" or "git
diff -b". If the output is shorter than the original patch, raise a
warning. How you'd go about writing a PR bot to do this, though, I'm
not sure. Probably would need to maintain a local clone and stuff.

ChrisA



More information about the Python-list mailing list