blob: e1a25cacf2c5da2ceabafc644ce2f01aa6324077 [file] [log] [blame]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001= Gerrit Code Review - Review Labels
Dave Borowitz01c1b1f2013-02-27 13:49:04 -08002
3As part of the code review process, reviewers score each change with
4values for each label configured for the project. The label values that
5a given user is allowed to set are defined according to the
Fredrik Luthanderac8af9e2013-05-08 01:06:25 +02006link:access-control.html#category_review_labels[access controls]. Gerrit
7comes pre-configured with the Code-Review label that can be granted to
8groups within projects, enabling functionality for that group's members.
Dave Borowitz01c1b1f2013-02-27 13:49:04 -08009
10
Dave Borowitz01c1b1f2013-02-27 13:49:04 -080011[[label_Code-Review]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080012== Label: Code-Review
Dave Borowitz01c1b1f2013-02-27 13:49:04 -080013
14The code review label is the second of two default labels that is
15configured upon the creation of a Gerrit instance. It may have any
16meaning the project desires. It was originally invented by the Android
17Open Source Project to mean 'I read the code and it seems reasonably
18correct'.
19
20The range of values is:
21
Paul Fertser2474e522014-01-23 10:00:59 +040022* -2 This shall not be merged
Dave Borowitz01c1b1f2013-02-27 13:49:04 -080023+
24The code is so horribly incorrect/buggy/broken that it must not be
25submitted to this project, or to this branch. This value is valid
26across all patch sets in the same change, i.e. the reviewer must
27actively change his/her review to something else before the change
28is submittable.
29+
30*Any -2 blocks submit.*
31
Paul Fertser2474e522014-01-23 10:00:59 +040032* -1 I would prefer this is not merged as is
Dave Borowitz01c1b1f2013-02-27 13:49:04 -080033+
34The code doesn't look right, or could be done differently, but
35the reviewer is willing to live with it as-is if another reviewer
36accepts it, perhaps because it is better than what is currently in
37the project. Often this is also used by contributors who don't like
38the change, but also aren't responsible for the project long-term
39and thus don't have final say on change submission.
40+
41Does not block submit.
42
43* 0 No score
44+
45Didn't try to perform the code review task, or glanced over it but
46don't have an informed opinion yet.
47
48* +1 Looks good to me, but someone else must approve
49+
50The code looks right to this reviewer, but the reviewer doesn't
51have access to the `+2` value for this category. Often this is
52used by contributors to a project who were able to review the change
53and like what it is doing, but don't have final approval over what
54gets submitted.
55
56* +2 Looks good to me, approved
57+
58Basically the same as `+1`, but for those who have final say over
59how the project will develop.
60+
61*Any +2 enables submit.*
62
63For a change to be submittable, the latest patch set must have a
64`+2 Looks good to me, approved` in this category, and no
65`-2 Do not submit`. Thus `-2` on any patch set can block a submit,
66while `+2` on the latest patch set can enable it.
67
68If a Gerrit installation does not wish to use this label in any project,
69the `[label "Code-Review"]` section can be deleted from `project.config`
70in `All-Projects`.
71
72If a Gerrit installation or project wants to modify the description text
73associated with these label values, the text can be updated in the
74`label.Code-Review.value` fields in `project.config`.
75
76Additional entries could be added to `label.Code-Review.value` to
77further extend the negative and positive range, but there is likely
78little value in doing so as this only expands the middle region. This
79label is a `MaxWithBlock` type, which means that the lowest negative
80value if present blocks a submit, while the highest positive value is
81required to enable submit.
82
Shawn Pearce77d96622013-03-28 18:02:19 -040083[[label_Verified]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080084== Label: Verified
Shawn Pearce77d96622013-03-28 18:02:19 -040085
86The Verified label was originally invented by the Android Open Source
87Project to mean 'compiles, passes basic unit tests'. Some CI tools
88expect to use the Verified label to vote on a change after running.
89
90Administrators can install the Verified label by adding the following
91text to `project.config`:
92
Michael Ochmannb99feab2016-07-06 14:10:22 +020093----
Shawn Pearce77d96622013-03-28 18:02:19 -040094 [label "Verified"]
Edwin Kempinba8cdd82013-04-03 15:35:06 +020095 function = MaxWithBlock
Shawn Pearce77d96622013-03-28 18:02:19 -040096 value = -1 Fails
97 value = 0 No score
98 value = +1 Verified
Michael Ochmannb99feab2016-07-06 14:10:22 +020099----
Shawn Pearce77d96622013-03-28 18:02:19 -0400100
101The range of values is:
102
103* -1 Fails
104+
105Tried to compile, but got a compile error, or tried to run tests,
106but one or more tests did not pass.
107+
108*Any -1 blocks submit.*
109
110* 0 No score
111+
112Didn't try to perform the verification tasks.
113
114* +1 Verified
115+
116Compiled (and ran tests) successfully.
117+
118*Any +1 enables submit.*
119
120For a change to be submittable, the change must have a `+1 Verified`
121in this label, and no `-1 Fails`. Thus, `-1 Fails` can block a submit,
122while `+1 Verified` enables a submit.
123
124Additional values could also be added to this label, to allow it to
125behave more like `Code-Review` (below). Add -2 and +2 entries to the
126`label.Verified.value` fields in `project.config` to get the same
127behavior.
128
129
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800130[[label_custom]]
David Pursehouse584aa192017-02-28 16:28:43 +0900131== Customized Labels
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800132
David Pursehouse584aa192017-02-28 16:28:43 +0900133Site administrators and project owners can define their own labels,
134or customize labels inherited from parent projects.
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800135
136See above for descriptions of how <<label_Verified,`Verified`>>
137and <<label_Code-Review,`Code-Review`>> work, and add your own
138label to `project.config` to get the same behavior over your own range
139of values, for any label you desire.
140
141Just like the built-in labels, users need to be given permissions to
142vote on custom labels. Permissions can either be added by manually
143editing project.config when adding the labels, or, once the labels are
144added, permission categories for those labels will show up in the
145permission editor web UI.
146
147Labels may be added to any project's `project.config`; the default
David Pursehouse584aa192017-02-28 16:28:43 +0900148labels are defined in `All-Projects`.
149
150[[label_inheritance]]
151=== Inheritance
152
153Labels are inherited from parent projects. A child project may add,
David Pursehouse9c333f02017-02-28 16:35:27 +0900154override, or remove labels defined in its parents.
155
156Overriding a label in a child project overrides all its properties and
157values. It is not possible to modify an inherited label by adding
158properties in the child project's configuration; all properties from
159the parent definition must be redefined in the child.
160
161To remove a label in a child project, add an empty label with the same
162name as in the parent.
David Pursehouse584aa192017-02-28 16:28:43 +0900163
164[[label_layout]]
165=== Layout
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800166
167Labels are laid out in the order they are specified in project.config,
168with inherited labels appearing first, providing some layout control to
169the administrator.
170
171[[label_name]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800172=== `label.Label-Name`
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800173
174The name for a label, consisting only of alphanumeric characters and
175`-`.
176
177
178[[label_value]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800179=== `label.Label-Name.value`
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800180
181A multi-valued key whose values are of the form `"<#> Value description
182text"`. The `<#>` may be any positive or negative number with an
183optional leading `+`.
184
185
Khai Do4c91b002014-04-06 23:27:43 -0700186[[label_defaultValue]]
187=== `label.Label-Name.defaultValue`
188
189The default value (or score) for the label. The defaultValue must be
190within the range of valid label values. It is an optional label setting,
191if not defined the defaultValue for the label will be 0. When a
192defaultValue is defined, that value will get set in the Reply dialog
193by default.
194
195A defaultValue can be set to a score that is outside of the permissible
196range for a user. In that case the score that will get set in the Reply
197box will be either the lowest or highest score in the permissible range.
198
199
Edwin Kempinba8cdd82013-04-03 15:35:06 +0200200[[label_function]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800201=== `label.Label-Name.function`
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800202
203The name of a function for evaluating multiple votes for a label. This
204function is only applied if the default submit rule is used for a label.
205If you write a link:prolog-cookbook.html#HowToWriteSubmitRules[custom
206submit rule] (and do not call the default rule), the function name is
207ignored and may be treated as optional.
208
209Valid values are:
210
211* `MaxWithBlock` (default)
212+
213The lowest possible negative value, if present, blocks a submit, while
214the highest possible positive value is required to enable submit. There
215must be at least one positive value, or else submit will never be
216enabled. To permit blocking submits, ensure a negative value is defined.
217
Khai Dod44ea942013-07-31 07:45:17 -0700218* `AnyWithBlock`
219+
220The lowest possible negative value, if present, blocks a submit, Any
221other value enables a submit. To permit blocking submits, ensure
222that a negative value is defined.
223
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800224* `MaxNoBlock`
225+
226The highest possible positive value is required to enable submit, but
227the lowest possible negative value will not block the change.
228
229* `NoBlock`/`NoOp`
230+
231The label is purely informational and values are not considered when
232determining whether a change is submittable.
233
Nasser Grainawi240ea292015-11-09 09:56:56 -0800234* `PatchSetLock`
235+
236The `PatchSetLock` function provides a locking mechanism for patch
237sets. This function's values are not considered when determining
238whether a change is submittable. When set, no new patchsets can be
239created and rebase and abandon are blocked.
240+
241This function is designed to allow overlapping locks, so several lock
242accounts could lock the same change.
243+
244Allowed range of values are 0 (Patch Set Unlocked) to 1 (Patch Set
245Locked).
246
Dave Borowitz20d71e52016-11-15 17:02:16 -0800247[[label_allowPostSubmit]]
248=== `label.Label-Name.allowPostSubmit`
249
250If true, the label may be voted on for changes that have already been
251submitted. If false, the label will not appear in the UI and will not
252be accepted when reviewing a closed change.
253
254In either case, voting on a label after submission is only permitted if
255the new vote is at least as high as the old vote by that user. This
256avoids creating the false impression that a post-submit vote can change
257the past and affect submission somehow.
258
259Defaults to true.
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800260
261[[label_copyMinScore]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800262=== `label.Label-Name.copyMinScore`
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800263
264If true, the lowest possible negative value for the label is copied
Marco Miller5f834712015-03-13 17:20:44 -0400265forward when a new patch set is uploaded. Defaults to false, except
266for All-Projects which has it true by default.
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800267
Shawn Pearcea7c4a3a2013-03-26 15:58:51 -0400268[[label_copyMaxScore]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800269=== `label.Label-Name.copyMaxScore`
Shawn Pearcea7c4a3a2013-03-26 15:58:51 -0400270
271If true, the highest possible positive value for the label is copied
272forward when a new patch set is uploaded. This can be used to enable
273sticky approvals, reducing turn-around for trivial cleanups prior to
Marco Miller5f834712015-03-13 17:20:44 -0400274submitting a change. Defaults to false.
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800275
David Pursehouse973746c2016-02-29 22:29:03 +0900276[[label_copyAllScoresOnMergeCommitFirstParentUpdate]]
Dariusz Lukszacedbbee2016-01-29 12:06:20 +0100277=== `label.Label-Name.copyAllScoresOnMergeCommitFirstParentUpdate`
278
279This policy is useful if you don't want to trigger CI or human
280verification again if your target branch moved on but the feature
281branch being merged into the target branch did not change. It only
282applies if the patch set is a merge commit.
283
284If true, all scores for the label are copied forward when a new
285patch set is uploaded that is a new merge commit which only
Dave Borowitz2878bb52016-02-08 09:44:32 -0500286differs from the previous patch set in its first parent, or has
287identical parents. The first parent would be the parent of the merge
288commit that is part of the change's target branch, whereas the other
289parent(s) refer to the feature branch(es) to be merged.
290
Dariusz Lukszacedbbee2016-01-29 12:06:20 +0100291Defaults to false.
292
Edwin Kempinf5c08412013-09-18 09:41:01 +0200293[[label_copyAllScoresOnTrivialRebase]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800294=== `label.Label-Name.copyAllScoresOnTrivialRebase`
Edwin Kempinf5c08412013-09-18 09:41:01 +0200295
296If true, all scores for the label are copied forward when a new patch
297set is uploaded that is a trivial rebase. A new patch set is considered
298as trivial rebase if the commit message is the same as in the previous
299patch set and if it has the same code delta as the previous patch set.
Dave Borowitz2878bb52016-02-08 09:44:32 -0500300This is the case if the change was rebased onto a different parent, or
301if the parent did not change at all.
302
Edwin Kempinf5c08412013-09-18 09:41:01 +0200303This can be used to enable sticky approvals, reducing turn-around for
Zalan Blenessyae476862015-02-13 14:06:57 +0100304trivial rebases prior to submitting a change.
Edwin Kempin09f7f7b2015-04-28 10:43:26 +0200305For the pre-installed Code-Review label this is enabled by default.
Dave Borowitz2878bb52016-02-08 09:44:32 -0500306
Zalan Blenessyae476862015-02-13 14:06:57 +0100307Defaults to false.
Edwin Kempinf5c08412013-09-18 09:41:01 +0200308
Edwin Kempin54122d32013-09-18 13:46:14 +0200309[[label_copyAllScoresIfNoCodeChange]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800310=== `label.Label-Name.copyAllScoresIfNoCodeChange`
Edwin Kempin54122d32013-09-18 13:46:14 +0200311
312If true, all scores for the label are copied forward when a new patch
Zalan Blenessyae476862015-02-13 14:06:57 +0100313set is uploaded that has the same parent tree as the previous patch
Edwin Kempin54122d32013-09-18 13:46:14 +0200314set and the same code delta as the previous patch set. This means only
315the commit message is different. This can be used to enable sticky
316approvals on labels that only depend on the code, reducing turn-around
317if only the commit message is changed prior to submitting a change.
Edwin Kempin5ae4ff42015-04-28 10:48:06 +0200318For the Verified label that is installed by the link:pgm-init.html[init]
319site program this is enabled by default.
Dave Borowitz2878bb52016-02-08 09:44:32 -0500320
Edwin Kempin54122d32013-09-18 13:46:14 +0200321Defaults to false.
322
Zalan Blenessyae476862015-02-13 14:06:57 +0100323[[label_copyAllScoresIfNoChange]]
324=== `label.Label-Name.copyAllScoresIfNoChange`
325
326If true, all scores for the label are copied forward when a new patch
327set is uploaded that has the same parent tree, code delta, and commit
328message as the previous patch set. This means that only the patch
329set SHA1 is different. This can be used to enable sticky
330approvals, reducing turn-around for this special case.
331It is recommended to leave this enabled for both Verified and
Dave Borowitz2878bb52016-02-08 09:44:32 -0500332Code-Review labels.
333
334Defaults to true.
Zalan Blenessyae476862015-02-13 14:06:57 +0100335
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800336[[label_canOverride]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800337=== `label.Label-Name.canOverride`
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800338
339If false, the label cannot be overridden by child projects. Any
340configuration for this label in child projects will be ignored. Defaults
341to true.
342
Bruce Zu9b22c3a2013-09-06 01:23:03 +0800343[[label_branch]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800344=== `label.Label-Name.branch`
Bruce Zu9b22c3a2013-09-06 01:23:03 +0800345
346By default a given project's label applicable scope is all changes
347on all branches of this project and its child projects.
348
349Label's applicable scope can be branch specific via configuration.
350E.g. create a label `Video-Qualify` on parent project and configure
351the `branch` as:
352
Michael Ochmannb99feab2016-07-06 14:10:22 +0200353----
Bruce Zu9b22c3a2013-09-06 01:23:03 +0800354 [label "Video-Qualify"]
355 branch = refs/heads/video-1.0/*
356 branch = refs/heads/video-1.1/Kino
Michael Ochmannb99feab2016-07-06 14:10:22 +0200357----
Bruce Zu9b22c3a2013-09-06 01:23:03 +0800358
359Then *only* changes in above branch scope of parent project and child
360projects will be affected by `Video-Qualify`.
361
Michael Ochmann8129ece2016-07-08 11:25:25 +0200362[NOTE]
363The `branch` is independent from the branch scope defined in `access`
Bruce Zu9b22c3a2013-09-06 01:23:03 +0800364parts in `project.config` file. That means from the UI a user can always
365assign permissions for that label on a branch, but this permission is then
366ignored if the label doesn't apply for that branch.
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800367
368[[label_example]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800369=== Example
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800370
371To define a new 3-valued category that behaves exactly like `Verified`,
372but has different names/labels:
373
Michael Ochmannb99feab2016-07-06 14:10:22 +0200374----
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800375 [label "Copyright-Check"]
Edwin Kempinba8cdd82013-04-03 15:35:06 +0200376 function = MaxWithBlock
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800377 value = -1 Do not have copyright
378 value = 0 No score
379 value = +1 Copyright clear
Michael Ochmannb99feab2016-07-06 14:10:22 +0200380----
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800381
382The new column will appear at the end of the table, and `-1 Do not have
383copyright` will block submit, while `+1 Copyright clear` is required to
384enable submit.
Edwin Kempin5beb89d2013-03-15 08:03:12 +0100385
Khai Do4c91b002014-04-06 23:27:43 -0700386=== Default Value Example
387
388This example attempts to describe how a label default value works with the
389user permissions. Assume the configuration below.
390
Michael Ochmannb99feab2016-07-06 14:10:22 +0200391----
Khai Do4c91b002014-04-06 23:27:43 -0700392 [access "refs/heads/*"]
393 label-Snarky-Review = -3..+3 group Administrators
394 label-Snarky-Review = -2..+2 group Project Owners
395 label-Snarky-Review = -1..+1 group Registered Users
396 [label "Snarky-Review"]
397 value = -3 Ohh, hell no!
398 value = -2 Hmm, I'm not a fan
399 value = -1 I'm not sure I like this
400 value = 0 No score
401 value = +1 I like, but need another to like it as well
402 value = +2 Hmm, this is pretty nice
403 value = +3 Ohh, hell yes!
404 defaultValue = -3
Michael Ochmannb99feab2016-07-06 14:10:22 +0200405----
Khai Do4c91b002014-04-06 23:27:43 -0700406
407Upon clicking the Reply button:
Edwin Kempinec7397e2015-04-07 09:34:56 +0200408
Khai Do4c91b002014-04-06 23:27:43 -0700409* Administrators have all scores (-3..+3) available, -3 is set as the default.
410* Project Owners have limited scores (-2..+2) available, -2 is set as the default.
411* Registered Users have limited scores (-1..+1) available, -1 is set as the default.
412
Alexandre Philbertb7d3c722016-01-28 09:04:06 -0500413=== Patch Set Lock Example
414
415This example shows how a label can be configured to have a standard patch set lock.
416
Michael Ochmannb99feab2016-07-06 14:10:22 +0200417----
Alexandre Philbertb7d3c722016-01-28 09:04:06 -0500418 [access "refs/heads/*"]
419 label-Patch-Set-Lock = +0..+1 group Administrators
420 [label "Patch-Set-Lock"]
421 function = PatchSetLock
422 value = 0 Patch Set Unlocked
423 value = +1 Patch Set Locked
424 defaultValue = 0
Michael Ochmannb99feab2016-07-06 14:10:22 +0200425----
Alexandre Philbertb7d3c722016-01-28 09:04:06 -0500426
Edwin Kempin5beb89d2013-03-15 08:03:12 +0100427GERRIT
428------
429Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -0700430
431SEARCHBOX
432---------