Skip to content

Instantly share code, notes, and snippets.

@bucker
Forked from kashifrazzaqui/code_review_checklist.txt
Last active December 4, 2020 16:28
Show Gist options
  • Save bucker/d19b64f6c92e2f3f3bdae87e1d2be7cc to your computer and use it in GitHub Desktop.
Save bucker/d19b64f6c92e2f3f3bdae87e1d2be7cc to your computer and use it in GitHub Desktop.
Code Review Checklist
## General
[ ] The code works
[ ] Follows coding conventions
[ ] There are no usages of 'magic numbers'
[ ] All variables are in the smallest scope possible
[ ] All class, variable, and method modifiers are correct.
[ ] There is no dead code (inaccessible at Runtime)
[ ] No code can be replaced with library functions
[ ] Required logs are present
[ ] No debugging code, no System.out.print, no stack traces info
[ ] Variables are not accidentally used with null values
[ ] Variables are immutable where possible
[ ] Code is not repeated or duplicated
[ ] No negatively named boolean variables
[ ] Constructors do not accept null/none values
[ ] Catch specific exceptions
[ ] Exceptions are not eaten if caught, unless explicitly documented otherwise
[ ] APIs and other public contracts check input values and fail fast
[ ] Blocks of code inside loops are as small as possible
[ ] No object exists longer than necessary
[ ] No memory leaks
## Naming
[ ] Names are spelt correctly
[ ] Following the naming conventions
[ ] Names is readable, don't play cute
[ ] Names properly describe what it does
## Comments
[ ] Comments explains "why", "what", and "how"
[ ] All methods are commented in clear language.
[ ] Comments exist and describe rationale or reasons for decisions in code
[ ] All public methods/interfaces/contracts are commented describing usage
[ ] All edge cases are described in comments
[ ] All unusual behaviour or edge case handling is commented
[ ] Data structures and units of measurement are explained
## Common Mistake
[ ] StringBuilder is used to concatenate strings
[ ] Arrays are checked for out of bound conditions
[ ] Files/Sockets/Cursors and other resources are properly closed even when an exception occurs in using them
[ ] Floating point numbers are not compared for equality
[ ] Uses final modifier to prevent mistaken assignments
[ ] Loops have a set length and correct termination conditions
## Threading
[ ] Objects accessed by multiple threads are accessed only through a lock, or synchronized methods.
[ ] Race conditions have been handled
[ ] Locks are acquired and released in the right order to prevent deadlocks, even in error handling code.
[ ] StringBuffer is used to concatenate strings in multi-threaded code
## Security
[ ] All data inputs are checked (for the correct type, length/size, format, and range)
[ ] Invalid parameter values handled such that exceptions are not thrown
[ ] No sensitive information is logged or visible in a stacktrace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment