Merge request and review
The pull request (merge request): its life cycle, a good description, automated checks, reading the diff, approval and plain or squashed merging; what to look for when reviewing.
- 25 cards
- 4 topics
- Free
The outline, topic by topic
Each topic is weighted the way the exam weighs it.
- Concepts
- Questions
- Sort and link
- Scenarios
A few cards from the deck
Pull request: what is it?
Show the answer
A proposal to integrate one branch into another, opened on the hosting platform, which brings together the discussion, automated checks and approval.
It is not a feature of Git itself but of the platform (GitHub says pull request, GitLab says merge request): it gets the change reviewed and checked before the shared branch changes.
This Python diff is submitted for review. Once applied, what does connexion do for an unknown login, when trouver returns None?
```diff
@@ -1,5 +1,6 @@
def connexion(login, mot_de_passe):
utilisateur = trouver(login)
- if utilisateur is None:
+ print("debug", login, mot_de_passe)
+ if utilisateur is not None:
return False
- return utilisateur.hash == hacher(mot_de_passe)
+ return utilisateur.mot_de_passe == mot_de_passe`- It prints the password, then raises an AttributeError
- It prints the password, then returns False
- It prints the password, then returns True
- It returns False without printing anything
Show the answer
It prints the password, then raises an AttributeError
The condition is inverted: with None, the function does not return, and utilisateur.mot_de_passe raises an AttributeError, while an existing user always gets False. The reviewer must also flag the print that exposes the password and the plain-text comparison that replaces the hash: security and correctness come before style.
A pull request should have …, with a description that says what changes and ….
Show the answer
A pull request should have a single intent, with a description that says what changes and why.
The diff shows what, never why. Without the reason, the reviewer cannot judge whether the change meets the need.
Code review: what is it?
Show the answer
The examination of a change by someone other than its author, to find defects and share knowledge of the code before it is integrated.
It catches what tests do not see (readability, security, design choices) and spreads knowledge across the team.
A pull request of 1,800 lines has been waiting ten days without a review. What is the most likely cause?
- Reviewers receive no notification at all from the platform
- Automated checks are disabled
- The branch has a name that does not follow the team convention
- It is too big to be reviewed
Show the answer
It is too big to be reviewed
The bigger a diff, the less seriously it is read, and the wait grows. The fix: split into smaller requests, one intent per request, and brief the reviewers with a clear description.