From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arun Isaac Subject: Automatically checking commit messages Date: Wed, 20 Sep 2017 21:17:44 +0530 Message-ID: <9a88d837.ADkAADITH3QAAAAAAAAAAAOtZhgAAAACwQwAAAAAAAW9WABZwo2s@mailjet.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51497) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <9a88d837.ADkAADITH3QAAAAAAAAAAAOtZhgAAAACwQwAAAAAAAW9WABZwo2s@bnc3.mailjet.com>) id 1duhEN-0006BQ-PZ for guix-devel@gnu.org; Wed, 20 Sep 2017 11:48:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <9a88d837.ADkAADITH3QAAAAAAAAAAAOtZhgAAAACwQwAAAAAAAW9WABZwo2s@bnc3.mailjet.com>) id 1duhEI-00028Y-Nw for guix-devel@gnu.org; Wed, 20 Sep 2017 11:48:07 -0400 Received: from o129.p8.mailjet.com ([87.253.233.129]:40905) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from <9a88d837.ADkAADITH3QAAAAAAAAAAAOtZhgAAAACwQwAAAAAAAW9WABZwo2s@bnc3.mailjet.com>) id 1duhEH-00025S-WB for guix-devel@gnu.org; Wed, 20 Sep 2017 11:48:02 -0400 List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel 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)? changelo= g 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 < '>'") =