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

Swen Schillig swen at vnet.ibm.com
Tue Apr 10 07:31:43 UTC 2018


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 ...."

Cheers Swen




More information about the samba-technical mailing list