Re: OT: Rejecting whitespace-only changes at github

2017-08-10 Thread Chris Warrick
On 10 August 2017 at 10:47, 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.

First, make sure you have a clear policy regarding code style. Set up
an editorconfig file, mention it in CONTRIBUTING.rst or other
developer documentation.

There are some tools that enforce code style — eg. Codacy — but that
might not be what you want. You can write a tool that interacts with
GitHub in this way by writing a webhook:

https://developer.github.com/webhooks/

You will need your own server (even the cheapest VPS will do) and some
simple code in your favorite Python web framework (Flask). Get a
webhook request whenever PRs are opened/changed, check if the PR is
“clean” (download diff from GitHub, find whitespace-only changes?) and
use the GitHub API to close PRs/comment on them/set status checks to
“failed”.

(Closing those PRs might be seen as harsh and discouraging to new contributors)

-- 
Chris Warrick 
PGP: 5EAAEA16
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: OT: Rejecting whitespace-only changes at github

2017-08-10 Thread Chris Angelico
On Thu, Aug 10, 2017 at 7:42 PM, Ned Batchelder  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
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: OT: Rejecting whitespace-only changes at github

2017-08-10 Thread Ned Batchelder
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?

--Ned.
-- 
https://mail.python.org/mailman/listinfo/python-list


OT: Rejecting whitespace-only changes at github

2017-08-10 Thread Hartmut Goebel
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.

-- 
Regards
Hartmut Goebel

| Hartmut Goebel  | h.goe...@crazy-compilers.com   |
| www.crazy-compilers.com | compilers which you thought are impossible |


-- 
https://mail.python.org/mailman/listinfo/python-list