xref: /aosp_15_r20/external/pigweed/docs/code_reviews.rst (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1*61c4878aSAndroid Build Coastguard Worker.. _docs-code_reviews:
2*61c4878aSAndroid Build Coastguard Worker
3*61c4878aSAndroid Build Coastguard Worker======================
4*61c4878aSAndroid Build Coastguard WorkerCode review guidelines
5*61c4878aSAndroid Build Coastguard Worker======================
6*61c4878aSAndroid Build Coastguard WorkerAll Pigweed development happens on Gerrit, following the `typical Gerrit
7*61c4878aSAndroid Build Coastguard Workerdevelopment workflow <http://ceres-solver.org/contributing.html>`_. Consult the
8*61c4878aSAndroid Build Coastguard Worker`Gerrit User Guide
9*61c4878aSAndroid Build Coastguard Worker<https://gerrit-documentation.storage.googleapis.com/Documentation/2.12.3/intro-user.html>`_
10*61c4878aSAndroid Build Coastguard Workerfor more information on using Gerrit.
11*61c4878aSAndroid Build Coastguard Worker
12*61c4878aSAndroid Build Coastguard WorkerYou may add the special address
13*61c4878aSAndroid Build Coastguard Worker``[email protected]`` as a reviewer to
14*61c4878aSAndroid Build Coastguard Workerhave Gerrit automatically choose an appropriate person to review your change.
15*61c4878aSAndroid Build Coastguard Worker
16*61c4878aSAndroid Build Coastguard Worker-----------
17*61c4878aSAndroid Build Coastguard WorkerFor authors
18*61c4878aSAndroid Build Coastguard Worker-----------
19*61c4878aSAndroid Build Coastguard Worker
20*61c4878aSAndroid Build Coastguard Worker.. _docs-code_reviews-small-changes:
21*61c4878aSAndroid Build Coastguard Worker
22*61c4878aSAndroid Build Coastguard WorkerSmall changes
23*61c4878aSAndroid Build Coastguard Worker=============
24*61c4878aSAndroid Build Coastguard WorkerPlease follow the guidance in `Google's Eng-Practices Small CLs
25*61c4878aSAndroid Build Coastguard Worker<https://google.github.io/eng-practices/review/developer/small-cls.html>`_.
26*61c4878aSAndroid Build Coastguard Worker
27*61c4878aSAndroid Build Coastguard WorkerComplete changes
28*61c4878aSAndroid Build Coastguard Worker================
29*61c4878aSAndroid Build Coastguard WorkerPlease follow the guidance in :ref:`docs-contributing-contribution-standards`.
30*61c4878aSAndroid Build Coastguard WorkerIn summary, CLs must be complete, tested, and include documentation and unit
31*61c4878aSAndroid Build Coastguard Workertests for new code, bug fixes, and any code changes that merit it. However, to
32*61c4878aSAndroid Build Coastguard Workerenable iterative work and small changes, ``TODO`` comments are acceptable. They
33*61c4878aSAndroid Build Coastguard Workermust include an explanation of the problem and an action to take.
34*61c4878aSAndroid Build Coastguard Worker
35*61c4878aSAndroid Build Coastguard WorkerWe will not take over incomplete changes to avoid shifting our focus. We may
36*61c4878aSAndroid Build Coastguard Workerreject changes that do not meet the criteria above.
37*61c4878aSAndroid Build Coastguard Worker
38*61c4878aSAndroid Build Coastguard Worker-------------
39*61c4878aSAndroid Build Coastguard WorkerFor reviewers
40*61c4878aSAndroid Build Coastguard Worker-------------
41*61c4878aSAndroid Build Coastguard Worker
42*61c4878aSAndroid Build Coastguard WorkerReview speed
43*61c4878aSAndroid Build Coastguard Worker============
44*61c4878aSAndroid Build Coastguard WorkerFollow the advice at `Speed of Code Reviews
45*61c4878aSAndroid Build Coastguard Worker<https://google.github.io/eng-practices/review/reviewer/speed.html>`_.  Most
46*61c4878aSAndroid Build Coastguard Workerimportantly,
47*61c4878aSAndroid Build Coastguard Worker
48*61c4878aSAndroid Build Coastguard Worker* If you are not in the middle of a focused task, **you should do a code review
49*61c4878aSAndroid Build Coastguard Worker  shortly after it comes in**.
50*61c4878aSAndroid Build Coastguard Worker* **One business day is the maximum time it should take to respond** to a code
51*61c4878aSAndroid Build Coastguard Worker  review request (i.e., first thing the next morning).
52*61c4878aSAndroid Build Coastguard Worker* If you will not be able to review the change within a business day, comment
53*61c4878aSAndroid Build Coastguard Worker  on the change stating so, and reassign to another reviewer if possible.
54*61c4878aSAndroid Build Coastguard Worker
55*61c4878aSAndroid Build Coastguard WorkerAttention set management
56*61c4878aSAndroid Build Coastguard Worker========================
57*61c4878aSAndroid Build Coastguard WorkerRemove yourself from the `attention set
58*61c4878aSAndroid Build Coastguard Worker<https://gerrit-review.googlesource.com/Documentation/user-attention-set.html>`_
59*61c4878aSAndroid Build Coastguard Workerfor changes where another person (author or reviewer) must take action before
60*61c4878aSAndroid Build Coastguard Workeryou can continue to review. You are encouraged, but not required, to leave a
61*61c4878aSAndroid Build Coastguard Workercomment when doing so, especially for changes by external contributors who may
62*61c4878aSAndroid Build Coastguard Workernot be familiar with our process.
63*61c4878aSAndroid Build Coastguard Worker
64*61c4878aSAndroid Build Coastguard Worker----------------------
65*61c4878aSAndroid Build Coastguard WorkerCommon advice playbook
66*61c4878aSAndroid Build Coastguard Worker----------------------
67*61c4878aSAndroid Build Coastguard WorkerWhat follows are bite-sized copy-paste-able advice when doing code reviews.
68*61c4878aSAndroid Build Coastguard WorkerFeel free to link to them from code review comments, too.
69*61c4878aSAndroid Build Coastguard Worker
70*61c4878aSAndroid Build Coastguard Worker.. _docs-code_reviews-playbook-platform-design:
71*61c4878aSAndroid Build Coastguard Worker
72*61c4878aSAndroid Build Coastguard WorkerShared platforms require careful design
73*61c4878aSAndroid Build Coastguard Worker=======================================
74*61c4878aSAndroid Build Coastguard WorkerPigweed is a platform shared by many embedded projects. This makes contributing
75*61c4878aSAndroid Build Coastguard Workerto Pigweed rewarding: your change will help teams around the world! But it also
76*61c4878aSAndroid Build Coastguard Workermakes contributing *hard*:
77*61c4878aSAndroid Build Coastguard Worker
78*61c4878aSAndroid Build Coastguard Worker* Edge cases that may not matter for one project can, and eventually will, come
79*61c4878aSAndroid Build Coastguard Worker  up in another one.
80*61c4878aSAndroid Build Coastguard Worker* Pigweed has many modules that can be used in isolation, but should also work
81*61c4878aSAndroid Build Coastguard Worker  together, exhibiting a unified design philosophy and guiding users towards
82*61c4878aSAndroid Build Coastguard Worker  safe, scalable patterns.
83*61c4878aSAndroid Build Coastguard Worker
84*61c4878aSAndroid Build Coastguard WorkerAs a result, Pigweed can't be as nimble as individual embedded projects, and
85*61c4878aSAndroid Build Coastguard Workeroften needs to engage in more careful design review, either in meetings with
86*61c4878aSAndroid Build Coastguard Workerthe core team or through :ref:`SEED-0001`. But we're committed to working
87*61c4878aSAndroid Build Coastguard Workerthrough this with you!
88*61c4878aSAndroid Build Coastguard Worker
89*61c4878aSAndroid Build Coastguard Worker
90*61c4878aSAndroid Build Coastguard Worker.. _docs-code_reviews-playbook-stale-changes:
91*61c4878aSAndroid Build Coastguard Worker
92*61c4878aSAndroid Build Coastguard WorkerStale changes
93*61c4878aSAndroid Build Coastguard Worker=============
94*61c4878aSAndroid Build Coastguard WorkerSometimes, a change doesn't make it out of the review process: after some
95*61c4878aSAndroid Build Coastguard Workerrounds of review, there are unresolved comments from the Pigweed team, but the
96*61c4878aSAndroid Build Coastguard Workerauthor is no longer actively working on the change.
97*61c4878aSAndroid Build Coastguard Worker
98*61c4878aSAndroid Build Coastguard WorkerFor any change that's not seen activity for 3 months, the Pigweed team will,
99*61c4878aSAndroid Build Coastguard Worker
100*61c4878aSAndroid Build Coastguard Worker#. `File a bug <https://issues.pigweed.dev/issues?q=status:open>`_ for the
101*61c4878aSAndroid Build Coastguard Worker   feature or bug that the change was addressing, referencing the change.
102*61c4878aSAndroid Build Coastguard Worker#. Mark the change Abandoned in Gerrit.
103*61c4878aSAndroid Build Coastguard Worker
104*61c4878aSAndroid Build Coastguard WorkerThis does *not* mean the change is rejected! It just indicates no further
105*61c4878aSAndroid Build Coastguard Workeraction on it is expected. As its author, you should feel free to reopen it when
106*61c4878aSAndroid Build Coastguard Workeryou have time to work on it again.
107*61c4878aSAndroid Build Coastguard Worker
108*61c4878aSAndroid Build Coastguard WorkerBefore making or sending major changes or SEEDs, please reach out in our
109*61c4878aSAndroid Build Coastguard Worker`chat room <https://discord.gg/M9NSeTA>`_ or on the `mailing list
110*61c4878aSAndroid Build Coastguard Worker<https://groups.google.com/forum/#!forum/pigweed>`_ first to ensure the changes
111*61c4878aSAndroid Build Coastguard Workermake sense for upstream. We generally go through a design phase before making
112*61c4878aSAndroid Build Coastguard Workerlarge changes. See :ref:`SEED-0001` for a description of this process; but
113*61c4878aSAndroid Build Coastguard Workerplease discuss with us before writing a full SEED. Let us know of any
114*61c4878aSAndroid Build Coastguard Workerpriorities, timelines, requirements, and limitations ahead of time.
115*61c4878aSAndroid Build Coastguard Worker
116*61c4878aSAndroid Build Coastguard WorkerGerrit for PRs
117*61c4878aSAndroid Build Coastguard Worker==============
118*61c4878aSAndroid Build Coastguard WorkerWe don't currently support GitHub pull requests. All Pigweed development takes
119*61c4878aSAndroid Build Coastguard Workerplace on `our Gerrit instance <https://pigweed-review.googlesource.com/>`_.
120*61c4878aSAndroid Build Coastguard WorkerPlease resubmit your change there!
121*61c4878aSAndroid Build Coastguard Worker
122*61c4878aSAndroid Build Coastguard WorkerSee :ref:`docs-contributing` for instructions, and consult the `Gerrit User
123*61c4878aSAndroid Build Coastguard WorkerGuide
124*61c4878aSAndroid Build Coastguard Worker<https://gerrit-documentation.storage.googleapis.com/Documentation/2.12.3/intro-user.html>`_
125*61c4878aSAndroid Build Coastguard Workerfor more information on using Gerrit.
126*61c4878aSAndroid Build Coastguard Worker
127*61c4878aSAndroid Build Coastguard Worker.. _docs-code_reviews-incomplete-docs-changes:
128*61c4878aSAndroid Build Coastguard Worker
129*61c4878aSAndroid Build Coastguard WorkerDocs-Only Changes Do Not Need To Be Complete
130*61c4878aSAndroid Build Coastguard Worker============================================
131*61c4878aSAndroid Build Coastguard WorkerDocumentation-only changes should generally be accepted if they make the docs
132*61c4878aSAndroid Build Coastguard Workerbetter or more complete, even if the documentation change itself is incomplete.
133