Review code
The Space plugin allows you to invite your colleagues to review code and discuss changes directly in RubyMine. With the Space plugin, you can:
Create a code review if you want your colleagues to review specific commits.
Create a merge request if you want your colleagues to review the comparison of two branches.
Review code if you were invited to a code review, or join existing reviews.
Create code reviews
A code review lets your teammates review the changes made in scope of selected commits.
In the Log tab.
tool window, select theRight-click a commit and select search field and filters.
. To narrow down the list of commits, you can use theIn the Code Reviews tool window that opens, enter a meaningful title for your code review and assign reviewers.
Click Create Code Review.
Create merge requests
A merge request is a special type of code review, which lets you compare two branches and invite your colleagues to review it.
From the main menu, select
.In the Code Reviews tool window that opens, click
and select Create Merge Request.
Select the source and target branches. By default, the currently checked out branch is selected as the source branch, and the configured main branch as the target.
Enter a meaningful title and assign reviewers.
Click Create Merge Request.
Review tools
In RubyMine, you can use the Code Reviews tool window to browse available reviews, the Timeline pane to view the history of a review, and the Diff pane to preview changes and post line comments.
Code Reviews tool window
If your code is hosted on Space, the Code Reviews tool window opens automatically. It is also available via the menu or by clicking your profile picture on the right side of the toolbar.
The Code Reviews shows all code reviews of your Space project. The list of code reviews available in Code Reviews depends on the repository that is currently opened in RubyMine. Selecting a code review opens its main page with the following tabs:
Details: shows the author and reviewers. For code reviews, this also shows the branch, which is under review; for merge requests, it shows the source and target branches.
Files: list of files to be reviewed. If a file contains line comments, their count is also displayed here. You can select a file to open the Diff pane.
Commits: select a commit to narrow down the scope of displayed changes. Or right-click a commit and select Show in Git Log to view commit details and history in the Git log.
![Details Details](https://resources.jetbrains.com/help/img/idea/2021.3/space_code_review_details.png)
Timeline pane
The Timeline pane appears in the editor when you open a code review or a merge request. It lists all comments and events related to the review. You can post general comments here.
![Timeline Timeline](https://resources.jetbrains.com/help/img/idea/2021.3/space_code_review_timeline.png)
Diff pane
The Diff pane appears in the editor when you select a file. It is a regular RubyMine Difference viewer, which shows the comparison between the previous and the current version of the file. With the Space plugin, you can use it to post line comments.
Review code
In Space, a typical code review process involves two roles: an author and a reviewer. Both participants can view code, post comments, and reply to them. While reviewing the code, you can post two types of comments:
On the Timeline pane: general comments (or review comments), which are not attached to any file or part of code
On the Diff pane: line comments, which are used to discuss a particular line of code
All comments in RubyMine and in the Space web version are instantly synchronized, so you can continue discussions wherever you like. To format your text, you can use the Markdown syntax.
Find a code review
In the Code Reviews tool window, select a filter from the Quick filters list:
Open: all open reviews in your project.
Needs my review: open code reviews where you are a reviewer, and it's your turn.
Needs my attention: open code reviews where you are the author, and it's your turn.
Includes my changes: all open code reviews where you are the author.
Assigned to me: open and closed reviews in which you participate as a reviewer.
Closed: all closed reviews in your project.
Click a code review to open its details, view commits, and post comments.
Post a general comment
In the Code Reviews tool window, select a review.
In the Timeline pane that opens, enter your comment and press Ctrl+Enter.
Post a line comment
In the Code Reviews tool window, select a review.
In the Files tab, double-click a file that you want to open for comments. You can then use the tab to narrow down the list of changes.
Hover over a line of code and click
.
Enter your comment and press Ctrl+Enter.
Your comment is saved as a draft. To make the comment visible to other participants of the review:
Click Post now if you want to notify the review participants immediately.
Complete your turn in a review if you want to continue the review and send all your comments at once.
Mark files as viewed or not viewed
Files that have not been reviewed yet are marked with a blue dot on the Files tab. If you open the file diff, it is considered as viewed. You can mark files as viewed and not viewed to keep track of what remains to review.
In the Code Reviews tool window, select a review.
Open the Files tab.
Right-click a file and in the context menu click Mark as Viewed or Mark as Not Viewed.
Mention people
In general and line comments, you can mention users of your Space organization to invite them to discussions. They will then receive a message in Space Chats.
While writing a comment, enter @.
Select a user from the list.
Complete your turn in a review
If you are a reviewer in a turn-based review, you are usually supposed to complete your turn by either accepting the changes or requesting additional information from the author. When you complete your turn, your line comments become visible to other participants of the review. For a detailed description of turn-based reviews, refer to Space documentation.
In the Code Reviews tool window, select a review.
On the Details tab, select how you want to complete the review:
Click Wait for Response if you want to come back to this review later; for example, you expect the author to make changes and want to review them.
Click Accept if you accept the changes.
These two buttons also display the count of your line comments that are saved as drafts and are not yet visible to other participants of the review.
![Details Details](https://resources.jetbrains.com/help/img/idea/2021.3/space_complete_review.png)
If you have selected the Wait for Response option, it will now be the author's turn to review your comments and send the review back to you. You can repeat this process until both of you accept the changes.
Currently, closing a review and merging a branch are not supported in RubyMine; you can close reviews and merge branches using the web version of Space.