1. Thunderrise
  2. Blog
  3. GitLab Merge Requests to Do the Code Review
GitLab Merge Requests to Do the Code Review

GitLab Merge Requests to Do the Code Review


Every team of developers wants to do their work more and more efficiently. Reviewing a code can appear to be the great tool for it. It’s extremely crucial because it lets you continue developing with the most accurate analysis. Today we will speak about Gitlab merge request workflow.
GitLab Merge Requests to Do the Code Review

So why code review is so essential? Don’t forget that code is written by a human, so mistakes can be happen. Making mistakes is natural for people but it’s crucial to find and fix them in a proper time.

The other thing is that all programmers have their own level of expertise. It is traditionally divided on three levels: junior, middle and senior. Hiring dev team, you should remember that this classification is a bit conditional. It doesn’t mean that juniors can’t write an excellent code and senior is not always a professional.

On the other hand, mobile development is enough creative process so different programmers can solve problems in different ways. So it can makes some issues when other programmers try to figure out what is actually written.

But how to make the code unificated in the way to be clear for every coder involved in developed? I think you’ve already decided: Git code review tools. Let's figure out how Gitlab merge request can solve coding problems.

Issues without Code Review implementation

So called “personal code”. It’s an advantage for programmer in the case when he or she doesn’t mind to cooperate with other people and writes a code for a personal usage. But working in team requires more accurate coding to make it clear for teammates. Personal code can also make issues for a client because it will take more time (and money) to dispel all uncertainties that hide in lines.

  • Code of bad quality will definitely catch up with you later. Admit it, it’s very annoying to search for problems deep inside the code and then realize that the ton must be rewritten.
  • There could be pieces of code that no one on the planet should understand including the author. As I said below, lack of sleep/energy drinks/inspiration can make influence on result.
  • The extra expenses may occur if there is a need to test one function twicely or triply, so isn’t it easier to make a git code review to avoid such issues?
  • Bad code acts like a snowball, it accumulates itself.
  • It can be a real problem to perform a refactoring after half a year of working on code that has suddenly started to live his own life.

As you can see, a lot of problems may occur if your team of developers avoid code review tools for git. We have discussed issues so now let's have a look at main principles of code audit.
GitLab Merge Requests to Do the Code Review

Pillars of Code Review

  • First and the most essential: code review is an indispensable part of development so avoiding it means incomplete works.
  • Code is sent to the testing only if it has passed the review stage.
  • Review is done after every logical part of code writing, may it be feature, fix, task of improvement.
  • All developers should review their code independently of their expertise.
  • Senior developers should review the junior made code. Juniors could also inspect seniors’ one to obtain experience.

As we have decided the most essential principles, let’s get closer to Gitlab code review performed with git merge request.

Gitlab review system for coding

It means merging the code from one branch to another. There are some merging parameters that are specified when creating:

  • Title
  • Description
  • Source
  • Target
  • Assignee

Now let’s have a look at how code review tools for git are done:

  • Step 1 Click on the merge request button
  • Step 2 You have to fill spaces for source and target branches and click “Compare”
  • Step 3 Now you should fill title, description and assignment fields and submit

Now we can see changes made in source branch in comparison to target branch. So if something’s wrong you can leave comments to any line.

Who should be assigned to do a merge request

The answer depends on how many people are involved in development. If you’re the only one - the choice is little. You can review your own code or ask colleagues. You can also talk to another solo developer and perform cross reviewing. There’s a profit for both of you but this programmer should be at least as experienced as you are. If there are 3+ developers working on one project there are two ways coming on mind: review your own code or assign one programmer who will be responsible for the whole code review.

Implementing a regular code review means:

  • Every member of a team is responsible for the whole project, not just his part
  • Problems in code are detected solved in time
  • Bad code doesn’t accumulate other problems
  • Junior developers are able to learn faster on their own mistakes
  • New programmers approach doesn’t make issues on overall project
  • Effective knowledge sharing
  • The final product has the 100% of quality.

If after reading this article there are questions left, feel free to contact us so we will answer them all.