guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Automatically checking commit messages


From: Arun Isaac
Subject: Re: Automatically checking commit messages
Date: Sat, 23 Sep 2017 10:14:55 +0530

> What parts of the commit message guidelines do you expect to be
> verifiable, and which parts do you think will be too hard/restrictive
> to automatically verify?

I haven't thought too hard about this. I thought that, if we have a good
parser for commit messages, we can later add any number of
tests. Anyways, here are a few tests that immediately come to mind:

* Check for commit signature. Our existing pre-push hook already does
  this.
* Verify that the modules listed on the first line of the commit message
  ("gnu: you-get", "guix: build:", etc.) are accurate.
* Verify mundane things like capitalization of first word of sentence,
  period at the end of a sentence, no indentation when a changelog entry
  continues for more than one line, etc.
* Maybe, enforce templates for common commits like updating a package,
  enabling/disabling tests/parallel-build/parallel-tests, etc.
* Verify that the changelog lists all changes in the commit. This might
  require actually parsing the patch, and may not be easy.

> If you haven't done so already, adding test cases (from existing
> proper and improper commit messages) would ease understanding.

I will work on this script further, and post a patch once I have
something more complete.

>> This is a good idea, and it would be even better if that same thing
>> could be used to generate a commit message with all the automatable
>> pieces pre-filled, with only the human parts left to the user.

This is an interesting thought. I also just found out that git supports
commit message templates, and I wonder if it could be useful.

https://robots.thoughtbot.com/better-commit-messages-with-a-gitmessage-template

> FWIW 'magit' can already fill out file names and variables by navigating
> to the hunks in the diff buffer and pressing 'C'.

True, magit is very useful in that regard. But, at least for common
commits like updating patches, it would help to have something more
automated than that.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]