blob: a6a7ab1d18c1a6115035a02497149f2bb5fc8f71 [file] [log] [blame] [view]
brettw40e953e2017-02-08 17:49:281# Code Reviews
2
3Code reviews are a central part of developing high-quality code for Chromium.
Lei Zhang3b32caa2021-03-22 17:24:194All change lists (CLs) must be reviewed.
brettw40e953e2017-02-08 17:49:285
Daniel Cheng6bffde02020-06-12 19:10:456The general patch, upload, and land process is covered in more detail in the
Jason D. Clintonc38b61d82021-04-20 20:02:147[contributing code](contributing.md) page. To learn about the code review changes
8and OWNERS policy changes launched on March 24, 2021, see
9[Mandatory Code Review and Native OWNERS](code_review_owners.md).
brettw40e953e2017-02-08 17:49:2810
11# Code review policies
12
13Ideally the reviewer is someone who is familiar with the area of code you are
brettw2019b9e2017-02-09 06:40:2014touching. Any committer can review code, but an owner must provide a review
Lei Zhang3b32caa2021-03-22 17:24:1915for each directory you are touching. If you have doubts, look at the `git blame`
16for the file and the `OWNERS` files ([more info](#owners-files)).
brettw40e953e2017-02-08 17:49:2817
John Abd-El-Malekdfd1edc2021-02-24 22:22:4018To indicate a positive review, the reviewer provides a `Code-Review +1` in
Michael Giuffridaaf367052018-03-22 20:22:3419Gerrit, also known as an LGTM ("Looks Good To Me"). A score of "-1" indicates
20the change should not be submitted as-is.
brettw40e953e2017-02-08 17:49:2821
Michael Giuffridaaf367052018-03-22 20:22:3422If you have multiple reviewers, provide a message indicating what you expect
23from each reviewer. Otherwise people might assume their input is not required
24or waste time with redundant reviews.
brettw2019b9e2017-02-09 06:40:2025
Annie Sullivand04212e72017-10-19 21:11:3226Please also read [Respectful Changes](cl_respect.md) and
27[Respectful Code Reviews](cr_respect.md).
28
brettw2019b9e2017-02-09 06:40:2029#### Expectations for all reviewers
brettw40e953e2017-02-08 17:49:2830
31 * Aim to provide some kind of actionable response within 24 hours of receipt
Michael Giuffridaaf367052018-03-22 20:22:3432 (not counting weekends and holidays). This doesn't mean you have to do a
33 complete review, but you should be able to give some initial feedback,
34 request more time, or suggest another reviewer.
brettw40e953e2017-02-08 17:49:2835
Michael Giuffridaaf367052018-03-22 20:22:3436 * Use the status field in Gerrit settings to indicate if you're away and when
Mike Frysinger7b15bde2018-05-15 09:28:0537 you'll be back.
brettw40e953e2017-02-08 17:49:2838
39 * Don't generally discourage people from sending you code reviews. This
Michael Giuffridaaf367052018-03-22 20:22:3440 includes using a blanket "slow" in your status field.
brettw40e953e2017-02-08 17:49:2841
42## OWNERS files
43
brettw2019b9e2017-02-09 06:40:2044In various directories there are files named `OWNERS` that list the email
brettw40e953e2017-02-08 17:49:2845addresses of people qualified to review changes in that directory. You must
46get a positive review from an owner of each directory your change touches.
47
brettw2019b9e2017-02-09 06:40:2048Owners files are recursive, so each file also applies to its subdirectories.
49It's generally best to pick more specific owners. People listed in higher-level
thestig9208d8ba2017-06-09 22:05:3250directories may have less experience with the code in question. For example,
51the reviewers in the `//chrome/browser/component_name/OWNERS` file will likely
52be more familiar with code in `//chrome/browser/component_name/sub_component`
53than reviewers in the higher-level `//chrome/OWNERS` file.
54
Lei Zhang3b32caa2021-03-22 17:24:1955More detail on the owners file format is provided [here](#owners-file-details).
brettw40e953e2017-02-08 17:49:2856
Lei Zhang3b32caa2021-03-22 17:24:1957*Tip:* The `git cl owners` command can help find owners. Gerrit also provides
Jason D. Clintonc38b61d82021-04-20 20:02:1458this functionality in the Reviewers field of CLs.
brettw40e953e2017-02-08 17:49:2859
60While owners must approve all patches, any committer can contribute to the
61review. In some directories the owners can be overloaded or there might be
62people not listed as owners who are more familiar with the low-level code in
63question. In these cases it's common to request a low-level review from an
64appropriate person, and then request a high-level owner review once that's
65complete. As always, be clear what you expect of each reviewer to avoid
66duplicated work.
67
brettw2019b9e2017-02-09 06:40:2068Owners do not have to pick other owners for reviews. Since they should already
69be familiar with the code in question, a thorough review from any appropriate
70committer is sufficient.
brettw40e953e2017-02-08 17:49:2871
brettw2019b9e2017-02-09 06:40:2072#### Expectations of owners
73
74The existing owners of a directory approve additions to the list. It is
Wei-Yin Chen (陳威尹)681bc322017-07-20 01:55:1175preferable to have many directories, each with a smaller number of specific
Dirk Pranke4f9740c2018-10-17 03:01:0676owners rather than large directories with many owners. Owners should:
brettw2019b9e2017-02-09 06:40:2077
78 * Demonstrate excellent judgment, teamwork and ability to uphold Chrome
79 development principles.
80
81 * Be already acting as an owner, providing high-quality reviews and design
Dirk Pranke4f9740c2018-10-17 03:01:0682 feedback.
brettw2019b9e2017-02-09 06:40:2083
Dirk Pranke4f9740c2018-10-17 03:01:0684 * Be a Chromium project member with full commit access of at least three
brettw2019b9e2017-02-09 06:40:2085 months tenure.
86
87 * Have submitted a substantial number of non-trivial changes to the affected
brettw40e953e2017-02-08 17:49:2888 directory.
89
brettw2019b9e2017-02-09 06:40:2090 * Have committed or reviewed substantial work to the affected directory
Dirk Pranke4f9740c2018-10-17 03:01:0691 within the last ninety days.
brettw40e953e2017-02-08 17:49:2892
brettw2019b9e2017-02-09 06:40:2093 * Have the bandwidth to contribute to reviews in a timely manner. If the load
94 is unsustainable, work to expand the number of owners. Don't try to
95 discourage people from sending reviews, including writing "slow" or
96 "emeritus" after your name.
97
Dirk Pranke4f9740c2018-10-17 03:01:0698The above are guidelines more than they are hard rules, and exceptions are
99okay as long as there is a consensus by the existing owners for them.
100For example, seldom-updated directories may have exceptions to the
101"substantiality" and "recency" requirements. Directories in `third_party`
102should list those most familiar with the library, regardless of how often
103the code is updated.
brettw40e953e2017-02-08 17:49:28104
brettw2019b9e2017-02-09 06:40:20105### OWNERS file details
106
107Refer to the [source code](https://chromium.googlesource.com/chromium/tools/depot_tools/+/master/owners.py)
thestig9208d8ba2017-06-09 22:05:32108for all details on the file format.
brettw2019b9e2017-02-09 06:40:20109
110This example indicates that two people are owners, in addition to any owners
111from the parent directory. `git cl owners` will list the comment after an
112owner address, so this is a good place to include restrictions or special
113instructions.
114```
115# You can include comments like this.
116[email protected]
117[email protected] # Only for the frobinator.
118```
119
120A `*` indicates that all committers are owners:
121```
122*
123```
124
brettwd040b0be2017-02-09 19:11:33125The text `set noparent` will stop owner propagation from parent directories.
Jochen Eisingerea8f92d82017-08-02 17:40:14126This should be rarely used. If you want to use `set noparent` except for IPC
127related files, please first reach out to chrome-eng-review@google.com.
128
Jochen Eisinger8f0c8d82019-10-25 18:28:27129You have to use `set noparent` together with a reference to a file that lists
130the owners for the given use case. Approved use cases are listed in
131`//build/OWNERS.setnoparent`. Owners listed in those files are expected to
132execute special governance functions such as eng review or ipc security review.
133Every set of owners should implement their own means of auditing membership. The
134minimum expectation is that membership in those files is reevaluated on
135project, or affiliation changes.
136
137In this example, only the eng reviewers are owners:
brettw2019b9e2017-02-09 06:40:20138```
139set noparent
Jochen Eisinger8f0c8d82019-10-25 18:28:27140file://ENG_REVIEW_OWNERS
brettw2019b9e2017-02-09 06:40:20141```
142
143The `per-file` directive allows owners to be added that apply only to files
Wei-Yin Chen (陳威尹)681bc322017-07-20 01:55:11144matching a pattern. In this example, owners from the parent directory
brettw2019b9e2017-02-09 06:40:20145apply, plus one person for some classes of files, and all committers are
146owners for the readme:
147```
148per-file [email protected]
149per-file foo.*[email protected]
150
151per-file readme.txt=*
152```
153
George Burgess IV1ef04932018-01-27 07:04:04