[PATCH for comments] configure: install a whitespace checking pre-commit hook for developers

Stefan Metzmacher metze at samba.org
Tue Apr 10 07:53:11 UTC 2018


Am 10.04.2018 um 09:31 schrieb Swen Schillig via samba-technical:
> On Tue, 2018-04-10 at 08:36 +0200, Ralph Böhme via samba-technical
> wrote:
>> On Tue, Apr 10, 2018 at 08:20:55AM +0200, Ralph Böhme via samba-
>> technical wrote:
>>> On Tue, Apr 10, 2018 at 12:35:07AM +1200, Douglas Bagnall via
>>> samba-technical wrote:
>>>> Martin wrote:
>>>>
>>>>> The problem is that the *initial* proposal is not for a
>>>>> checkpatch
>>>>> script that people can run *before* submitting their
>>>>> patch.  The
>>>>> proposal is for something that runs at the submission gate.
>>>>
>>>> This patch shows a third way, still quite authoritarian but sort
>>>> of
>>>> opt-out-able and entirely local. It makes it harder to *create*
>>>> patches that break the rules, not to submit them.
>>>>
>>>> It will also (I think) make it harder to `git am` a patch series
>>>> that
>>>> contains whitespace errors, and will possibly annoy people who
>>>> make a
>>>> lot of private WIP patches.
>>>
>>> [slow at kazak scratch]$ git am ~/patches/0001-configure-install-a-
>>> whitespace-checking-pre-commit-h.patch
>>> Applying: configure: install a whitespace checking pre-commit hook
>>> for developers
>>> .git/rebase-apply/patch:46: trailing whitespace.
>>>         # simple default.
>>> warning: 1 line adds whitespace errors.
>>> [slow at kazak scratch]$
>>>
>>> :)))
>>
>> besides that, this is really, really nice. Thanks Douglas!
> 
> I really like Douglas' work as well, especially the part where
> the pre-commit hook gets installed auto-magically if there isn't one.
> 
> But, is trailing white-spaces all we want to check for ?
> Why not go a bit further and have a few more of those "annoying"
> violations flagged as well ?
> 
> Like 
> 	- leading white-space
> 	- code indent should use tabs where possible
> 	- space required before the open parenthesis '('
> 	- line over 80 characters
> 	- Missing a blank line after declarations
> 	- space prohibited before that close parenthesis ')'
> 	- ...
> 
> especially if all those checks can be turned off, if required for
> whatever reason, with a simple "git --no-check ...."

I was also wondering about that.

I think we should use some like wireshark,
were the real script[s] are part of the checkout and the pre-commit hook
is just a wrapper arround it, that way we can improve the script step by
step.

See
https://code.wireshark.org/review/gitweb?p=wireshark.git;a=blob;f=tools/pre-commit

metze


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20180410/a9a2ca41/signature-0001.sig>


More information about the samba-technical mailing list