Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
f644b8c8
Commit
f644b8c8
authored
Apr 28, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve the Code review guidelines documentation
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
0374e22a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
23 deletions
+39
-23
CONTRIBUTING.md
CONTRIBUTING.md
+0
-18
doc/development/code_review.md
doc/development/code_review.md
+39
-5
No files found.
CONTRIBUTING.md
View file @
f644b8c8
...
@@ -485,24 +485,6 @@ Please ensure that your merge request meets the contribution acceptance criteria
...
@@ -485,24 +485,6 @@ Please ensure that your merge request meets the contribution acceptance criteria
When having your code reviewed and when reviewing merge requests please take the
When having your code reviewed and when reviewing merge requests please take the
[
code review guidelines
](
doc/development/code_review.md
)
into account.
[
code review guidelines
](
doc/development/code_review.md
)
into account.
### 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][team]**
.
1.
If your merge request includes only backend changes [^1], it must be
**approved by a [backend maintainer][team]**
.
1.
If your merge request includes only frontend changes [^1], it must be
**approved by a [frontend maintainer][team]**
.
1.
If your merge request includes frontend and backend changes [^1], it must
be
**approved by a [frontend and a backend maintainer][team]**
.
1.
To lower the amount of merge requests maintainers need to review, you can
ask or assign any
[
reviewers
][
team
]
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
][
team
]
.
1.
The reviewer will assign the merge request to a maintainer once the
reviewer is satisfied with the state of the merge request.
### Contribution acceptance criteria
### Contribution acceptance criteria
1.
The change is as small as possible
1.
The change is as small as possible
...
...
doc/development/code_review.md
View file @
f644b8c8
# Code Review Guidelines
# 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][team]**
.
1.
If your merge request includes only backend changes [^1], it must be
**approved by a [backend maintainer][team]**
.
1.
If your merge request includes only frontend changes [^1], it must be
**approved by a [frontend maintainer][team]**
.
1.
If your merge request includes frontend and backend changes [^1], it must
be
**approved by a [frontend and a backend maintainer][team]**
.
1.
To lower the amount of merge requests maintainers need to review, you can
ask or assign any
[
reviewers
][
team
]
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
][
team
]
.
1.
The reviewer will assign the merge request to a maintainer once the
reviewer is satisfied with the state of the merge request.
## Best practices
This guide contains advice and best practices for performing code review, and
This guide contains advice and best practices for performing code review, and
having your code reviewed.
having your code reviewed.
...
@@ -12,7 +32,7 @@ of colleagues and contributors. However, the final decision to accept a merge
...
@@ -12,7 +32,7 @@ of colleagues and contributors. However, the final decision to accept a merge
request is up to one the project's maintainers, denoted on the
request is up to one the project's maintainers, denoted on the
[
team page
](
https://about.gitlab.com/team
)
.
[
team page
](
https://about.gitlab.com/team
)
.
## Everyone
##
#
Everyone
-
Accept that many programming decisions are opinions. Discuss tradeoffs, which
-
Accept that many programming decisions are opinions. Discuss tradeoffs, which
you prefer, and reach a resolution quickly.
you prefer, and reach a resolution quickly.
...
@@ -31,8 +51,11 @@ request is up to one the project's maintainers, denoted on the
...
@@ -31,8 +51,11 @@ request is up to one the project's maintainers, denoted on the
-
Consider one-on-one chats or video calls if there are too many "I didn't
-
Consider one-on-one chats or video calls if there are too many "I didn't
understand" or "Alternative solution:" comments. Post a follow-up comment
understand" or "Alternative solution:" comments. Post a follow-up comment
summarizing one-on-one discussion.
summarizing one-on-one discussion.
-
If you ask a question to a specific person, always start the comment by
mentioning them; this will ensure they see it if their notification level is
set to "mentioned" and other people will understand they don't have to respond.
## Having your code reviewed
##
#
Having your code reviewed
Please keep in mind that code review is a process that can take multiple
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
iterations, and reviewers may spot things later that they may not have seen the
...
@@ -50,11 +73,12 @@ first time.
...
@@ -50,11 +73,12 @@ first time.
-
Extract unrelated changes and refactorings into future merge requests/issues.
-
Extract unrelated changes and refactorings into future merge requests/issues.
-
Seek to understand the reviewer's perspective.
-
Seek to understand the reviewer's perspective.
-
Try to respond to every comment.
-
Try to respond to every comment.
-
Let the reviewer select the "Resolve discussion" buttons.
-
Push commits based on earlier rounds of feedback as isolated commits to the
-
Push commits based on earlier rounds of feedback as isolated commits to the
branch. Do not squash until the branch is ready to merge. Reviewers should be
branch. Do not squash until the branch is ready to merge. Reviewers should be
able to read individual updates based on their earlier feedback.
able to read individual updates based on their earlier feedback.
## Reviewing code
##
#
Reviewing code
Understand why the change is necessary (fixes a bug, improves the user
Understand why the change is necessary (fixes a bug, improves the user
experience, refactors the existing code). Then:
experience, refactors the existing code). Then:
...
@@ -69,12 +93,22 @@ experience, refactors the existing code). Then:
...
@@ -69,12 +93,22 @@ experience, refactors the existing code). Then:
someone else would be confused by it as well.
someone else would be confused by it as well.
-
After a round of line notes, it can be helpful to post a summary note such as
-
After a round of line notes, it can be helpful to post a summary note such as
"LGTM :thumbsup:", or "Just a couple things to address."
"LGTM :thumbsup:", or "Just a couple things to address."
-
Assign the merge request to the author if changes are required following your
review.
-
You should try to resolve merge conflicts yourself, using the
[
merge conflict
resolution
][
conflict-resolution
]
tool.
-
Set the milestone before merging a merge request.
-
Avoid accepting a merge request before the job succeeds. Of course, "Merge
-
Avoid accepting a merge request before the job succeeds. Of course, "Merge
When Pipeline Succeeds" (MWPS) is fine.
When Pipeline Succeeds" (MWPS) is fine.
-
If you set the MR to "Merge When Pipeline Succeeds", you should take over
-
If you set the MR to "Merge When Pipeline Succeeds", you should take over
subsequent revisions for anything that would be spotted after that.
subsequent revisions for anything that would be spotted after that.
-
Consider using the
[
Squash and
merge
][
squash-and-merge
]
feature when the merge request has a lot of commits.
[
conflict-resolution
]:
https://docs.gitlab.com/ce/user/project/merge_requests/resolve_conflicts.html#merge-conflict-resolution
[
squash-and-merge
]:
https://docs.gitlab.com/ee/user/project/merge_requests/squash_and_merge.html#squash-and-merge
## The right balance
##
#
The right balance
One of the most difficult things during code review is finding the right
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
balance in how deep the reviewer can interfere with the code created by a
...
@@ -100,7 +134,7 @@ reviewee.
...
@@ -100,7 +134,7 @@ reviewee.
tomorrow. When you are not able to find the right balance, ask other people
tomorrow. When you are not able to find the right balance, ask other people
about their opinion.
about their opinion.
## Credits
##
#
Credits
Largely based on the [thoughtbot code review guide].
Largely based on the [thoughtbot code review guide].
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment