4
votes

I have created a custom label in Gerrit.

[label "Code-Quality"]
  function = NoOp
  value =  0 No score
  value = +1 Horror
  value = +2 Not bad
  value = +3 Good
  value = +4 Super Hiper
  value = +5 Jon Skeet

This is intended to see (in the long term) who is considered to write a good quality code. However, when I have left this label optional (NoOp), nobody seemed to fill it. Gerrit displays a CodeReview +2 shortcut button so reviewers in most cases do not even open the Reply box where they would see the additional label.

What I want to achieve is to block the change submission unless the CQ flag is set to any value greater than 0 by the reviewer(s). The AnyWithBlock function seems reasonable if I add -1 value to this flag, but reviewers still can skip setting it (often unintentionally) with the shortcut button.

I have seen I can create a custom submit rule in prolog. However, although there are many examples of many different rules, no one fits my use case. Also, the prolog syntax looks so mysterious to me that I wasn't able to produce anything even close to my need.

Any help with writing such submission rule or pointing me into another direction will be much appreciated.

1

1 Answers

1
votes

Change to:

[label "Code-Quality"]
  function = AnyWithBlock
  defaultValue = -1
  value = -1 No score
  value = +1 Horror
  value = +2 Not bad
  value = +3 Good
  value = +4 Super Hiper
  value = +5 Jon Skeet