Mention even more about changes files in doc/HACKING
[tor.git] / doc / HACKING / HowToReview.md
blob2d1f3d1c9e51d8d2f2292310ac9ad34a002c5449
1 How to review a patch
2 =====================
4 Some folks have said that they'd like to review patches more often, but they
5 don't know how.
7 So, here are a bunch of things to check for when reviewing a patch!
9 Note that if you can't do every one of these, that doesn't mean you can't do
10 a good review!  Just make it clear what you checked for and what you didn't.
13 Top-level smell-checks
14 ----------------------
16 (Difficulty: easy)
18 - Does it compile with `--enable-fatal-warnings`?
20 - Does `make check-spaces` pass?
22 - Does `make check-changes` pass?
24 - Does it have a reasonable amount of tests?  Do they pass?  Do they leak
25   memory?
27 - Do all the new functions, global variables, types, and structure members have
28  documentation?
30 - Do all the functions, global variables, types, and structure members with
31   modified behavior have modified documentation?
33 - Do all the new torrc options have documentation?
35 - If this changes Tor's behavior on the wire, is there a design proposal?
37 - If this changes anything in the code, is there a "changes" file?
40 Let's look at the code!
41 -----------------------
43 - Does the code conform to CodingStandards.txt?
45 - Does the code leak memory?
47 - If two or more pointers ever point to the same object, is it clear which
48   pointer "owns" the object?
50 - Are all allocated resources freed?
52 - Are all pointers that should be const, const?
54 - Are `#defines` used for 'magic' numbers?
56 - Can you understand what the code is trying to do?
58 - Can you convince yourself that the code really does that?
60 - Is there duplicated code that could be turned into a function?
63 Let's look at the documentation!
64 --------------------------------
66 - Does the documentation confirm to CodingStandards.txt?
68 - Does it make sense?
70 - Can you predict what the function will do from its documentation?
73 Let's think about security!
74 ---------------------------
76 - If there are any arrays, buffers, are you 100% sure that they cannot
77   overflow?
79 - If there is any integer math, can it overflow or underflow?
81 - If there are any allocations, are you sure there are corresponding
82   deallocations?
84 - Is there a safer pattern that could be used in any case?
86 - Have they used one of the Forbidden Functions?
88 (Also see your favorite secure C programming guides.)