blob: 0c6df1b38025d6e4865ac4560c61322b6eff2ca1 [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.
4All changes must be reviewed.
5
Daniel Cheng6bffde02020-06-12 19:10:456The general patch, upload, and land process is covered in more detail in the
7[contributing code](contributing.md) page.
brettw40e953e2017-02-08 17:49:288
9# Code review policies
10
11Ideally the reviewer is someone who is familiar with the area of code you are
brettw2019b9e2017-02-09 06:40:2012touching. Any committer can review code, but an owner must provide a review
13for each directory you are touching. If you have doubts, look at the git blame
14for the file and the `OWNERS` files (see below).
brettw40e953e2017-02-08 17:49:2815
Michael Giuffridaaf367052018-03-22 20:22:3416To indicate a positive review, the reviewer provides a "Code-Review +1" in
17Gerrit, also known as an LGTM ("Looks Good To Me"). A score of "-1" indicates
18the change should not be submitted as-is.
brettw40e953e2017-02-08 17:49:2819
Michael Giuffridaaf367052018-03-22 20:22:3420If you have multiple reviewers, provide a message indicating what you expect
21from each reviewer. Otherwise people might assume their input is not required
22or waste time with redundant reviews.
brettw2019b9e2017-02-09 06:40:2023
Annie Sullivand04212e72017-10-19 21:11:3224Please also read [Respectful Changes](cl_respect.md) and
25[Respectful Code Reviews](cr_respect.md).
26
brettw2019b9e2017-02-09 06:40:2027#### Expectations for all reviewers
brettw40e953e2017-02-08 17:49:2828
29 * Aim to provide some kind of actionable response within 24 hours of receipt
Michael Giuffridaaf367052018-03-22 20:22:3430 (not counting weekends and holidays). This doesn't mean you have to do a
31 complete review, but you should be able to give some initial feedback,
32 request more time, or suggest another reviewer.
brettw40e953e2017-02-08 17:49:2833
Michael Giuffridaaf367052018-03-22 20:22:3434 * Use the status field in Gerrit settings to indicate if you're away and when
Mike Frysinger7b15bde2018-05-15 09:28:0535 you'll be back.
brettw40e953e2017-02-08 17:49:2836
37 * Don't generally discourage people from sending you code reviews. This
Michael Giuffridaaf367052018-03-22 20:22:3438 includes using a blanket "slow" in your status field.
brettw40e953e2017-02-08 17:49:2839
40## OWNERS files
41
brettw2019b9e2017-02-09 06:40:2042In various directories there are files named `OWNERS` that list the email
brettw40e953e2017-02-08 17:49:2843addresses of people qualified to review changes in that directory. You must
44get a positive review from an owner of each directory your change touches.
45
brettw2019b9e2017-02-09 06:40:2046Owners files are recursive, so each file also applies to its subdirectories.
47It's generally best to pick more specific owners. People listed in higher-level
thestig9208d8ba2017-06-09 22:05:3248directories may have less experience with the code in question. For example,
49the reviewers in the `//chrome/browser/component_name/OWNERS` file will likely
50be more familiar with code in `//chrome/browser/component_name/sub_component`
51than reviewers in the higher-level `//chrome/OWNERS` file.
52
53More detail on the owners file format is provided in the "More information"
54section below.
brettw40e953e2017-02-08 17:49:2855
brettw2019b9e2017-02-09 06:40:2056*Tip:* The `git cl owners` command can help find owners.
brettw40e953e2017-02-08 17:49:2857
58While owners must approve all patches, any committer can contribute to the
59review. In some directories the owners can be overloaded or there might be
60people not listed as owners who are more familiar with the low-level code in
61question. In these cases it's common to request a low-level review from an
62appropriate person, and then request a high-level owner review once that's
63complete. As always, be clear what you expect of each reviewer to avoid
64duplicated work.
65
brettw2019b9e2017-02-09 06:40:2066Owners do not have to pick other owners for reviews. Since they should already
67be familiar with the code in question, a thorough review from any appropriate
68committer is sufficient.
brettw40e953e2017-02-08 17:49:2869
brettw2019b9e2017-02-09 06:40:2070#### Expectations of owners
71
72The existing owners of a directory approve additions to the list. It is
Wei-Yin Chen (陳威尹)681bc322017-07-20 01:55:1173preferable to have many directories, each with a smaller number of specific
Dirk Pranke4f9740c2018-10-17 03:01:0674owners rather than large directories with many owners. Owners should:
brettw2019b9e2017-02-09 06:40:2075
76 * Demonstrate excellent judgment, teamwork and ability to uphold Chrome
77 development principles.
78
79 * Be already acting as an owner, providing high-quality reviews and design
Dirk Pranke4f9740c2018-10-17 03:01:0680 feedback.
brettw2019b9e2017-02-09 06:40:2081
Dirk Pranke4f9740c2018-10-17 03:01:0682 * Be a Chromium project member with full commit access of at least three
brettw2019b9e2017-02-09 06:40:2083 months tenure.
84
85 * Have submitted a substantial number of non-trivial changes to the affected
brettw40e953e2017-02-08 17:49:2886 directory.
87
brettw2019b9e2017-02-09 06:40:2088 * Have committed or reviewed substantial work to the affected directory
Dirk Pranke4f9740c2018-10-17 03:01:0689 within the last ninety days.
brettw40e953e2017-02-08 17:49:2890
brettw2019b9e2017-02-09 06:40:2091 * Have the bandwidth to contribute to reviews in a timely manner. If the load
92 is unsustainable, work to expand the number of owners. Don't try to
93 discourage people from sending reviews, including writing "slow" or
94 "emeritus" after your name.
95
Dirk Pranke4f9740c2018-10-17 03:01:0696The above are guidelines more than they are hard rules, and exceptions are
97okay as long as there is a consensus by the existing owners for them.
98For example, seldom-updated directories may have exceptions to the
99"substantiality" and "recency" requirements. Directories in `third_party`
100should list those most familiar with the library, regardless of how often
101the code is updated.
brettw40e953e2017-02-08 17:49:28102
brettw2019b9e2017-02-09 06:40:20103### OWNERS file details
104
105Refer to the [source code](https://chromium.googlesource.com/chromium/tools/depot_tools/+/master/owners.py)
thestig9208d8ba2017-06-09 22:05:32106for all details on the file format.
brettw2019b9e2017-02-09 06:40:20107
108This example indicates that two people are owners, in addition to any owners
109from the parent directory. `git cl owners` will list the comment after an
110owner address, so this is a good place to include restrictions or special
111instructions.
112```
113# You can include comments like this.