2 ms·
I find that reviewing code is a pain. Not just for me, but for the submitter too if I take too long / I am excessively nitpicky about code style issues. I don
by rwmj 11y ago
I find that reviewing code is a pain. Not just for me, but for the submitter too if I take too long / I am excessively nitpicky about code style issues. I don't think good reviewing tools exist right now. You can rope together multiple tools which require constant babysitting, but there's no good low maintenance all-in-one solution (or if there is, please suggest it!)
Anyway, given that caveat, here are my tips:
(1) Have a "checkpatch" script that can be run over the code before it is sent. This script should do all the nitpicky coding style stuff. If the submitter didn't check their patch, you immediately reject it (some projects automate this). Here is an example from the qemu project: http://git.qemu.org/?p=qemu.git;a=blob;f=scripts/checkpatch.pl;hb=HEAD http://git.qemu.org/?p=qemu.git;a=blob;f=scripts/checkpatch....
(2) Have something like patchwork, or github pull requests, or openstack gerrit reviews, which tracks which submitters have submitted patches, which is the latest version of their patches, and so on.
(3) Have some automation which runs the test suite against submitted patches and immediately rejects any which fail.
(4) Have documentation which tells people how to submit patches, what scripts to run, and encourages submitters to split their changes into reviewable commits. This is more art than science, but good coders will eventually get it. Here are qemu's instructions: http://wiki.qemu.org/Contribute/SubmitAPatch http://wiki.qemu.org/Contribute/SubmitAPatch
Now when you review a patch:
(5) Apply it to your tree and make sure it compiles. Enable warn=error so no warnings can escape your notice.
(6) If it comes from a trusted submitter, and looks sane, I generally ACK those without a detailed review.
(7) If an earlier version of the patch was sent, go back and look at your comments, then check everything that you asked to be fixed was fixed.
(8) Go through each commit, line by line, and check everything. This is the tedious bit I'm afraid. But hopefully the previous steps will have rejected the worst mistakes.
(9) Try to be level headed and provide constructive criticism (even if the patch is objectively terrible). Also try to turn around patches quickly (I'm very guilty of not doing this, so do as I say not as I do).