commit-message-tag-validator plugin proposal

32 views
Skip to first unread message

Petr Hosek

unread,
Jan 10, 2018, 3:49:02 AM1/10/18
to Repo and Gerrit Discussion
In Fuchsia, we have convention of putting a tag of the form "[tag]" or "tag:" describing to the component the commit is related to in the subject. We would like to have a way of enforcing this convention, ideally by giving a warning (or error) when developer pushes a commit that doesn't have a tag. I was thinking about creating a plugin that would implement this functionality. I expected it's going to be very similar to the commit-message-length-validator plugin.

Does this sound reasonable? If yes, would it be possible to create a repository this plugin, e.g. plugins/commit-message-tag-validator?

Patrick Hiesel

unread,
Jan 10, 2018, 3:50:59 AM1/10/18
to Petr Hosek, Repo and Gerrit Discussion
You can look at the Prolog cookbook section 7. It explains how to create a submit rule to enforce patterns in commit messages.



On Wed, Jan 10, 2018 at 9:48 AM, 'Petr Hosek' via Repo and Gerrit Discussion <repo-d...@googlegroups.com> wrote:
In Fuchsia, we have convention of putting a tag of the form "[tag]" or "tag:" describing to the component the commit is related to in the subject. We would like to have a way of enforcing this convention, ideally by giving a warning (or error) when developer pushes a commit that doesn't have a tag. I was thinking about creating a plugin that would implement this functionality. I expected it's going to be very similar to the commit-message-length-validator plugin.

Does this sound reasonable? If yes, would it be possible to create a repository this plugin, e.g. plugins/commit-message-tag-validator?

--
--
To unsubscribe, email repo-discuss+unsubscribe@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gert van Dijk

unread,
Jan 10, 2018, 4:01:13 AM1/10/18
to Repo and Gerrit Discussion
Just wanted to point out that the uploadvalidator plugin allows for some project-specific configurable validation on push time as well. In case your "tag" is a commit message footer/trailer, this can be set as required using this plugin.

Marcelo Ávila de Oliveira

unread,
Jan 10, 2018, 5:22:24 AM1/10/18
to Petr Hosek, Repo and Gerrit Discussion
Consider to use the Git::Hooks framework.

--
Marcelo Ávila de Oliveira

--

Matthew Webber

unread,
Jan 10, 2018, 9:48:51 AM1/10/18
to Repo and Gerrit Discussion
On Wednesday, 10 January 2018 10:22:24 UTC, Marcelo Ávila de Oliveira wrote:
Consider to use the Git::Hooks framework.

Another alternative is to write your plugin in Groovy, and add it to Gerrit (once you have installed the Gerttit using the Scripting Groovy Provider plugin)

Matthew

Dave Borowitz

unread,
Jan 10, 2018, 10:27:04 AM1/10/18
to Matthew Webber, Repo and Gerrit Discussion
Since Fuchsia is on googlesource.com, I can tell you the easiest way forward will be to use the uploadvalidator plugin, which is already installed, you would just need to enable & configure it on your host.

It does lack flexibility, though, since the configuration is applied hostwide. If you need more flexibility you can either contribute to that plugin or develop your own (which you'll have to file a ticket with us to get turned on for your host).

--

Edwin Kempin

unread,
Jan 10, 2018, 10:32:30 AM1/10/18
to Dave Borowitz, Matthew Webber, Repo and Gerrit Discussion
On Wed, Jan 10, 2018 at 4:26 PM, 'Dave Borowitz' via Repo and Gerrit Discussion <repo-d...@googlegroups.com> wrote:
Since Fuchsia is on googlesource.com, I can tell you the easiest way forward will be to use the uploadvalidator plugin, which is already installed, you would just need to enable & configure it on your host.

It does lack flexibility, though, since the configuration is applied hostwide. If you need more flexibility you can either contribute to that plugin or develop your own (which you'll have to file a ticket with us to get turned on for your host).

Reply all
Reply to author
Forward
0 new messages