|
From: | Jelle Licht |
Subject: | Re: Automatically checking commit messages |
Date: | Thu, 21 Sep 2017 13:45:06 +0200 |
I have been working on a guile script to automatically check commit
messages -- something like `guix lint' but for commit messages instead
of package definitions. This could help us enforce our commit message
guidelines and avoid screw-ups like the one I did in commit
1ee879e96705e6381c056358b7f426f2cf99c1df. I believe more automation is
essential and would help us scale better if/when we have more people
with commit access.
I have taken the following approach with my script: I have devised a
grammar (shown below) to parse commit messages. Once the parser outputs
a parse tree for the commit message, we can apply any number of checks
on it.
Do you think this is a good approach? If so, I shall proceed with the
work, and complete the script. If not, what other approach would be
good?
Note that the grammar shown below is incomplete and buggy. Do ignore
that for now.
(define-peg-string-patterns
"commit <-- module S module S summary NL NL (description NL NL)? changelog signature?
module <-- (!C !S .)* C
summary <-- (!NL .)*
description <-- (!(NL NL) .)*
changelog <-- entry*
entry <-- bullet S file S section C S change
file <-- word
section <-- LR (!RR .)* RR
change <-- (!(bullet / (NL NL)) .)*
signature <-- signedoffby signatory S email
signedoffby < 'Signed-off-by: '
signatory <-- (!' <' .)*
email <-- LA (!RA .)* RA
word <- (!S .)*
S < ' '
C < ':'
NL < '\n'
bullet < '*'
LR < '('
RR < ')'
LA < '<'
RA < '>'")
[Prev in Thread] | Current Thread | [Next in Thread] |