Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 1 | = Gerrit Code Review - Review Labels |
Dave Borowitz | 01c1b1f | 2013-02-27 13:49:04 -0800 | [diff] [blame] | 2 | |
| 3 | As part of the code review process, reviewers score each change with |
| 4 | values for each label configured for the project. The label values that |
| 5 | a given user is allowed to set are defined according to the |
Fredrik Luthander | ac8af9e | 2013-05-08 01:06:25 +0200 | [diff] [blame] | 6 | link:access-control.html#category_review_labels[access controls]. Gerrit |
| 7 | comes pre-configured with the Code-Review label that can be granted to |
| 8 | groups within projects, enabling functionality for that group's members. |
Dave Borowitz | 01c1b1f | 2013-02-27 13:49:04 -0800 | [diff] [blame] | 9 | |
| 10 | |
Dave Borowitz | 01c1b1f | 2013-02-27 13:49:04 -0800 | [diff] [blame] | 11 | [[label_Code-Review]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 12 | == Label: Code-Review |
Dave Borowitz | 01c1b1f | 2013-02-27 13:49:04 -0800 | [diff] [blame] | 13 | |
| 14 | The code review label is the second of two default labels that is |
| 15 | configured upon the creation of a Gerrit instance. It may have any |
| 16 | meaning the project desires. It was originally invented by the Android |
| 17 | Open Source Project to mean 'I read the code and it seems reasonably |
| 18 | correct'. |
| 19 | |
| 20 | The range of values is: |
| 21 | |
Paul Fertser | 2474e52 | 2014-01-23 10:00:59 +0400 | [diff] [blame] | 22 | * -2 This shall not be merged |
Dave Borowitz | 01c1b1f | 2013-02-27 13:49:04 -0800 | [diff] [blame] | 23 | + |
| 24 | The code is so horribly incorrect/buggy/broken that it must not be |
| 25 | submitted to this project, or to this branch. This value is valid |
| 26 | across all patch sets in the same change, i.e. the reviewer must |
| 27 | actively change his/her review to something else before the change |
| 28 | is submittable. |
| 29 | + |
| 30 | *Any -2 blocks submit.* |
| 31 | |
Paul Fertser | 2474e52 | 2014-01-23 10:00:59 +0400 | [diff] [blame] | 32 | * -1 I would prefer this is not merged as is |
Dave Borowitz | 01c1b1f | 2013-02-27 13:49:04 -0800 | [diff] [blame] | 33 | + |
| 34 | The code doesn't look right, or could be done differently, but |
| 35 | the reviewer is willing to live with it as-is if another reviewer |
| 36 | accepts it, perhaps because it is better than what is currently in |
| 37 | the project. Often this is also used by contributors who don't like |
| 38 | the change, but also aren't responsible for the project long-term |
| 39 | and thus don't have final say on change submission. |
| 40 | + |
| 41 | Does not block submit. |
| 42 | |
| 43 | * 0 No score |
| 44 | + |
| 45 | Didn't try to perform the code review task, or glanced over it but |
| 46 | don't have an informed opinion yet. |
| 47 | |
| 48 | * +1 Looks good to me, but someone else must approve |
| 49 | + |
| 50 | The code looks right to this reviewer, but the reviewer doesn't |
| 51 | have access to the `+2` value for this category. Often this is |
| 52 | used by contributors to a project who were able to review the change |
| 53 | and like what it is doing, but don't have final approval over what |
| 54 | gets submitted. |
| 55 | |
| 56 | * +2 Looks good to me, approved |
| 57 | + |
| 58 | Basically the same as `+1`, but for those who have final say over |
| 59 | how the project will develop. |
| 60 | + |
| 61 | *Any +2 enables submit.* |
| 62 | |
| 63 | For 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, |
| 66 | while `+2` on the latest patch set can enable it. |
| 67 | |
| 68 | If a Gerrit installation does not wish to use this label in any project, |
| 69 | the `[label "Code-Review"]` section can be deleted from `project.config` |
| 70 | in `All-Projects`. |
| 71 | |
| 72 | If a Gerrit installation or project wants to modify the description text |
| 73 | associated with these label values, the text can be updated in the |
| 74 | `label.Code-Review.value` fields in `project.config`. |
| 75 | |
| 76 | Additional entries could be added to `label.Code-Review.value` to |
| 77 | further extend the negative and positive range, but there is likely |
| 78 | little value in doing so as this only expands the middle region. This |
| 79 | label is a `MaxWithBlock` type, which means that the lowest negative |
| 80 | value if present blocks a submit, while the highest positive value is |
| 81 | required to enable submit. |
| 82 | |
Shawn Pearce | 77d9662 | 2013-03-28 18:02:19 -0400 | [diff] [blame] | 83 | [[label_Verified]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 84 | == Label: Verified |
Shawn Pearce | 77d9662 | 2013-03-28 18:02:19 -0400 | [diff] [blame] | 85 | |
| 86 | The Verified label was originally invented by the Android Open Source |
| 87 | Project to mean 'compiles, passes basic unit tests'. Some CI tools |
| 88 | expect to use the Verified label to vote on a change after running. |
| 89 | |
| 90 | Administrators can install the Verified label by adding the following |
| 91 | text to `project.config`: |
| 92 | |
| 93 | ==== |
| 94 | [label "Verified"] |
Edwin Kempin | ba8cdd8 | 2013-04-03 15:35:06 +0200 | [diff] [blame] | 95 | function = MaxWithBlock |
Shawn Pearce | 77d9662 | 2013-03-28 18:02:19 -0400 | [diff] [blame] | 96 | value = -1 Fails |
| 97 | value = 0 No score |
| 98 | value = +1 Verified |
| 99 | ==== |
| 100 | |
| 101 | The range of values is: |
| 102 | |
| 103 | * -1 Fails |
| 104 | + |
| 105 | Tried to compile, but got a compile error, or tried to run tests, |
| 106 | but one or more tests did not pass. |
| 107 | + |
| 108 | *Any -1 blocks submit.* |
| 109 | |
| 110 | * 0 No score |
| 111 | + |
| 112 | Didn't try to perform the verification tasks. |
| 113 | |
| 114 | * +1 Verified |
| 115 | + |
| 116 | Compiled (and ran tests) successfully. |
| 117 | + |
| 118 | *Any +1 enables submit.* |
| 119 | |
| 120 | For a change to be submittable, the change must have a `+1 Verified` |
| 121 | in this label, and no `-1 Fails`. Thus, `-1 Fails` can block a submit, |
| 122 | while `+1 Verified` enables a submit. |
| 123 | |
| 124 | Additional values could also be added to this label, to allow it to |
| 125 | behave more like `Code-Review` (below). Add -2 and +2 entries to the |
| 126 | `label.Verified.value` fields in `project.config` to get the same |
| 127 | behavior. |
| 128 | |
| 129 | |
Dave Borowitz | 01c1b1f | 2013-02-27 13:49:04 -0800 | [diff] [blame] | 130 | [[label_custom]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 131 | == Your Label Here |
Dave Borowitz | 01c1b1f | 2013-02-27 13:49:04 -0800 | [diff] [blame] | 132 | |
| 133 | Site administrators and project owners can also define their own labels. |
| 134 | |
| 135 | See above for descriptions of how <<label_Verified,`Verified`>> |
| 136 | and <<label_Code-Review,`Code-Review`>> work, and add your own |
| 137 | label to `project.config` to get the same behavior over your own range |
| 138 | of values, for any label you desire. |
| 139 | |
| 140 | Just like the built-in labels, users need to be given permissions to |
| 141 | vote on custom labels. Permissions can either be added by manually |
| 142 | editing project.config when adding the labels, or, once the labels are |
| 143 | added, permission categories for those labels will show up in the |
| 144 | permission editor web UI. |
| 145 | |
| 146 | Labels may be added to any project's `project.config`; the default |
| 147 | labels are defined in `All-Projects`. Labels are inherited from parent |
| 148 | projects; a child project may add, override, or remove labels defined in |
| 149 | its parents. Overriding a label in a child project overrides all its |
| 150 | properties and values. To remove a label in a child project, add an |
| 151 | empty label with the same name as in the parent. |
| 152 | |
| 153 | Labels are laid out in the order they are specified in project.config, |
| 154 | with inherited labels appearing first, providing some layout control to |
| 155 | the administrator. |
| 156 | |
| 157 | [[label_name]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 158 | === `label.Label-Name` |
Dave Borowitz | 01c1b1f | 2013-02-27 13:49:04 -0800 | [diff] [blame] | 159 | |
| 160 | The name for a label, consisting only of alphanumeric characters and |
| 161 | `-`. |
| 162 | |
| 163 | |
| 164 | [[label_value]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 165 | === `label.Label-Name.value` |
Dave Borowitz | 01c1b1f | 2013-02-27 13:49:04 -0800 | [diff] [blame] | 166 | |
| 167 | A multi-valued key whose values are of the form `"<#> Value description |
| 168 | text"`. The `<#>` may be any positive or negative number with an |
| 169 | optional leading `+`. |
| 170 | |
| 171 | |
Khai Do | 4c91b00 | 2014-04-06 23:27:43 -0700 | [diff] [blame] | 172 | [[label_defaultValue]] |
| 173 | === `label.Label-Name.defaultValue` |
| 174 | |
| 175 | The default value (or score) for the label. The defaultValue must be |
| 176 | within the range of valid label values. It is an optional label setting, |
| 177 | if not defined the defaultValue for the label will be 0. When a |
| 178 | defaultValue is defined, that value will get set in the Reply dialog |
| 179 | by default. |
| 180 | |
| 181 | A defaultValue can be set to a score that is outside of the permissible |
| 182 | range for a user. In that case the score that will get set in the Reply |
| 183 | box will be either the lowest or highest score in the permissible range. |
| 184 | |
| 185 | |
Edwin Kempin | ba8cdd8 | 2013-04-03 15:35:06 +0200 | [diff] [blame] | 186 | [[label_function]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 187 | === `label.Label-Name.function` |
Dave Borowitz | 01c1b1f | 2013-02-27 13:49:04 -0800 | [diff] [blame] | 188 | |
| 189 | The name of a function for evaluating multiple votes for a label. This |
| 190 | function is only applied if the default submit rule is used for a label. |
| 191 | If you write a link:prolog-cookbook.html#HowToWriteSubmitRules[custom |
| 192 | submit rule] (and do not call the default rule), the function name is |
| 193 | ignored and may be treated as optional. |
| 194 | |
| 195 | Valid values are: |
| 196 | |
| 197 | * `MaxWithBlock` (default) |
| 198 | + |
| 199 | The lowest possible negative value, if present, blocks a submit, while |
| 200 | the highest possible positive value is required to enable submit. There |
| 201 | must be at least one positive value, or else submit will never be |
| 202 | enabled. To permit blocking submits, ensure a negative value is defined. |
| 203 | |
Khai Do | d44ea94 | 2013-07-31 07:45:17 -0700 | [diff] [blame] | 204 | * `AnyWithBlock` |
| 205 | + |
| 206 | The lowest possible negative value, if present, blocks a submit, Any |
| 207 | other value enables a submit. To permit blocking submits, ensure |
| 208 | that a negative value is defined. |
| 209 | |
Dave Borowitz | 01c1b1f | 2013-02-27 13:49:04 -0800 | [diff] [blame] | 210 | * `MaxNoBlock` |
| 211 | + |
| 212 | The highest possible positive value is required to enable submit, but |
| 213 | the lowest possible negative value will not block the change. |
| 214 | |
| 215 | * `NoBlock`/`NoOp` |
| 216 | + |
| 217 | The label is purely informational and values are not considered when |
| 218 | determining whether a change is submittable. |
| 219 | |
| 220 | |
| 221 | [[label_copyMinScore]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 222 | === `label.Label-Name.copyMinScore` |
Dave Borowitz | 01c1b1f | 2013-02-27 13:49:04 -0800 | [diff] [blame] | 223 | |
| 224 | If true, the lowest possible negative value for the label is copied |
| 225 | forward when a new patch set is uploaded. |
| 226 | |
Shawn Pearce | a7c4a3a | 2013-03-26 15:58:51 -0400 | [diff] [blame] | 227 | [[label_copyMaxScore]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 228 | === `label.Label-Name.copyMaxScore` |
Shawn Pearce | a7c4a3a | 2013-03-26 15:58:51 -0400 | [diff] [blame] | 229 | |
| 230 | If true, the highest possible positive value for the label is copied |
| 231 | forward when a new patch set is uploaded. This can be used to enable |
| 232 | sticky approvals, reducing turn-around for trivial cleanups prior to |
| 233 | submitting a change. |
Dave Borowitz | 01c1b1f | 2013-02-27 13:49:04 -0800 | [diff] [blame] | 234 | |
Edwin Kempin | f5c0841 | 2013-09-18 09:41:01 +0200 | [diff] [blame] | 235 | [[label_copyAllScoresOnTrivialRebase]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 236 | === `label.Label-Name.copyAllScoresOnTrivialRebase` |
Edwin Kempin | f5c0841 | 2013-09-18 09:41:01 +0200 | [diff] [blame] | 237 | |
| 238 | If true, all scores for the label are copied forward when a new patch |
| 239 | set is uploaded that is a trivial rebase. A new patch set is considered |
| 240 | as trivial rebase if the commit message is the same as in the previous |
| 241 | patch set and if it has the same code delta as the previous patch set. |
| 242 | This is the case if the change was rebased onto a different parent. |
| 243 | This can be used to enable sticky approvals, reducing turn-around for |
Zalan Blenessy | ae47686 | 2015-02-13 14:06:57 +0100 | [diff] [blame] | 244 | trivial rebases prior to submitting a change. |
| 245 | It is recommended to enable this for the Code-Review label. |
| 246 | Defaults to false. |
Edwin Kempin | f5c0841 | 2013-09-18 09:41:01 +0200 | [diff] [blame] | 247 | |
Edwin Kempin | 54122d3 | 2013-09-18 13:46:14 +0200 | [diff] [blame] | 248 | [[label_copyAllScoresIfNoCodeChange]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 249 | === `label.Label-Name.copyAllScoresIfNoCodeChange` |
Edwin Kempin | 54122d3 | 2013-09-18 13:46:14 +0200 | [diff] [blame] | 250 | |
| 251 | If true, all scores for the label are copied forward when a new patch |
Zalan Blenessy | ae47686 | 2015-02-13 14:06:57 +0100 | [diff] [blame] | 252 | set is uploaded that has the same parent tree as the previous patch |
Edwin Kempin | 54122d3 | 2013-09-18 13:46:14 +0200 | [diff] [blame] | 253 | set and the same code delta as the previous patch set. This means only |
| 254 | the commit message is different. This can be used to enable sticky |
| 255 | approvals on labels that only depend on the code, reducing turn-around |
| 256 | if only the commit message is changed prior to submitting a change. |
Zalan Blenessy | ae47686 | 2015-02-13 14:06:57 +0100 | [diff] [blame] | 257 | It is recommended to enable this for the Verified label if enabled. |
Edwin Kempin | 54122d3 | 2013-09-18 13:46:14 +0200 | [diff] [blame] | 258 | Defaults to false. |
| 259 | |
Zalan Blenessy | ae47686 | 2015-02-13 14:06:57 +0100 | [diff] [blame] | 260 | [[label_copyAllScoresIfNoChange]] |
| 261 | === `label.Label-Name.copyAllScoresIfNoChange` |
| 262 | |
| 263 | If true, all scores for the label are copied forward when a new patch |
| 264 | set is uploaded that has the same parent tree, code delta, and commit |
| 265 | message as the previous patch set. This means that only the patch |
| 266 | set SHA1 is different. This can be used to enable sticky |
| 267 | approvals, reducing turn-around for this special case. |
| 268 | It is recommended to leave this enabled for both Verified and |
| 269 | Code-Review labels. Defaults to true. |
| 270 | |
Dave Borowitz | 01c1b1f | 2013-02-27 13:49:04 -0800 | [diff] [blame] | 271 | [[label_canOverride]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 272 | === `label.Label-Name.canOverride` |
Dave Borowitz | 01c1b1f | 2013-02-27 13:49:04 -0800 | [diff] [blame] | 273 | |
| 274 | If false, the label cannot be overridden by child projects. Any |
| 275 | configuration for this label in child projects will be ignored. Defaults |
| 276 | to true. |
| 277 | |
Bruce Zu | 9b22c3a | 2013-09-06 01:23:03 +0800 | [diff] [blame] | 278 | [[label_branch]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 279 | === `label.Label-Name.branch` |
Bruce Zu | 9b22c3a | 2013-09-06 01:23:03 +0800 | [diff] [blame] | 280 | |
| 281 | By default a given project's label applicable scope is all changes |
| 282 | on all branches of this project and its child projects. |
| 283 | |
| 284 | Label's applicable scope can be branch specific via configuration. |
| 285 | E.g. create a label `Video-Qualify` on parent project and configure |
| 286 | the `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 | |
| 294 | Then *only* changes in above branch scope of parent project and child |
| 295 | projects will be affected by `Video-Qualify`. |
| 296 | |
| 297 | NOTE: The `branch` is independent from the branch scope defined in `access` |
| 298 | parts in `project.config` file. That means from the UI a user can always |
| 299 | assign permissions for that label on a branch, but this permission is then |
| 300 | ignored if the label doesn't apply for that branch. |
Dave Borowitz | 01c1b1f | 2013-02-27 13:49:04 -0800 | [diff] [blame] | 301 | |
| 302 | [[label_example]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 303 | === Example |
Dave Borowitz | 01c1b1f | 2013-02-27 13:49:04 -0800 | [diff] [blame] | 304 | |
| 305 | To define a new 3-valued category that behaves exactly like `Verified`, |
| 306 | but has different names/labels: |
| 307 | |
| 308 | ==== |
| 309 | [label "Copyright-Check"] |
Edwin Kempin | ba8cdd8 | 2013-04-03 15:35:06 +0200 | [diff] [blame] | 310 | function = MaxWithBlock |
Dave Borowitz | 01c1b1f | 2013-02-27 13:49:04 -0800 | [diff] [blame] | 311 | value = -1 Do not have copyright |
| 312 | value = 0 No score |
| 313 | value = +1 Copyright clear |
| 314 | ==== |
| 315 | |
| 316 | The new column will appear at the end of the table, and `-1 Do not have |
| 317 | copyright` will block submit, while `+1 Copyright clear` is required to |
| 318 | enable submit. |
Edwin Kempin | 5beb89d | 2013-03-15 08:03:12 +0100 | [diff] [blame] | 319 | |
Khai Do | 4c91b00 | 2014-04-06 23:27:43 -0700 | [diff] [blame] | 320 | === Default Value Example |
| 321 | |
| 322 | This example attempts to describe how a label default value works with the |
| 323 | user 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 | |
| 341 | Upon 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 Kempin | 5beb89d | 2013-03-15 08:03:12 +0100 | [diff] [blame] | 346 | GERRIT |
| 347 | ------ |
| 348 | Part of link:index.html[Gerrit Code Review] |
Yuxuan 'fishy' Wang | 99cb68d | 2013-10-31 17:26:00 -0700 | [diff] [blame] | 349 | |
| 350 | SEARCHBOX |
| 351 | --------- |