Code Review Checklist
Based on team discussions of Clean Code by Robert C. Martin
Functions
Are my functions short, simple, and doing one thing?
Do my new functions take too many parameters? Can they be marked
static?Do I have any functions that take boolean parameters that should be split into 2 functions instead?
Have I removed any unused functions?
Are my private methods right after the public method where they're used?
Have I made my function
staticif it does not reference class instance fields?
Variables
Are there any temporary variables I can remove and inline? Or any inline variables I should break up to improve readability?
Am I using
varin a repository that specifies types, or specifying types in a repository that usesvar? (Maintain consistency)Do I have any magic strings / numbers that should be replaced with constants?
Are there any variables I can mark
constorreadonly?
Conditionals
Are there any complicated conditionals I can simplify or encapsulate into their own method?
Are there any negative conditionals I can make positive?
Am I using a
switchstatement that can be refactored (use polymorphism instead)?
Comments
Did I add unnecessary comments? Are there existing comments that I can remove?
Did I make changes without updating the existing comments?
Did I remove all commented-out code?
General
Is there any duplicated code I can extract and reuse? (DRY - Don't Repeat Yourself)
Did I run Code Coverage Analysis on new methods / classes?
If using Linq, have I chosen the correct / most performant methods?
Have I removed any unused imports /
usingstatements?Is my formatting consistent with the existing code (spacing, capitalization style, etc)?
Immutability
Are we using
initfor properties whenever possible?Are there any variables I can mark
constorreadonly? (Duplicated from Variables - consider consolidating if desired)Are we using immutable collections when possible?
Note this was authored by a coworker named Josie
See Also: