IDE is the habitual environment where most of us deal with code, be it changing something or exploring the code base. But our daily routines are not limited to coding, we’ve got a number of collaborative activities and tasks to face. Normally we switch to another tool for this kind of work, for instance, we discuss bugs and features in an issue tracker. Basically, we keep code and discussions separate. Code review, however, is a practice where these two things coexist. While in essence, this is a team collaboration practice, dealing with code changes outside of an IDE may feel uncomfortable and even frustrating.
This is why Upsource comes with an IDE plugin that allows you to participate in code reviews and discussions straight from your IDE. Today I’d like to guide you through the plugin features and the code review process performed entirely from your favorite IDE. Let’s get started!
- You need to have Upsource server installed: download here.
- You need to be using one of the JetBrains IDEs: IntelliJ IDEA, PhpStorm, WebStorm, PyCharm, RubyMine, AppCode, CLion.
UPDATE: Rider, Gogland and Android Studio are also supported.
To install the plugin go to Preferences | Plugins, click Install JetBrains plugin and find Upsource Integration plugin.
The only thing you need to do is to let your IDE know where your Upsource server is. Go to Preferences | Tools | Upsource Connection and enter the Server URL.
No need to specify any credentials, Upsource plugin will match projects and commits automatically in most of the cases.
You’re ready to go!
Let’s look around
Upsource plugin adds two important panels to your IDE: News Feed and Reviews.
You can access News Feed from the Switcher (Ctrl + Tab).
News Feed shows you what’s going on in the project you’re working on in real time. By default, it shows only notifications relevant to you, e.g. somebody comments on a code you’ve authored, mentions you, assigns you to review a change, etc. If you want, you can also see all news, or only unread news.
You can reply to comments and resolve discussions straight from the News Feed.
When you need more context, click on the review ID in a notification. It’ll take you to the next Upsource panel called Reviews where you can find all the details about this review.
You can access Reviews from the Switcher (Ctrl + Tab).
By default the Reviews panel shows code reviews that require your attention. You can use the dropdown filter and the search box to access other reviews in the project.
You can also get more information on any particular code review: who is involved, which revisions have been added, what are the changes, the discussions going on, and so on.
Now let’s go over a simple code review scenario to see how you can do it from your IDE.
Asking a teammate to review your changes
You’ve just finished working on a bug fix, and are about to commit your change. At this point you can ask a colleague to review your change right in the Commit dialog.
A code review will be created once the change is pushed to the repository.
When your colleague leaves some comments or updates the review, you’ll instantly receive a notification.
Click the notification to jump to the review. From there you can navigate to the comment either in the editor, or in the side-by-side diff.
If your colleague has pointed out a problem that you need to address, you can add the fix to the review the same way as you’ve started the review – commit the fix and choose the “Attach to review” option.
Reviewing someone else’s change
If somebody assigned you to review a change, you’ll learn about it in real time:
Click the link to navigate to the Reviews view where you’ll find all the required information and actions.
Upsource Integration plugin lets you check out the latest revision to make sure you’re reviewing relevant changes.
You can leave comments in the editor, or right from the diff view.
When you’re done, let the author of the change know that you have finished reviewing the changes by clicking Accept (when everything looks good) or Raise concern (when problems are found, or there are questions to be clarified).
What else you can do with the plugin?
If you have Upsource integration plugin installed, you can easily share links to any piece of code with your teammates. Check out our recent post about this: The Ultimate Way of Sharing Code.
You can leave a comment next to some code without starting a code review; perhaps you have a question and would like the code author to clarify a thing or two for you, or you may have found a problem, or maybe you’ve simply stumbled upon an elegant solution and you’d like to give its author the thumbs up. To do this, select a piece of code (note that it can be any code selection), and choose Upsource | Leave a comment from the context menu. Upsource will even mention the code author:
I hope you’ve enjoyed the post and learned something new!
Upsource Integration plugin works with any JetBrains IDE. Those who use other IDEs can still enjoy performing code review from the Upsource’s web UI and take advantage of the IDE-level code insight and navigation in your favourite browser.