In the following a code review checklist is presented where each section focuses one aspect of software/code quality.
- Functional correctness: Does the solution correctly do what it does?
- Functional completeness: Does the solution do all that it should do?
- Naming: Do variables, methods and classes/types have appropriate naming?
- Commenting: Is the code self-documenting or else does it have sufficient comments?
- Code complexity: Are methods, functions, modules or procedures small, concise, coherent and understandable?
- Code complexity: Do methods have a low cognitive complexity score?
- Code Duplication: Does the code adhere to the DRY principle?
- Does the code have appropriate folder structure?
- Does the code appropriately apply object-oriented principles?
- Do classes have high cohesion and low coupling?
- Does the code adhere to the YAGNI principle?
- Does the code adhere to the KISS principle?
- Does the code adhere to SOLID principles?
- Error Handling: Is error handling done the correct way?
- Logging: Should any logging or debugging information be added or removed?
- Error Handling & Logging: Are error messages user-friendly?
- Does the code hold any hard coded passwords or keys?
- Is the solution revealing any sensitive data to non-admin users?
- Are there any critical performance improvements required?
- Is the implemented solution well designed from a usability perspective?
- Is the solution well documented?
- Is the code testable?
- Does the code have automated tests (unit/integration/system tests)?
- Do the tests have adequate code coverage?
Code review is a dynamic which allow for team members to proofread each other’s code and to ensure a code delivered is a code weighed. Developer bias can sometimes lead to unintentional or intentional quality compromises which can lead to technical debt in a codebases. Code reviews are inherently a roleplay interaction and as such for it to work it is important for a code reviewer to adhere to certain guidelines to facilitate constructive exchanges.
When reviewing someone else's code:
- It is acceptable to pass on comments on standards. 📐 It is important to distinguish coding standards from coding preferences. Coding standards are a set of measurable code quality requirements which is agreed upon by a group of developers that includes both the reviewer and code author.
When reviewing someone else's code:
- Do not pass on comments on style! 💅🏻 Everyone has a coding style which matches their preferences and coding experience. Code reviewers should be accepting of the diversity in coding styles. If a reviewer inadvertently forces an author to change their coding style, the author may feel they no longer own their code and as such may no longer be able to take responsibility for their code as effectively.
[1] Code Review: A Comprehensive Checklist