GitLab Documentation

Code Review Guidelines

Getting your merge request reviewed, approved, and merged

There are a few rules to get your merge request accepted:

  1. Your merge request should only be merged by a maintainer.
    1. If your merge request includes only backend changes [1], it must be approved by a backend maintainer.
    2. If your merge request includes only frontend changes [1], it must be approved by a frontend maintainer.
    3. If your merge request includes frontend and backend changes [1], it must be approved by a frontend and a backend maintainer.
  2. To lower the amount of merge requests maintainers need to review, you can ask or assign any reviewers for a first review.
    1. If you need some guidance (e.g. it's your first merge request), feel free to ask one of the Merge request coaches.
    2. The reviewer will assign the merge request to a maintainer once the reviewer is satisfied with the state of the merge request.

For more guidance, see CONTRIBUTING.md.

Best practices

This guide contains advice and best practices for performing code review, and having your code reviewed.

All merge requests for GitLab CE and EE, whether written by a GitLab team member or a volunteer contributor, must go through a code review process to ensure the code is effective, understandable, and maintainable.

Any developer can, and is encouraged to, perform code review on merge requests of colleagues and contributors. However, the final decision to accept a merge request is up to one the project's maintainers, denoted on the engineering projects.

Everyone

Having your code reviewed

Please keep in mind that code review is a process that can take multiple iterations, and reviewers may spot things later that they may not have seen the first time.

Reviewing code

Understand why the change is necessary (fixes a bug, improves the user experience, refactors the existing code). Then:

The right balance

One of the most difficult things during code review is finding the right balance in how deep the reviewer can interfere with the code created by a reviewee.

Credits

Largely based on the thoughtbot code review guide.


Return to Development documentation