Let’s start by saying that the code review is a tailor-made suit and not a one fits all. What to report and what to ignore depends on the needs of the project and the level of the developer who submitted the code.
An inexperienced developer and an advanced one will have different standards and it would be pointless and frustrating to expect the same quality from both.
So here’s a complete list of things you might (or might not) look at in a code review.
Requirements
- The intended functionality is implemented
- All requirements are covered
- Edge cases are reasonably covered
Software and architecture
- Framework and libraries are suitable for the project and don’t add unnecessary complexity or loss of performance
- Framework and libraries are updated to the latest stable version
- The file and folder structure is clear and consistent. The principle of modularity is met.
- Each section of the project has a single responsibility and it’s immediately understandable
- The single source of truth principle is met. The same data is not handled in more than one way (E.g. state management)
- Logic is separate from presentation
Documentation
- There is a README containing description, requirements, instructions to build the project, main functionalities and everything is needed to understand the project at high level
- If there is a UI, there is also at least a style guide
- The functions are documented (for example with JSDoc or PhpDoc)
- If needed, there is functional documentation
- All documentation is clear, short and effective.
Performance
- The code is efficient, there are no repeated or unnecessary function.
- Resource-consuming calculations are cached or memoized
- Resources are loaded only when needed, there is an efficient resource handling or lazy loading.
- If there is a UI, Lighthouse doesn’t report too many errors and is preferably green
- Images are optimized if any
- There are no obvious memory leaks
The reviewer may suggest additional optimizations to further improve performance
Code quality
- The code is correct based on the technology used (there is no point in choosing a library if you don’t exploit its full potential)
- The code fits the industry standards and it’s not outdated (Only for new projects).
- The code has no potential side effects.
Null
orundefined
values are correctly handled (best would be using type checking)- There is a proper error handling
- There is a proper logging system
Security
- All dependencies are secure, updated and maintained. There are no known vulnerabilities.
- All inputs are validated and sanitized
- There are no security issues in the authentication system
- There are no critical data hardcoded
- Critical data are correctly encrypted
Code style
- Indentation is consistent across the application
- A Linter is used, it’s well configured and there are no ignored rules
Advanced
- There is a proper type checking, interfaces are clear and consistent
- There is a proper test coverage, test are passed and updated
- There is a technical debt list for future refactoring
Metropolis, Fritz Lang 1927