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

Herbert Valerio Riedel hvriedel at gmail.com
Mon Mar 9 08:05:12 UTC 2015

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

   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

   This linter has soft (-> warnings) and hard limits (->

   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>,

      validate-whitespace ~/Work/ghc-tree/.git HEAD


 [1]: https://github.com/haskell-infra/git-haskell-org-hooks/tree/master/src

More information about the ghc-devs mailing list