Skip to main content

Code Review Standard

Introduction

Code reviews are an essential part of the software development process at Hyletic. They help ensure code quality, maintainability, and adherence to coding standards. This document outlines the standards and best practices to be followed during code reviews for the Frontend Engineering department.

Goals of Code Reviews

  • Identify and fix bugs or issues before they reach production.
  • Ensure the code follows established coding standards and best practices.
  • Promote knowledge sharing and learning within the team.
  • Improve the overall quality, readability, and maintainability of the codebase.

Code Review Process

  1. Pull Request (PR) Creation:

    • When a developer completes a feature or bug fix, they should create a PR.
    • The PR should include a clear title, description, and relevant details.
    • The PR should be assigned to a reviewer(s) for code review.
  2. Reviewer Assignment:

    • Reviewers should be assigned based on their expertise and availability.
    • Ideally, at least two reviewers should be assigned to each PR to ensure thorough reviews.
  3. Code Review:

    • Reviewers should carefully review the code, focusing on the following aspects:
      • Code correctness: Ensure the code functions as intended and meets the requirements.
      • Code quality: Check for code readability, maintainability, and adherence to coding standards.
      • Best practices: Verify that the code follows established best practices and patterns.
      • Performance: Identify any potential performance bottlenecks or inefficiencies.
      • Security: Look for any security vulnerabilities or potential risks in the code.
      • Documentation: Check if the code is well-documented and includes necessary comments.
  4. Reviewer Feedback:

    • Reviewers should provide clear, constructive, and actionable feedback on the PR.
    • Feedback should be specific, focusing on areas that need improvement.
    • Reviewers should avoid personal attacks and maintain a professional tone.
  5. Iterative Improvements:

    • Developers should address the feedback received and make necessary changes to the code.
    • Discussions or clarifications can be done within the PR comments section.
    • If significant changes are made, reviewers should re-review the code.
  6. Approval and Merging:

    • Once the code meets the required standards and all feedback has been addressed, the PR can be approved.
    • The approved code should be merged into the main branch.
    • The developer who created the PR is responsible for merging the code.

Coding Standards and Best Practices

  1. Code Formatting:

    • Follow the agreed-upon coding style guide for the project or team.
    • Use consistent indentation, spacing, and naming conventions.
    • Use meaningful and descriptive names for variables, functions, and classes.
  2. Modularity and Reusability:

    • Write modular code with clear separation of concerns.
    • Avoid code duplication by reusing existing functions or components.
    • Aim for small, focused functions or components that are easy to understand and test.
  3. Error Handling and Logging:

    • Implement proper error handling to handle exceptions and edge cases.
    • Log relevant information during runtime to aid in debugging and troubleshooting.
  4. Testing:

    • Write unit tests for critical and complex code sections.
    • Ensure the code passes all existing tests before submitting a PR.
    • Write new tests to cover any new functionality or bug fixes.
  5. Documentation:

    • Document code using appropriate comments and inline documentation.
    • Document any assumptions, limitations, or dependencies.
    • Update or maintain existing documentation as necessary.
  6. Performance:

    • Optimize code for performance, considering factors such as memory usage and response times.
    • Avoid unnecessary computations or redundant operations.
    • Use appropriate data structures and algorithms for efficient processing.