Intro
This post is mostly a short summary of Google‘s Code Review Developer Guide. I use these as my personal guidelines for code reviews.
How to check
- Look at every line
- Look at the context
- Make sure you're improving code health
- Compliment developers on good things
Things to check
Design
- Do interactions of various code pieces make sense?
- Does it integrate well with the rest of the system?
- Does this change belong in your codebase, or in a library?
Functionality
- Is all functionality implemented?
- Does the code what its intended to do?
Complexity
- Are code parts too complex?
- Can code parts be simplified?
- Over-engineering
Tests
- Correct, sensible, useful
- Will the tests fail when the code is broken?
- Does each test make simple and useful assertions?
- Are the tests separated appropriately between different test methods?
- Are tests simple enough and easy to read
- Do tests cover common and corner cases?
Comments
- Clear comments in understandable English
- Are the comments necessary (explain why instead of what)?
- If code isn't clear enough to explain itself, then the code should be made simpler.
- Mostly comments are for information that the code itself can't possibly contain
- Are existing comments still correct? (i.e., TODOs, comments advising against this change)
- Comments are different from documentation
Naming
- Long enough to fully communicate what the item is or does
- Not so long that it becomes hard to read
Style
- TODO
Documentation
- Documented how methods/classes should be used
- Documented how they behave when used
Consistency
- TODO