⚖️ Code Review Standards - fuhui14/SWEN90017-2024-TAP GitHub Wiki
⚖️ Transaction Aide Platform (TAP) Code Review Standards
1. Objectives of Code Review
The primary objectives of conducting code reviews in the TAP project include:
- Improving Code Quality: Ensure that the code is robust, understandable, and maintainable.
- Knowledge Sharing: Facilitate knowledge transfer among team members which includes understanding of the overall system and specific components.
- Error Identification: Catch and fix errors early in the development process which might be missed during initial coding and testing phases.
- Standardization: Ensure that the code meets the predefined coding standards and guidelines.
2. Scope of Code Reviews
All code pushed to the main branches of our repositories must undergo review. This includes but is not limited to:
- New Features
- Bug Fixes
- Refactoring Changes
- Documentation Updates
3. Code Review Process
The code review process in the TAP project involves the following steps:
Preparation
- Reviewers should allocate sufficient time to perform a thorough review.
- Authors should annotate source code before the review to provide context and rationale for significant decisions.
Review
- Use the pull request (PR) feature on GitHub.
- Comment directly on lines of code and provide constructive feedback.
- Discuss alternative approaches where applicable.
Fixes and Follow-ups
- The author addresses the comments and makes necessary changes.
- If significant changes are made, a second round of reviews may be necessary.
Approval and Merge
- At least two approvals are required from senior developers for the PR to be merged.
- Automated tests must pass before merging.
4. Review Checklist
Reviewers should consider the following checklist:
- Correctness: Does the code correctly implement the intended functionality?
- Design: Is the code well-designed and appropriate for the system architecture?
- Efficiency: Does the code produce efficient outcomes without unnecessary complexity?
- Testing: Is the code well-tested? Are there any obvious missing tests?
- Readability and Style: Is the code easy to read and understand?
- Documentation: Is the code adequately documented, especially public APIs and non-obvious logic?
- Security: Does the code introduce any security vulnerabilities?
- Compliance: Does the code adhere to the specified coding standards and guidelines?
5. Common Issues to Look For
- Logical Errors
- Performance Issues
- Unnecessary Complexity
- Repetition and Redundancy
- Potential Bugs
- Styling Issues
6. Feedback and Continuous Improvement
- Constructive Feedback: Focus on the code, not the author. Be specific and provide context.
- Regular Retrospectives: Hold regular retrospectives to discuss the code review process and make adjustments as needed.