Is it possible to run a linter on commit messages?

In our projects, we would like to use something conventional commit.

There are some script around to check if the commit respect the convention:

I would tend to prefer the sailr bash script. I wanted to play around with the script-and-regex.script, but it seems that this will only check diff files, not the commit message.

Is there anything existing in arcanist to review the commit message, and potentially refuse the arc diff if the commit message linters returns an error? If not, is there any place in arcanist source code to hook something?

Put this check in arcanist is the real good place for such feature! Some may propose other solutions:

  • add a local git pre-commit hook. Cons:
    • it should be add on every developer machine
    • developer may want to have some ugly WIP commit message during development
  • setup a remote pre-commit hook
    • it is too late, this check must append before code review

I am quite surprised such linter does not already exists in arcanist.

In Phabricator workflow, commit messages are normally generated from the Revision object at arc land/T182, and individual commit messages are discarded, so there’s no point in linting these commits - see this article.

With that in mind, a good place for this would be in the server-side revision testing phase (Herald+Harbormaster) (although traditionally that part only looks at content, not message).

You could also add a set of custom fields containing the relevant information, and a custom server-side Landing action that checks/forces this structure (server-side landing doesn’t allow much workflow customization at this point - see