blob: b20cd74131836647d1ad9bc242b7bf06cf5115e6 [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
93====
94 [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
99====
100
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]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800131== Your Label Here
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800132
133Site administrators and project owners can also define their own labels.
134
135See above for descriptions of how <<label_Verified,`Verified`>>
136and <<label_Code-Review,`Code-Review`>> work, and add your own
137label to `project.config` to get the same behavior over your own range
138of values, for any label you desire.
139
140Just like the built-in labels, users need to be given permissions to
141vote on custom labels. Permissions can either be added by manually
142editing project.config when adding the labels, or, once the labels are
143added, permission categories for those labels will show up in the
144permission editor web UI.
145
146Labels may be added to any project's `project.config`; the default
147labels are defined in `All-Projects`. Labels are inherited from parent
148projects; a child project may add, override, or remove labels defined in
149its parents. Overriding a label in a child project overrides all its
150properties and values. To remove a label in a child project, add an
151empty label with the same name as in the parent.
152
153Labels are laid out in the order they are specified in project.config,
154with inherited labels appearing first, providing some layout control to
155the administrator.
156
157[[label_name]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800158=== `label.Label-Name`
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800159
160The name for a label, consisting only of alphanumeric characters and
161`-`.
162
163
164[[label_value]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800165=== `label.Label-Name.value`
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800166
167A multi-valued key whose values are of the form `"<#> Value description
168text"`. The `<#>` may be any positive or negative number with an
169optional leading `+`.
170
171
Khai Do4c91b002014-04-06 23:27:43 -0700172[[label_defaultValue]]
173=== `label.Label-Name.defaultValue`
174
175The default value (or score) for the label. The defaultValue must be
176within the range of valid label values. It is an optional label setting,
177if not defined the defaultValue for the label will be 0. When a
178defaultValue is defined, that value will get set in the Reply dialog
179by default.
180
181A defaultValue can be set to a score that is outside of the permissible
182range for a user. In that case the score that will get set in the Reply
183box will be either the lowest or highest score in the permissible range.
184
185
Edwin Kempinba8cdd82013-04-03 15:35:06 +0200186[[label_function]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800187=== `label.Label-Name.function`
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800188
189The name of a function for evaluating multiple votes for a label. This
190function is only applied if the default submit rule is used for a label.
191If you write a link:prolog-cookbook.html#HowToWriteSubmitRules[custom
192submit rule] (and do not call the default rule), the function name is
193ignored and may be treated as optional.
194
195Valid values are:
196
197* `MaxWithBlock` (default)
198+
199The lowest possible negative value, if present, blocks a submit, while
200the highest possible positive value is required to enable submit. There
201must be at least one positive value, or else submit will never be
202enabled. To permit blocking submits, ensure a negative value is defined.
203
Khai Dod44ea942013-07-31 07:45:17 -0700204* `AnyWithBlock`
205+
206The lowest possible negative value, if present, blocks a submit, Any
207other value enables a submit. To permit blocking submits, ensure
208that a negative value is defined.
209
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800210* `MaxNoBlock`
211+
212The highest possible positive value is required to enable submit, but
213the lowest possible negative value will not block the change.
214
215* `NoBlock`/`NoOp`
216+
217The label is purely informational and values are not considered when
218determining whether a change is submittable.
219
220
221[[label_copyMinScore]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800222=== `label.Label-Name.copyMinScore`
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800223
224If true, the lowest possible negative value for the label is copied
225forward when a new patch set is uploaded.
226
Shawn Pearcea7c4a3a2013-03-26 15:58:51 -0400227[[label_copyMaxScore]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800228=== `label.Label-Name.copyMaxScore`
Shawn Pearcea7c4a3a2013-03-26 15:58:51 -0400229
230If true, the highest possible positive value for the label is copied
231forward when a new patch set is uploaded. This can be used to enable
232sticky approvals, reducing turn-around for trivial cleanups prior to
233submitting a change.
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800234
Edwin Kempinf5c08412013-09-18 09:41:01 +0200235[[label_copyAllScoresOnTrivialRebase]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800236=== `label.Label-Name.copyAllScoresOnTrivialRebase`
Edwin Kempinf5c08412013-09-18 09:41:01 +0200237
238If true, all scores for the label are copied forward when a new patch
239set is uploaded that is a trivial rebase. A new patch set is considered
240as trivial rebase if the commit message is the same as in the previous
241patch set and if it has the same code delta as the previous patch set.
242This is the case if the change was rebased onto a different parent.
243This can be used to enable sticky approvals, reducing turn-around for
Zalan Blenessyae476862015-02-13 14:06:57 +0100244trivial rebases prior to submitting a change.
245It is recommended to enable this for the Code-Review label.
246Defaults to false.
Edwin Kempinf5c08412013-09-18 09:41:01 +0200247
Edwin Kempin54122d32013-09-18 13:46:14 +0200248[[label_copyAllScoresIfNoCodeChange]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800249=== `label.Label-Name.copyAllScoresIfNoCodeChange`
Edwin Kempin54122d32013-09-18 13:46:14 +0200250
251If true, all scores for the label are copied forward when a new patch
Zalan Blenessyae476862015-02-13 14:06:57 +0100252set is uploaded that has the same parent tree as the previous patch
Edwin Kempin54122d32013-09-18 13:46:14 +0200253set and the same code delta as the previous patch set. This means only
254the commit message is different. This can be used to enable sticky
255approvals on labels that only depend on the code, reducing turn-around
256if only the commit message is changed prior to submitting a change.
Zalan Blenessyae476862015-02-13 14:06:57 +0100257It is recommended to enable this for the Verified label if enabled.
Edwin Kempin54122d32013-09-18 13:46:14 +0200258Defaults to false.
259
Zalan Blenessyae476862015-02-13 14:06:57 +0100260[[label_copyAllScoresIfNoChange]]
261=== `label.Label-Name.copyAllScoresIfNoChange`
262
263If true, all scores for the label are copied forward when a new patch
264set is uploaded that has the same parent tree, code delta, and commit
265message as the previous patch set. This means that only the patch
266set SHA1 is different. This can be used to enable sticky
267approvals, reducing turn-around for this special case.
268It is recommended to leave this enabled for both Verified and
269Code-Review labels. Defaults to true.
270
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800271[[label_canOverride]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800272=== `label.Label-Name.canOverride`
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800273
274If false, the label cannot be overridden by child projects. Any
275configuration for this label in child projects will be ignored. Defaults
276to true.
277
Bruce Zu9b22c3a2013-09-06 01:23:03 +0800278[[label_branch]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800279=== `label.Label-Name.branch`
Bruce Zu9b22c3a2013-09-06 01:23:03 +0800280
281By default a given project's label applicable scope is all changes
282on all branches of this project and its child projects.
283
284Label's applicable scope can be branch specific via configuration.
285E.g. create a label `Video-Qualify` on parent project and configure
286the `branch` as:
287
288====
289 [label "Video-Qualify"]
290 branch = refs/heads/video-1.0/*
291 branch = refs/heads/video-1.1/Kino
292====
293
294Then *only* changes in above branch scope of parent project and child
295projects will be affected by `Video-Qualify`.
296
297NOTE: The `branch` is independent from the branch scope defined in `access`
298parts in `project.config` file. That means from the UI a user can always
299assign permissions for that label on a branch, but this permission is then
300ignored if the label doesn't apply for that branch.
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800301
302[[label_example]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800303=== Example
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800304
305To define a new 3-valued category that behaves exactly like `Verified`,
306but has different names/labels:
307
308====
309 [label "Copyright-Check"]
Edwin Kempinba8cdd82013-04-03 15:35:06 +0200310 function = MaxWithBlock
Dave Borowitz01c1b1f2013-02-27 13:49:04 -0800311 value = -1 Do not have copyright
312 value = 0 No score
313 value = +1 Copyright clear
314====
315
316The new column will appear at the end of the table, and `-1 Do not have
317copyright` will block submit, while `+1 Copyright clear` is required to
318enable submit.
Edwin Kempin5beb89d2013-03-15 08:03:12 +0100319
Khai Do4c91b002014-04-06 23:27:43 -0700320=== Default Value Example
321
322This example attempts to describe how a label default value works with the
323user permissions. Assume the configuration below.
324
325====
326 [access "refs/heads/*"]
327 label-Snarky-Review = -3..+3 group Administrators
328 label-Snarky-Review = -2..+2 group Project Owners
329 label-Snarky-Review = -1..+1 group Registered Users
330 [label "Snarky-Review"]
331 value = -3 Ohh, hell no!
332 value = -2 Hmm, I'm not a fan
333 value = -1 I'm not sure I like this
334 value = 0 No score
335 value = +1 I like, but need another to like it as well
336 value = +2 Hmm, this is pretty nice
337 value = +3 Ohh, hell yes!
338 defaultValue = -3
339====
340
341Upon clicking the Reply button:
342* Administrators have all scores (-3..+3) available, -3 is set as the default.
343* Project Owners have limited scores (-2..+2) available, -2 is set as the default.
344* Registered Users have limited scores (-1..+1) available, -1 is set as the default.
345
Edwin Kempin5beb89d2013-03-15 08:03:12 +0100346GERRIT
347------
348Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -0700349
350SEARCHBOX
351---------