HEADS-UP: new Git hook linters for whitespace & commit msgs

Edward Z. Yang ezyang at mit.edu
Mon Mar 9 18:58:28 UTC 2015


Hello Herbert,

I tried to push today and I noticed that there is an unfortunate
interaction between Arcanist's commit rewriting and the Signed-off-by
hook, which requires the Signed-off-by line to be on a new-line by
itself.  The problem is Arcanist, by default, rewrites a one line
commit message to:

This is my first line

Summary: Signed-off-by: Edward <... at ...>

which fails lint.

This is pretty annoying; can we relax the lint check or get arc to
stop messing this up?

Edward

Excerpts from Herbert Valerio Riedel's message of 2015-03-09 01:05:12 -0700:
> Hello GHC devs,
> 
> I finally got to finish reworked Git hook validations[1] which are
> active effective immediately for the ghc.git repo:
> 
>  - A new whitespace linter that enforces 3 separate in variants for files
>    with the suffixes
> 
>      .hs .hsc .lhs .cabal .c .h .lhs-boot .hs-boot .x .y
> 
>    the 3 invariants (i.e. if the particular invariant held before the
>    commit, it ought to hold afterwards as well):
>    
>     1. no TABs
>     2. no trailing whitespaces (NEW)
>     3. no missing final EOL (NEW)
> 
> 
>  - A new commit msg linter
> 
>    The rationale is explained in
>    http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
> 
>    TLDR: The structural conventions enforced by the new linter avoid
>          messing up the output of Git tooling; Editors with support for
>          commit-msg syntax-coloring like Vim or Emacs also follow these
>          conventions.
> 
>    This linter has soft (-> warnings) and hard limits (->
>    error/rejection)
> 
>    The most important hard limits are:
> 
>     - subject line (i.e. 1st line) 80-char max length (& 8-chars min len)
>     - 2nd line must be empty (if it exists)
>     - body lines (i.e. 3rd+ lines) 100-char max length
> 
>    For more details about additional checks see actual code in [1]; the
>    linter tries to give verbose error/warning messages and pointing
>    exactly to the offending lines.
> 
> 
> Comments/suggestions/debate/pull-requests/etc welcome!
> 
> 
> PS: the new validators can easily be tested locally on a Git tree
>     (although I've only tested this on Linux):
> 
>       usage: validate-whitespace <git-dir> [<commit-id>+]
> 
>     and you can pass symbolic refs such as 'HEAD' for the <commit-id>,
>     e.g.
> 
>       validate-whitespace ~/Work/ghc-tree/.git HEAD
> 
> 
> Cheers,
>   hvr
> 
>  [1]: https://github.com/haskell-infra/git-haskell-org-hooks/tree/master/src


More information about the ghc-devs mailing list