On 10 August 2017 at 10:47, Hartmut Goebel <h.goe...@crazy-compilers.com> 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 <https://chriswarrick.com/>
PGP: 5EAAEA16
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to