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

Douglas Bagnall douglas.bagnall at catalyst.net.nz
Tue Apr 10 09:51:07 UTC 2018


On 10/04/18 19:53, Stefan Metzmacher wrote:
> Am 10.04.2018 um 09:31 schrieb Swen Schillig via samba-technical:
>> 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
> 

Yes.

Of course, a difficulty we have that wireshark and other projects
don't is 17655 lines of C with trailing whitespace and nearly 50k
lines over 80 characters, which we don't want to change all at once. I
think the wireshark scripts check the whole of the affected file on
the assumption that everything you didn't change will still be
perfectly formatted. Our scripts will have to fiddle around with
diffs.

Douglas



More information about the samba-technical mailing list