<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Marcelo Sousa</title>
    <description>The latest articles on DEV Community by Marcelo Sousa (@marcelosousa).</description>
    <link>https://dev.to/marcelosousa</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F630835%2F0858a778-47ba-4725-8927-eb92ae66ae8d.jpg</url>
      <title>DEV Community: Marcelo Sousa</title>
      <link>https://dev.to/marcelosousa</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/marcelosousa"/>
    <language>en</language>
    <item>
      <title>Automate pull requests with GitHub Starter Workflows</title>
      <dc:creator>Marcelo Sousa</dc:creator>
      <pubDate>Thu, 27 Oct 2022 21:24:41 +0000</pubDate>
      <link>https://dev.to/marcelosousa/automate-pull-requests-in-1-minute-with-reviewpad-5di5</link>
      <guid>https://dev.to/marcelosousa/automate-pull-requests-in-1-minute-with-reviewpad-5di5</guid>
      <description>&lt;p&gt;&lt;em&gt;This guide shows how you can set up GitHub workflow templates to automate common GitHub pull requests workflows!&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;Every time a new repository is created in our GitHub organization, we need to ensure that it starts with a set of common pull request automations.&lt;/p&gt;

&lt;p&gt;In the past, this meant that we needed to install multiple GitHub actions.&lt;/p&gt;

&lt;p&gt;We were copying the GitHub action YML configurations from other repositories and then customizing it for the newly created repository.&lt;/p&gt;

&lt;p&gt;This process was fine but it is error-prone and not very scalable because we need to maintain and customize multiple GitHub actions. &lt;/p&gt;

&lt;h2&gt;
  
  
  The Solution
&lt;/h2&gt;

&lt;p&gt;Many GitHub repositories already use the &lt;code&gt;.github&lt;/code&gt; folder to host workflows and templates for pull requests. &lt;/p&gt;

&lt;p&gt;GitHub provides the ability to share the files across all the repositories in an organization in the special &lt;code&gt;.github&lt;/code&gt; repository.&lt;/p&gt;

&lt;p&gt;This means that we can create a &lt;code&gt;.github&lt;/code&gt; repository in our organization and then add the GitHub actions that we want to share across all the repositories.&lt;/p&gt;

&lt;p&gt;GitHub calls these &lt;a href="https://docs.github.com/en/actions/using-workflows/creating-starter-workflows-for-your-organization"&gt;starter workflows&lt;/a&gt;.&lt;br&gt;
A starter workflow could be used to easily add workflows to the newly created projects. &lt;/p&gt;

&lt;p&gt;This solves our problem of copying YML configurations between repositories but we need to create one starter workflow for each pull request automation.&lt;/p&gt;

&lt;p&gt;So, we've decided to use &lt;a href="https://reviewpad.com"&gt;Reviewpad&lt;/a&gt; as a single source of truth for all the pull request automations.&lt;/p&gt;

&lt;p&gt;This way, any repository can get these automations with a couple of clicks.&lt;/p&gt;
&lt;h2&gt;
  
  
  The Setup
&lt;/h2&gt;

&lt;p&gt;We will use Reviewpad to show case starter workflows. &lt;/p&gt;

&lt;p&gt;To do that, we will need two steps: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Add the Reviewpad configuration with the specification of the automations&lt;/li&gt;
&lt;li&gt;Add the Reviewpad starter workflow to the &lt;code&gt;.github&lt;/code&gt; repository.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;
  
  
  Step 1. Specify the pull request automations in Reviewpad
&lt;/h3&gt;

&lt;p&gt;We started with the following list of automations and checks:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Label pull requests based on their size&lt;/li&gt;
&lt;li&gt;Check that the pull request commits come after one another (i.e. they have a linear history)&lt;/li&gt;
&lt;li&gt;Check the commits messages against the &lt;a href="https://www.conventionalcommits.org/"&gt;conventional commits specification&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Check the pull request title against the &lt;a href="https://www.conventionalcommits.org/"&gt;conventional commits specification&lt;/a&gt; (this makes sense because we squash and merge certain pull requests)&lt;/li&gt;
&lt;li&gt;Warn pull requests that do not have an associated GitHub issue&lt;/li&gt;
&lt;li&gt;Add a comment to pull requests if their description was empty&lt;/li&gt;
&lt;li&gt;Greet users on their first pull request&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These can be configured in Reviewpad in a few minutes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;api-version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;reviewpad.com/v3.x&lt;/span&gt;

&lt;span class="na"&gt;labels&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;small&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;color&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;#294b69"&lt;/span&gt;
  &lt;span class="na"&gt;medium&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;color&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;#a8c3f7"&lt;/span&gt;
  &lt;span class="na"&gt;large&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;color&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;#8a2138"&lt;/span&gt;

&lt;span class="na"&gt;workflows&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;add-label-with-size&lt;/span&gt;
    &lt;span class="na"&gt;always-run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
    &lt;span class="na"&gt;if&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;$size() &amp;lt;= &lt;/span&gt;&lt;span class="m"&gt;30&lt;/span&gt;
        &lt;span class="na"&gt;extra-actions&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$addLabel("small")'&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;$size() &amp;gt; 30 &amp;amp;&amp;amp; $size() &amp;lt;= &lt;/span&gt;&lt;span class="m"&gt;100&lt;/span&gt;
        &lt;span class="na"&gt;extra-actions&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$addLabel("medium")'&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;$size() &amp;gt; &lt;/span&gt;&lt;span class="m"&gt;100&lt;/span&gt;
        &lt;span class="na"&gt;extra-actions&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$addLabel("large")'&lt;/span&gt;

  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;lint-commits&lt;/span&gt;
    &lt;span class="na"&gt;always-run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
    &lt;span class="na"&gt;if&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;!$hasLinearHistory()'&lt;/span&gt;
        &lt;span class="na"&gt;extra-actions&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$warn($sprintf("The&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;pull&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;request&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;it&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;outdated&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;with&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;the&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;base&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;@%v",&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;$base()))'&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$fail("Pull&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;request&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;is&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;outdated")'&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;true'&lt;/span&gt;
        &lt;span class="na"&gt;extra-actions&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$commitLint()'&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$titleLint()'&lt;/span&gt;

  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;check-for-linked-issued&lt;/span&gt;
    &lt;span class="na"&gt;always-run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
    &lt;span class="na"&gt;if&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;!$hasLinkedIssues()'&lt;/span&gt;
    &lt;span class="na"&gt;then&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$info("This&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;pull&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;request&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;does&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;not&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;have&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;a&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;linked&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;issue")'&lt;/span&gt;

  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;first-time-contributor&lt;/span&gt;
    &lt;span class="na"&gt;always-run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
    &lt;span class="na"&gt;if&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$pullRequestCountBy($author(),&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;"all")&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;==&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;1'&lt;/span&gt;
    &lt;span class="na"&gt;then&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$commentOnce($sprintf("Welcome&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;@%v!&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Thank&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;you&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;so&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;much&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;for&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;your&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;first&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;pull&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;request!",&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;[$author()]))'&lt;/span&gt;

  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;empty-description&lt;/span&gt;
    &lt;span class="na"&gt;always-run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
    &lt;span class="na"&gt;if&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;$description() == ""&lt;/span&gt;
    &lt;span class="na"&gt;then&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$warn("The&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;description&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;is&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;empty.&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Please&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;add&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;more&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;information!")'&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$fail("Empty&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;description")'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add this file to your organization &lt;code&gt;.github&lt;/code&gt; repository so that it can be referenced later in the Reviewpad GitHub action.&lt;/p&gt;

&lt;p&gt;For more information about the Reviewpad configuration, check our &lt;a href="https://docs.reviewpad.com/guides/syntax"&gt;documentation&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2. Add the Reviewpad starter workflow to the &lt;code&gt;.github&lt;/code&gt; repository
&lt;/h3&gt;

&lt;p&gt;The Reviewpad starter workflow is a GitHub action that will run Reviewpad as a GitHub action on every pull request.&lt;/p&gt;

&lt;p&gt;To add a starter workflow, you need to add two files to the &lt;code&gt;.github&lt;/code&gt; repository under the folder &lt;code&gt;workflow-templates&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The first file &lt;a href="https://github.com/reviewpad/.github/blob/main/workflow-templates/reviewpad_action.yml"&gt;reviewpad_action.yml&lt;/a&gt; is the Reviewpad GitHub action that will be installed in the repositories.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Reviewpad&lt;/span&gt;

&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; 
  &lt;span class="na"&gt;pull_request_target&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;types&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;opened&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;synchronize&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;edited&lt;/span&gt;

&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;reviewpad_job&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Reviewpad&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Reviewpad&lt;/span&gt;
        &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;reviewpad/action@v3.x&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="c1"&gt;# Uses a default Reviewpad configuration file to get your started.&lt;/span&gt;
          &lt;span class="c1"&gt;# For customization and documentation, see https://github.com/reviewpad/action&lt;/span&gt;
          &lt;span class="na"&gt;file_url&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;URL-TO-REVIEWPAD-CONFIGURATION&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note that you should update &lt;a href="https://github.com/reviewpad/.github/blob/main/workflow-templates/reviewpad_action.yml#L21"&gt;file_url parameter&lt;/a&gt; to point to your organization configuration file.&lt;/p&gt;

&lt;p&gt;The second file &lt;a href="https://github.com/reviewpad/.github/blob/main/workflow-templates/reviewpad_action.properties.json"&gt;reviewpad_action.properties.json&lt;/a&gt; is the metadata file that specifies the starter workflow.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Reviewpad Starter Workflow"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Reviewpad starter workflow."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"iconName"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"reviewpad-icon"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you want to add the Reviewpad logo to the starter workflow, add the &lt;a href="https://github.com/reviewpad/.github/blob/main/workflow-templates/reviewpad-icon.svg"&gt;icon&lt;/a&gt; to that folder.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Demo
&lt;/h2&gt;

&lt;p&gt;You can check the demo in the original post on Reviewpad's blog &lt;a href="https://reviewpad.com/blog/automate-pull-requests-in-one-minute"&gt;here&lt;/a&gt;!&lt;/p&gt;



&lt;p&gt;If you liked this post, join our community on &lt;a href="https://reviewpad.com/discord"&gt;Discord&lt;/a&gt; to keep learning new ways to save time in pull requests.&lt;/p&gt;

&lt;p&gt;And, if you to get more features out of Reviewpad consider installing the &lt;a href="https://docs.reviewpad.com/getting-started/installation"&gt;GitHub Reviewpad App&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;PS: Support our project on &lt;a href="https://github.com/reviewpad/reviewpad"&gt;GitHub&lt;/a&gt; with a star!&lt;/p&gt;

</description>
      <category>github</category>
      <category>devops</category>
      <category>codereview</category>
      <category>programming</category>
    </item>
    <item>
      <title>Modern Trunk-Based Development</title>
      <dc:creator>Marcelo Sousa</dc:creator>
      <pubDate>Mon, 17 Oct 2022 13:35:43 +0000</pubDate>
      <link>https://dev.to/marcelosousa/modern-trunk-based-development-2lle</link>
      <guid>https://dev.to/marcelosousa/modern-trunk-based-development-2lle</guid>
      <description>&lt;p&gt;&lt;em&gt;For the old guard software developers, trunk-based development is the way to go. For younger developers, used to GitHub pull requests, it is unlikely that they know what trunk-based means. This article shows how we use automation to combine TBD principles with pull requests and get the best of both worlds.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Trunk-based development (TBD) is a software development methodology where the developers continuously merge changes into a single long-lived branch.&lt;/p&gt;

&lt;p&gt;Two benefits of TBD stand out:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;TBD avoids branches which save developers’s time from merge hell situations;&lt;/li&gt;
&lt;li&gt;TBD fosters small atomic commits which are essential to build loosely-coupled systems where a developer has the ability to change one part of the system without impacting the rest.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For engineering leaders, TBD seems a no brainer and &lt;a href="https://www.devops-research.com/research.html" rel="noreferrer noopener"&gt;Google’s State of DevOps Report&lt;/a&gt; has consistently associated TBD with a higher software delivery performance.&lt;/p&gt;

&lt;p&gt;At the core, TBD fosters an high-trust and low-blame cultures which tend to have higher organizational performance.&lt;/p&gt;

&lt;p&gt;However, one of the surprises of the &lt;a rel="noreferrer noopener" href="https://cloud.google.com/blog/products/devops-sre/dora-2022-accelerate-state-of-devops-report-now-out"&gt;2022 State of DevOps Report&lt;/a&gt; is that trunk capabilities had a negative impact on software delivery performance.&lt;/p&gt;

&lt;h3&gt;What changed?&lt;/h3&gt;

&lt;p&gt;According to the report, the number of respondents in the study with 16+ years of experience decrease from 40% to 13%.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Developer experience is a key factor to implement and benefit from TBD practices.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The report mentions that this difference is &lt;em&gt;likely due to the additional practices required to successfully implement Trunk-based development.&lt;/em&gt; These additional practices can be resumed to a robust Continuous Integration (CI) mechanism that ensures that the trunk/main branch is never broken.&lt;/p&gt;

&lt;h3&gt;A different perspective&lt;/h3&gt;

&lt;p&gt;Over the past years, we have also seen a decline of interest in TBD when we interviewed developers with less than 10 years of experience. However, we observed that the main reason is not related with the lack of a robust CI but with the adoption of git-based version control systems like GitHub, GitLab and Bitbucket.&lt;/p&gt;

&lt;p&gt;These version control systems naturally force developers to use feature branches and asynchronous collaboration via pull requests. There are many junior developers that never heard of TBD.&lt;/p&gt;

&lt;p&gt;We also found that teams that rely heavily on feature branches and pull requests typically have strong CI mechanisms to ensure that the pull request merge does not break the long lived branches. In fact, GitHub Actions or GitLab Pipelines simplify the process to quickly get a basic automated CI system up and running.&lt;/p&gt;

&lt;p&gt;Pull requests as a git merge blocking mechanism is necessary in low-trust environments found in open source projects where you have contributions from untrusted parties.&lt;/p&gt;

&lt;p&gt;Teams practicing TBD understand that it doesn’t make sense to generalize this reality to a team of software developers where high-trust, low-blame culture is key.&lt;/p&gt;

&lt;h3&gt;The best of both worlds&lt;/h3&gt;

&lt;p&gt;We see pull requests as a useful mechanism to automate, document and audit three tasks:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Execute a set of automated tasks, e.g. build, tests, code analysis;&lt;/li&gt;
&lt;li&gt;Code review;&lt;/li&gt;
&lt;li&gt;Git merge approval.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We believe the adoption of pull requests will increase in the future for security reasons. For example, a &lt;a rel="noreferrer noopener" href="https://slsa.dev/spec/v0.1/requirements#two-person-reviewed"&gt;two-person reviewed&lt;/a&gt; requirement must be fulfilled for a team to reach level 4 of the &lt;a rel="noreferrer noopener" href="https://slsa.dev"&gt;Supply chain Levels for Software Artifacts&lt;/a&gt; standard.&lt;/p&gt;

&lt;p&gt;We found that teams doing TBD find it hard to adopt pull requests because it creates a lot of friction in their processes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reviewpad started from the observation that not every pull request is the same. &lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This fits nicely for teams updating their TBD practices to use pull requests.&lt;/p&gt;

&lt;p&gt;For example, a pull request that introduces a database migration is very different from a pull request that performs a minor refactoring of the code. In the first case, it makes sense to have a more in-depth code review and testing procedures to ensure the correctness of the migration.&lt;/p&gt;

&lt;p&gt;At the moment, you can enforce pull request workflows to deal with this separation of concerns using the &lt;a rel="noreferrer noopener" href="https://github.com/reviewpad/action"&gt;GitHub Reviewpad Action&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To install it in your repository you just need to add two files:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The GitHub Action YAML file that lives in the &lt;code&gt;.github/workflows&lt;/code&gt; directory.&lt;/li&gt;
&lt;li&gt;The Reviewpad YAML file that specifies the pull request rules and automation workflows. This file is read by the action to understand which actions to perform. By default, the action assumes that this file is called &lt;code&gt;reviewpad.yml&lt;/code&gt; and lives in the root of the repository.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The pull request workflows are specified in YAML. The major advantage with respect to other GitHub Actions is that it comes with a domain specific language (DSL) to quickly access contextual information in the pull request and perform actions.&lt;/p&gt;

&lt;p&gt;Consider the following configuration:&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;workflows&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;label-pull-request-with-size&lt;/span&gt;
    &lt;span class="na"&gt;if&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$size()&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;50'&lt;/span&gt;
        &lt;span class="na"&gt;extra-actions&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$addLabel("small")'&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$size()&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;gt;=&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;50&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;$size()&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;150'&lt;/span&gt;
        &lt;span class="na"&gt;extra-actions&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$addLabel("medium")'&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$size()&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;gt;=&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;150'&lt;/span&gt;
        &lt;span class="na"&gt;extra-actions&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$addLabel("large")'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It specifies a Reviewpad workflow to automatically add a label to the pull request based on the size of changes (measured in the number of lines added and deleted).&lt;/p&gt;

&lt;p&gt;We currently have over &lt;a rel="noreferrer noopener" href="https://docs.reviewpad.com/guides/built-ins"&gt;65 built-ins&lt;/a&gt; that allow you to manage labels, comments, reviews and merge pull requests.&lt;/p&gt;

&lt;h3&gt;Reviewpad’s trunk-based development&lt;/h3&gt;

&lt;p&gt;Based on TBD practices, we use Reviewpad to auto-merge pull requests in our main open-source repository &lt;a rel="noreferrer noopener" href="https://www.github.com/reviewpad/reviewpad"&gt;reviewpad/reviewpad&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For us, the first step was to define which scenarios it makes sense to auto-merge pull requests. &lt;/p&gt;

&lt;p&gt;Since the repository is public, we need to restrict auto-merges to pull requests authored by owners of the project. &lt;/p&gt;

&lt;p&gt;Additionally, to enable this auto-merge feature, the pull requests should be directly flagged by the owners as &lt;code&gt;Ship&lt;/code&gt; pull requests. The only requirement was that this flag mechanism should be automatic when opening the pull request.&lt;/p&gt;

&lt;p&gt;Finally, we established two criteria for auto-merges &lt;code&gt;Ship&lt;/code&gt; pull requests opened by owners:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Changes to Markdown files should be automatically merged; additionally, such pull requests shouldn't waste resources such as running the CI process;&lt;/li&gt;
&lt;li&gt;Other changes should be automatically merged if the CI process is successful.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Regardless of the author of the changes, we also wanted to avoid running the CI process unnecessarily. So, pull requests that only modify Markdown files should not trigger the CI process.&lt;/p&gt;

&lt;h3&gt;The implementation&lt;/h3&gt;

&lt;p&gt;In this section, we show how we get Reviewpad to automate the merges.&lt;/p&gt;

&lt;p&gt;The first step was to find a flexible mechanism for developers to open a pull request and flag them as &lt;code&gt;Ship&lt;/code&gt;. We heavily rely on the &lt;a rel="noreferrer noopener" href="https://cli.github.com/"&gt;GitHub CLI&lt;/a&gt; to open pull requests and we open them as fast as possible. &lt;/p&gt;

&lt;p&gt;So we decided to use pull request templates to allow developers to select which approval/merge mode they want. This is part of our organization &lt;a rel="noreferrer noopener" href="https://raw.githubusercontent.com/reviewpad/.github/main/.github/PULL_REQUEST_TEMPLATE.md"&gt;pull request template&lt;/a&gt;:&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gu"&gt;## Description&lt;/span&gt;

... for the entire file, please follow the link above :)

&lt;span class="gu"&gt;## Code review and merge strategy (ship/show/ask) &lt;/span&gt;
&lt;span class="p"&gt;
-&lt;/span&gt; [ ] Ship: this pull request can be automatically merged and does not require code review
&lt;span class="p"&gt;-&lt;/span&gt; [ ] Show: this pull request can be auto-merged and code review should be done post merge
&lt;span class="p"&gt;-&lt;/span&gt; [ ] Ask: this pull request requires a code review before merge
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the final section of the template, authors of pull request select this mode.&lt;/p&gt;

&lt;p&gt;As soon as the pull request is opened, the developer shouldn't have to do anything else.&lt;/p&gt;

&lt;p&gt;We achieved this with two GitHub Actions:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://github.com/reviewpad/reviewpad/blob/main/.github/workflows/reviewpad.yml"&gt;reviewpad.yml&lt;/a&gt; that runs Reviewpad;&lt;/li&gt;
&lt;li&gt;
&lt;a rel="noreferrer noopener" href="https://github.com/reviewpad/reviewpad/blob/main/.github/workflows/pull_request_build.yml"&gt;pull_request_build.yml&lt;/a&gt; that runs the CI with a job called &lt;code&gt;pr-build&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;As soon as a pull request is created, the Reviewpad action will be triggered and reads the &lt;a rel="noreferrer noopener" href="https://github.com/reviewpad/reviewpad/blob/main/reviewpad.yml"&gt;configuration file&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;We now highlight the relevant sections of the specification.&lt;/p&gt;

&lt;h4&gt;Check for ship pull requests authored by owners&lt;/h4&gt;

&lt;p&gt;The first step is to specify a rule that will be true if the pull request has been selected as &lt;code&gt;Ship&lt;/code&gt; and is authored by an owner.&lt;/p&gt;

&lt;p&gt;We start by defining, with the Reviewpad DSL, the group &lt;code&gt;owners&lt;/code&gt; as the list of GitHub usernames &lt;code&gt;marcelosousa&lt;/code&gt; and &lt;code&gt;ferreiratiago&lt;/code&gt;. &lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;groups&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;owners&lt;/span&gt;
    &lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;["marcelosousa",&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;"ferreiratiago"]'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, we define a rule that checks if the pull request contains in the description the section of the &lt;code&gt;Ship&lt;/code&gt; mode. For this we can use the Reviewpad built-ins &lt;code&gt;$contains&lt;/code&gt; and &lt;code&gt;$description&lt;/code&gt;.&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;rules&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="s"&gt;...&lt;/span&gt;
  &lt;span class="s"&gt;- name&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ship-mode&lt;/span&gt;
    &lt;span class="s"&gt;spec&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$contains($description(),&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;"[x]&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Ship:")'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can use this rule to define the rule &lt;code&gt;ship-authored-by-owners&lt;/code&gt; that checks if the pull request is both authored by an owner and was flagged with &lt;code&gt;Ship&lt;/code&gt;.&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;rules&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="s"&gt;...&lt;/span&gt;
  &lt;span class="s"&gt;- name&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ship-authored-by-owners&lt;/span&gt;
    &lt;span class="s"&gt;spec&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$rule("ship-mode")&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;$isElementOf($author(),&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;$group("owners"))'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;Check for pull requests that only modify Markdown files&lt;/h4&gt;

&lt;p&gt;The first auto-merge criteria is to auto-merge pull requests that only modify Markdown files.&lt;/p&gt;

&lt;p&gt;To do this, we define a rule &lt;code&gt;changes-are-in-markdown&lt;/code&gt; that checks if the files modified only contain &lt;code&gt;.md&lt;/code&gt; extensions.&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;rules&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="s"&gt;...&lt;/span&gt;
  &lt;span class="s"&gt;- name&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt; &lt;span class="s"&gt;changes-are-in-markdown&lt;/span&gt;
    &lt;span class="s"&gt;spec&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$hasFileExtensions([".md"])'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, we define the rule &lt;code&gt;ship-markdown-changes&lt;/code&gt; that chains the previous rules and if true, should trigger the merge action.&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;rules&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="s"&gt;...&lt;/span&gt;
  &lt;span class="s"&gt;- name&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ship-markdown-changes&lt;/span&gt;
    &lt;span class="s"&gt;spec&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$rule("ship-authored-by-owners")&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;$rule("changes-are-in-markdown")'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;Check for pull requests that have successful CI&lt;/h4&gt;

&lt;p&gt;The other criteria for the auto-merge involves the following steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Trigger the CI action if the changes are sensitive;&lt;/li&gt;
&lt;li&gt;Check if the CI action was successful.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For the first step, we conservatively trigger the CI process if the changes involve other file extensions. We define it by simply negating the result of the rule &lt;code&gt;changes-are-in-markdown&lt;/code&gt;.&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;rules&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="s"&gt;...&lt;/span&gt;
  &lt;span class="s"&gt;- name&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt; &lt;span class="s"&gt;changes-should-be-built&lt;/span&gt;
    &lt;span class="s"&gt;spec&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;!$rule("changes-are-in-markdown")'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We then combine this rule to define a Reviewpad workflow that adds a special label &lt;code&gt;run-build&lt;/code&gt;. &lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;workflows&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;add-label-for-build&lt;/span&gt;
    &lt;span class="na"&gt;if&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;changes-should-be-built&lt;/span&gt;
    &lt;span class="na"&gt;then&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$addLabel("run-build")'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The event of adding this label triggers the CI run in &lt;a rel="noreferrer noopener" href="https://github.com/reviewpad/reviewpad/blob/main/.github/workflows/pull_request_build.yml"&gt;pull_request_build.yml&lt;/a&gt; with a job called &lt;code&gt;pr-build&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;We leverage the fact that you can trigger GitHub Actions based on other GitHub Action workflows. This allows us to trigger Reviewpad once the build finishes. &lt;/p&gt;

&lt;p&gt;Reviewpad comes out of the box with built-in functions that allow us to check the result of workflow jobs. So, we defined a rule &lt;code&gt;ci-is-green&lt;/code&gt; that checks if the &lt;code&gt;pr-build&lt;/code&gt; job succeded.&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;rules&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="s"&gt;...&lt;/span&gt;
  &lt;span class="s"&gt;- name&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ci-is-green&lt;/span&gt;
    &lt;span class="s"&gt;spec&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$workflowStatus("pr-build")&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;==&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;"success"'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, we can combine the rules to define the second auto-merge criteria:&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;rules&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="s"&gt;...&lt;/span&gt;
  &lt;span class="s"&gt;- name&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt; &lt;span class="s"&gt;auto-merge-authored-by-owners-with-ship-and-green-ci&lt;/span&gt;
    &lt;span class="s"&gt;spec&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$rule("ship-authored-by-owners")&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;$rule("ci-is-green")'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;Auto-merge pull requests&lt;/h4&gt;

&lt;p&gt;Once we have the rules that define the auto-merge criteria of interest, we just need to use them in a workflow that will trigger the &lt;code&gt;$merge&lt;/code&gt; built-in. This built-in receives the merge method - we decided to use &lt;code&gt;rebase&lt;/code&gt; to preserve the commits in the pull request.&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;workflows&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="s"&gt;...&lt;/span&gt;
  &lt;span class="s"&gt;- name&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt; &lt;span class="s"&gt;auto-merge-owner-pull-requests&lt;/span&gt;
    &lt;span class="s"&gt;if&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;auto-merge-authored-by-owners-with-ship-and-green-ci&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ship-markdown-changes&lt;/span&gt;
    &lt;span class="na"&gt;then&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$merge("rebase")'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;See it in action&lt;/h3&gt;

&lt;p&gt;When an owner opens a &lt;code&gt;Ship&lt;/code&gt; pull request, if the changes are only in Markdown files, the pull request will be automatically merged without wasting the resources to run the CI. &lt;/p&gt;

&lt;p&gt;See the following &lt;a rel="noreferrer noopener" href="https://github.com/reviewpad/reviewpad/pull/388"&gt;pull request&lt;/a&gt; for an example.&lt;/p&gt;

&lt;p&gt;If the changes are in other file extensions, Reviewpad will add the &lt;code&gt;run-build&lt;/code&gt; label and this label will trigger the CI. Once the CI job is completed, the Reviewpad action will run again and now validate the result of the CI.&lt;/p&gt;

&lt;p&gt;This way we can automatically merge pull requests with the guarantee that the CI process was successful. &lt;/p&gt;

&lt;p&gt;See the &lt;a rel="noreferrer noopener" href="https://github.com/reviewpad/reviewpad/pull/390"&gt;pull request&lt;/a&gt; for an example.&lt;/p&gt;

&lt;p&gt;That's it! This is how we ensure that some pull requests are systematically merged without manual code reviews with the guarantee that the CI process is green.&lt;/p&gt;

&lt;p&gt;If you are curious to see the whole process in action, check out our &lt;a href="https://github.com/reviewpad/reviewpad" rel="noreferrer noopener"&gt;GitHub repository&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;PS. Please give us feedback on &lt;a rel="noreferrer noopener" href="http://reviewpad.com/discord"&gt;Discord&lt;/a&gt; and support our project on &lt;a rel="noreferrer noopener" href="https://github.com/reviewpad/action"&gt;GitHub&lt;/a&gt; with a star!&lt;/p&gt;

</description>
      <category>github</category>
      <category>programming</category>
      <category>devops</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Ship / Show / Ask With Reviewpad</title>
      <dc:creator>Marcelo Sousa</dc:creator>
      <pubDate>Fri, 08 Oct 2021 14:36:42 +0000</pubDate>
      <link>https://dev.to/reviewpad/ship-show-ask-with-reviewpad-47jh</link>
      <guid>https://dev.to/reviewpad/ship-show-ask-with-reviewpad-47jh</guid>
      <description>&lt;p&gt;&lt;em&gt;&lt;a href="https://martinfowler.com/articles/ship-show-ask.html" rel="noopener noreferrer"&gt;Ship / Show / Ask&lt;/a&gt; is a methodology to get faster releases with pull requests. With Reviewpad you get a code review platform that allows teams to naturally apply this methodology and extend it to new scenarios that give you greater velocity and team communication by going beyond pull requests.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Pull requests have been widely adopted by software teams as a way to collaborate in codebases. For all their benefits when contributing to open source projects, when it comes to projects where individual contributors have the power to merge their changes, &lt;strong&gt;pull requests slow software development&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pull Requests Are Slowing You Down
&lt;/h2&gt;

&lt;p&gt;The first reason pull requests are slowing you down is that &lt;strong&gt;theyare being used to document developer work&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If you need to open a pull request for every change, regardless of whether it is a new feature or a cosmetic change in a file, inevitably pull requests will be a bottleneck to integrate changes into a product.&lt;/p&gt;

&lt;p&gt;When you associate “pull request” to “unit of dev work” and combine it with automated CI/CD pipelines, you get an overhead of time + resources that doesn’t always make sense in a fast-paced environment.&lt;/p&gt;

&lt;p&gt;The second reason why pull requests are slowing you down is that we have associated code reviews with pull requests to a degree that we now use them interchangeably.&lt;/p&gt;

&lt;p&gt;The truth is that &lt;strong&gt;not all pull requests need code reviews&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;By enforcing processes such as “every pull request must be approved by a team member”, which is not aware of the actual changes, we have created a wait time in the process that is unreasonable in many situations.&lt;/p&gt;

&lt;p&gt;This coupling of code reviews with pull requests has another major pitfall.&lt;/p&gt;

&lt;p&gt;Because reviewing code is hard and the tooling around code reviews in pull requests is quite limited, &lt;strong&gt;it is standard to constraint the number of changes in a pull request&lt;/strong&gt;. This means that changes that should be pushed together have to be broken up to accommodate this process.&lt;/p&gt;

&lt;h2&gt;
  
  
  Ship / Show / Ask
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://martinfowler.com/articles/ship-show-ask.html" rel="noopener noreferrer"&gt;&lt;em&gt;Ship / Show / Ask&lt;/em&gt;&lt;/a&gt; is a methodology to get faster releases by categorising changes into &lt;strong&gt;Ship (merge without pull request)&lt;/strong&gt;, &lt;strong&gt;Show (merge with pull request + later review)&lt;/strong&gt; and &lt;strong&gt;Ask (standard pull request with review approval)&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This methodology is powerful but still relies on the existence of pull requests. This limits you to always having to discuss changes between branches and trigger some automated process even when you just want to ask. It can also happen that you might need to do a later review but the changes were wrongly classified as Ship.&lt;/p&gt;

&lt;p&gt;We think &lt;strong&gt;there’s a better way&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Code Reviews without Pull Requests
&lt;/h2&gt;

&lt;p&gt;Reviewpad decouples code reviews from pull requests so that you fully embrace the idea that &lt;em&gt;&lt;strong&gt;not all pull requests need code reviews&lt;/strong&gt;&lt;/em&gt; and that &lt;em&gt;&lt;strong&gt;code reviews can be done without pull requests&lt;/strong&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Let’s take a look!&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/iNCu085ML64"&gt;
&lt;/iframe&gt;
&lt;/p&gt;
Reviewpad – Creating a Review Between Commits



&lt;p&gt;With Reviewpad it is possible to practice the &lt;em&gt;Ship / Show / Ask&lt;/em&gt; methodology in a more flexible way. In fact, what we have been practicing at Reviewpad is a &lt;em&gt;Ship / Show / Ask / &lt;strong&gt;Revise&lt;/strong&gt;&lt;/em&gt; methodology.&lt;/p&gt;

&lt;h2&gt;
  
  
  Ship
&lt;/h2&gt;

&lt;p&gt;If you want to push a change to the main branch and you have the confidence to do so, you should just do it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb4uggrho49mbz8cgt8do.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb4uggrho49mbz8cgt8do.png" alt="ship"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You shouldn’t have to wait for the CI checks or a review approval on a pull request to do so. Anyway, you typically run some CI pipeline in the main branch so you can always backtrack if something goes terribly wrong. You should have the power and trust to simply push changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Show
&lt;/h2&gt;

&lt;p&gt;A Show process is when you run the CI checks over a branch before the merge, merge and only later get a review.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F645tcr8qg1kv6iqpcdmx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F645tcr8qg1kv6iqpcdmx.png" alt="show"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Although you can do this with a pull request, with Reviewpad there is really no need to do so. You can simply wait for the CI pipeline to finish when you push to a feature branch, merge, and then open a code review between those commits in the main branch. You can choose to open this code review to get later feedback between the branches or in the main branch itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Ask
&lt;/h2&gt;

&lt;p&gt;The Ask process happens when you want feedback on our ongoing work.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Here we pause. We make our changes on a branch, we open a Pull Request, and we wait for feedback before merging. Maybe we’re not sure we’ve taken the right approach.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft3rfomo8l2ckq8cuncgv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft3rfomo8l2ckq8cuncgv.png" alt="ask"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Unfortunately, for many developers, the idea of a pull request is more of a “work done” than a “work in progress”. In fact, mixing the two can be quite confusing because sometimes you just want early feedback on code that you know will not pass the CI checks.&lt;/p&gt;

&lt;p&gt;Reviewpad allows you to create a code review between commits to get that feedback, revise it, close this code review and then open a pull request kicking off the official merge process in a team. &lt;strong&gt;That encourages more collaboration and communication about the code&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;You can use the same code review interface regardless if you what you are reviewing is a pull request or just a diff between two commits.&lt;/p&gt;

&lt;h2&gt;
  
  
  Revise
&lt;/h2&gt;

&lt;p&gt;So what happens if you want to revise some code that went into the main branch? This could be useful in the case of a huge load of pull requests with no time to review them or because you wrongly considered changes to be in “Ship” mode.&lt;/p&gt;

&lt;p&gt;By going beyond the limitation of reviewing code with pull requests you can revise code in a single branch.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkro57gqjoi9kpvu6z3nh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkro57gqjoi9kpvu6z3nh.png" alt="revise"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This allows you to create code reviews that document specific parts of the code, or to keep track of changes when you spend some time away from the project.&lt;/p&gt;

&lt;p&gt;If you find issues in this mode, you can always connect to the code host by creating issues from comments.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/Kw5V6z0juSE"&gt;
&lt;/iframe&gt;
&lt;/p&gt;
Reviewpad – Creating an issue from a comment



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;With Reviewpad, you get a tool that provides the flexibility of new methodologies such as &lt;em&gt;Ship / Show / Ask&lt;/em&gt; and beyond so that you can get the full benefits of code reviews and continuous integration without the limitations of pull requests.&lt;/p&gt;

&lt;p&gt;You can try now at &lt;a href="https://beta.reviewpad.com" rel="noopener noreferrer"&gt;beta.reviewpad.com&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>git</category>
      <category>branching</category>
      <category>codereview</category>
      <category>shipshowask</category>
    </item>
    <item>
      <title>Mitigating Conflicts In Pull Requests</title>
      <dc:creator>Marcelo Sousa</dc:creator>
      <pubDate>Wed, 01 Sep 2021 16:13:13 +0000</pubDate>
      <link>https://dev.to/reviewpad/mitigating-conflicts-in-pull-requests-35g2</link>
      <guid>https://dev.to/reviewpad/mitigating-conflicts-in-pull-requests-35g2</guid>
      <description>&lt;p&gt;&lt;em&gt;One of the most annoying tasks for a developer is to fix git conflicts. You open a pull request, ace the code review process, all checks are passing&lt;/em&gt;, &lt;em&gt;and when you go for that merge button you find out that it is blocked because of git conflicts. Wouldn’t it be nice if you could avoid this situation?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Developers that use a &lt;a href="https://reviewpad.com/blog/github-flow-trunk-based-development-and-code-reviews/" rel="noopener noreferrer"&gt;git flow&lt;/a&gt; branching model rely on 3-way merge tools (like &lt;em&gt;git-merge&lt;/em&gt; or &lt;em&gt;kdiff3&lt;/em&gt;) to automatically merge their changes.&lt;/p&gt;

&lt;p&gt;Unfortunately, these tools are unable to resolve all concurrent changes made to files in the branches involved in the merge. As developers, we experience these &lt;em&gt;unresolved&lt;/em&gt; concurrent changes as &lt;strong&gt;git merge conflicts&lt;/strong&gt;. As the name suggests, the existence of a git merge conflict prevents the merge action.&lt;/p&gt;

&lt;p&gt;The exact definition of a git merge conflict depends on the algorithm used to compute the merge commit. The most widely used algorithms are textual in nature – a conflict in a file means that the branches involved in the merge have both made modifications to the same line in a file. Nowadays, there are much more sophisticated algorithms to compute merge commits than what is offered in GitHub, Gitlab, or Bitbucket. For an overview check out the article &lt;a href="https://dl.acm.org/doi/pdf/10.1145/3276535" rel="noopener noreferrer"&gt;Verified Three-Way Program Merge&lt;/a&gt; – we do plan to incorporate some of them soon into Reviewpad.&lt;/p&gt;

&lt;p&gt;However, a merge is and always will be a sensitive operation. That is, some concurrent changes really do conflict and require human intervention.&lt;/p&gt;

&lt;p&gt;The reality is that git merge conflicts are relatively common in highly collaborative teams.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F49v94pob82mhqoou9lpm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F49v94pob82mhqoou9lpm.png" alt="Guava Board"&gt;&lt;/a&gt;&lt;/p&gt;
There are currently 27 pull requests blocked in the &lt;a href="https://github.com/google/guava/pulls" rel="noreferrer noopener"&gt;google/guava&lt;/a&gt; project because of git conflicts.



&lt;p&gt;While some conflicts are unavoidable, it is possible to create awareness of their future existence so that you can mitigate their effects.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reviewpad’s Concurrent Pull Request Analysis
&lt;/h2&gt;

&lt;p&gt;At Reviewpad, we believe that git conflicts are being discovered at a very late stage in the review process. That is very annoying because sometimes after you have gone through the entire review process you find out that a recently merged PR just introduced git conflicts. Now, you need to restart the entire process.&lt;/p&gt;

&lt;p&gt;So, to reduce this effort we have built into Reviewpad a concurrent pull request analysis that provides information about future git conflicts.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhlbovjiy298vtfbv974i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhlbovjiy298vtfbv974i.png" alt="Open PR"&gt;&lt;/a&gt;&lt;/p&gt;
Information about conflicting changes with ongoing reviews at &lt;a href="https://github.com/google" rel="noreferrer noopener"&gt;google&lt;/a&gt; / &lt;a href="https://github.com/google/guava" rel="noreferrer noopener"&gt;guava&lt;/a&gt; – &lt;a rel="noreferrer noopener" href="https://github.com/google/guava/pull/5654"&gt;&lt;/a&gt;&lt;a rel="noreferrer noopener" href="https://github.com/google/guava/pull/5654"&gt;#5654&lt;/a&gt; &lt;a rel="noreferrer noopener" href="https://github.com/google/guava/pull/5654"&gt;Remove redundant bit masking&lt;/a&gt;.



&lt;p&gt;The way Reviewpad keeps track of potential future git conflicts is by checking if modified files in a particular pull request are also modified in other open pull requests that share the base branch.&lt;/p&gt;

&lt;p&gt;We have been using this check in two use cases that improve the review process.&lt;/p&gt;

&lt;h3&gt;
  
  
  Improve reviewer selection
&lt;/h3&gt;

&lt;p&gt;Finding the right reviewer can be difficult at times in highly collaborative projects. Who better to review than a developer who is also changing the same parts of the code, or a reviewer of such PR?&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/jNLEL_GFfGY"&gt;
&lt;/iframe&gt;
&lt;/p&gt;
Example of pull request without reviewers that has conflicts with concurrent PRs.



&lt;p&gt;In the video, we can see that there is another open PR that is also changing the &lt;code&gt;ci.yml&lt;/code&gt;. The author of that pull request could be a great candidate to review this pull request. Ideally, both developers could collaborate so that all conflicts could be avoided once one of the PRs is merged.&lt;/p&gt;

&lt;h3&gt;
  
  
  Improve merge strategy
&lt;/h3&gt;

&lt;p&gt;As we mentioned in the beginning of this article, there is nothing more annoying than a pull request that is ready to merge but will be blocked by the merge of another PR. Although we can’t completely avoid this situation, we have integrated this check into &lt;a href="https://reviewpad.com/blog/a-board-to-rule-all-pull-requests/" rel="noopener noreferrer"&gt;Reviewpad’s Release Board&lt;/a&gt; so that it becomes evident.&lt;/p&gt;

&lt;p&gt;In this first version, we have decided to restrict this information to pull requests that are ready to merge. Here’s what a PR card with conflicts in concurrent PRs looks like:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnajtffegw1fa65613d7k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnajtffegw1fa65613d7k.png" alt="Pull Request Card"&gt;&lt;/a&gt;&lt;/p&gt;
Pull request card that is ready to merge and that has conflicts with another PR that is also ready to merge.



&lt;p&gt;In the following video, we go over the simple flow of approving a PR, seeing the conflicts in the &lt;strong&gt;Ready to Merge&lt;/strong&gt; column and also the effect of merging this PR which moves the conflicting PR back to the &lt;strong&gt;Git conflicts&lt;/strong&gt; column.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/6Z22wHxW7_M"&gt;
&lt;/iframe&gt;
&lt;/p&gt;
Integration of concurrent PR check with Review Board in the &lt;strong&gt;Ready to Merge&lt;/strong&gt; column.






&lt;h2&gt;
  
  
  Cool. How do I check this out by myself?
&lt;/h2&gt;

&lt;p&gt;We have a public beta version of Reviewpad available at &lt;a href="https://reviewpad.com/get-started/" rel="noopener noreferrer"&gt;reviewpad.com/get-started&lt;/a&gt;. You will need to create a new account and once you log in for the first time, you will see the following page to connect to a code host:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fct76he1fpvv6awocl191.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fct76he1fpvv6awocl191.png" alt="Connect to code host page"&gt;&lt;/a&gt;&lt;/p&gt;
Connect to code host page on Reviewpad.



&lt;p&gt;You can connect to GitHub through our OAuth app or manually &lt;a href="https://docs.reviewpad.com/github" rel="noopener noreferrer"&gt;add a personal access token&lt;/a&gt;. The OAuth requires minimal scopes to be able to read and comment on public repositories.&lt;/p&gt;

&lt;p&gt;And voilà – you are ready to get started with Reviewpad!&lt;/p&gt;

&lt;p&gt;We are just getting started with incorporating features that improve the merge experience in pull requests. Feel free to reach us on our &lt;a href="https://reviewpad.com/slack" rel="noopener noreferrer"&gt;community Slack&lt;/a&gt; with requests!&lt;/p&gt;

</description>
      <category>git</category>
      <category>pullrequest</category>
      <category>conflict</category>
    </item>
    <item>
      <title>When You Merge Pull Requests You Lose Knowledge</title>
      <dc:creator>Marcelo Sousa</dc:creator>
      <pubDate>Tue, 24 Aug 2021 15:33:30 +0000</pubDate>
      <link>https://dev.to/reviewpad/when-you-merge-pull-requests-you-lose-knowledge-194p</link>
      <guid>https://dev.to/reviewpad/when-you-merge-pull-requests-you-lose-knowledge-194p</guid>
      <description>&lt;p&gt;&lt;em&gt;What happens to comments and discussions of a pull request when it is merged? Isn’t that knowledge valuable for the team? Why isn’t it readily accessible to future pull requests?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Pull requests (PRs) are a mainstream way of proposing changes to a codebase. One of the most important features around pull requests is the ability to perform a code review, allowing developers to inspect and comment on the proposed changes.&lt;/p&gt;

&lt;p&gt;Frequently, the knowledge in these comments is invaluable to the team. Reviewers, which are familiar with the codebase and related technologies, will notice bad patterns, suggest optimisations, enforce team guidelines and best practices, etc.&lt;/p&gt;

&lt;p&gt;However, as soon as you merge that pull request on GitHub, Gitlab, or Bitbucket, all this information is &lt;em&gt;lost&lt;/em&gt; into the bag of closed PRs that you will rarely (if ever) inspect.&lt;/p&gt;

&lt;p&gt;We all have had that dé&lt;em&gt;jà vu&lt;/em&gt; feeling when writing a comment in a code review: “Didn’t I write this comment already?” When preparing a PR sometimes we also have that feeling: “I think I’m forgetting something in this line of code.” Or better yet: “Didn’t someone already thought of this before?”&lt;/p&gt;

&lt;p&gt;Let’s look at three scenarios.&lt;/p&gt;

&lt;h4&gt;
  
  
  1. Knowledge useful to a broader audience
&lt;/h4&gt;

&lt;p&gt;Knowledge that could be beneficial to developers not involved in this codebase. For instance, &lt;a href="https://github.com/apache/superset/pull/14710#discussion_r637929403" rel="noopener noreferrer"&gt;this comment&lt;/a&gt; could be useful for other developers modifying similar code.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fat6xrzdnuh1t2h2xu90i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fat6xrzdnuh1t2h2xu90i.png" alt="Discussions useful in the future"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;a href="https://github.com/apache/superset/pull/14710#discussion_r637929403" rel="noopener noreferrer"&gt;Discussion&lt;/a&gt;&lt;em&gt; by &lt;/em&gt;&lt;a href="https://github.com/kgabryje" rel="noopener noreferrer"&gt;kgabryje&lt;/a&gt;&lt;em&gt; at &lt;/em&gt;&lt;a href="https://github.com/apache/superset" rel="noopener noreferrer"&gt;apache / superset&lt;/a&gt;&lt;em&gt; “&lt;/em&gt;&lt;a href="https://github.com/apache/superset/pull/14710" rel="noopener noreferrer"&gt;feat(native-filters): add search all filter options #14710&lt;/a&gt;“



&lt;h4&gt;
  
  
  2. Knowledge about design decisions
&lt;/h4&gt;

&lt;p&gt;Teams with a lot of contributors can suffer from problems associated with the lack of context in design decisions. For instance, when a decision was taken on a discussion on a previous pull request. Consider the following discussion:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6k8ih0g0glzg1tc3ic04.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6k8ih0g0glzg1tc3ic04.png" alt="Useful knowledge about design decisions in discussions"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;a href="https://github.com/dapr/dapr/pull/3297#discussion_r665609722" rel="noopener noreferrer"&gt;Discussion&lt;/a&gt;&lt;em&gt; with &lt;/em&gt;&lt;a href="https://github.com/halspang" rel="noopener noreferrer"&gt;halspang&lt;/a&gt;&lt;em&gt; and &lt;/em&gt;&lt;a href="https://github.com/artursouza" rel="noopener noreferrer"&gt;artursouza&lt;/a&gt;&lt;em&gt; at &lt;/em&gt;&lt;a href="https://github.com/dapr/dapr" rel="noopener noreferrer"&gt;dapr / dapr&lt;/a&gt;&lt;em&gt; “&lt;/em&gt;&lt;a href="https://github.com/dapr/dapr/pull/3297" rel="noopener noreferrer"&gt;Write reminders in multiple partitions #3297&lt;/a&gt;&lt;em&gt;“&lt;/em&gt;



&lt;p&gt;Assuming that this PR is merged, when someone else modifies this code in the future, it would be useful to retrieve this discussion. In this case, that would be particularly relevant if this person starts the support for a decrementing path.&lt;/p&gt;

&lt;h4&gt;
  
  
  3. Review déjà vu
&lt;/h4&gt;

&lt;p&gt;Senior developers that are active reviewers also experience what we call review déjà vus. These are situations where you are repeating similar comments in different PRs, like this one:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flc7wccblup0rzmnal1n8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flc7wccblup0rzmnal1n8.png" alt="Review dejá vù in discussions"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;a href="https://github.com/nim-lang/Nim/pull/16203#discussion_r534435743" rel="noopener noreferrer"&gt;Comment&lt;/a&gt;&lt;em&gt; by &lt;/em&gt;&lt;a href="https://github.com/timotheecour" rel="noopener noreferrer"&gt;timotheecour&lt;/a&gt;&lt;em&gt; at &lt;/em&gt;&lt;a href="https://github.com/nim-lang/Nim" rel="noopener noreferrer"&gt;nim-lang / Nim&lt;/a&gt;&lt;em&gt; “&lt;/em&gt;&lt;a href="https://github.com/nim-lang/Nim/pull/16203" rel="noopener noreferrer"&gt;oids: switch from PRNG to random module #16203&lt;/a&gt;&lt;em&gt;“&lt;/em&gt;





&lt;p&gt;These situations also occur when there are some hidden assumptions that do not make sense to document in the code.&lt;/p&gt;

&lt;p&gt;Wouldn’t it be nice if we could re-use the comments from past reviews into future PRs without having to maintain them?&lt;/p&gt;
&lt;h3&gt;
  
  
  Enter Reviewpad
&lt;/h3&gt;

&lt;p&gt;Reviewpad builds semantic diffs of changes in pull requests and associates metadata such as comments to these semantic objects. This is a big shift from the current behavior of existing code hosts such as Github, Gitlab, and Bitbucket. They associate comments to a line of a file in a particular git diff – as soon as the contents of the line change, this comment is marked as &lt;em&gt;outdated&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;We’ll showcase Reviewpad with the &lt;em&gt;&lt;a href="https://tour.golang.org/concurrency/10" rel="noopener noreferrer"&gt;Web Crawler&lt;/a&gt;&lt;/em&gt; exercise of A Tour of Go using the linked &lt;a href="https://github.com/reviewpad/dejavus" rel="noopener noreferrer"&gt;GitHub repository&lt;/a&gt;. In this exercise of A Tour of Go, we are given a first implementation of a fake web crawler – the exercise is to parallelise it and prevent fetching the same URL twice.&lt;/p&gt;
&lt;h4&gt;
  
  
  Semantic git diffs
&lt;/h4&gt;

&lt;p&gt;As a first step, we used &lt;a href="https://beta.reviewpad.com/review/github.com/reviewpad/dejavus/pull/2" rel="noopener noreferrer"&gt;Reviewpad&lt;/a&gt; to create a pull request with this first implementation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe226jgeda6o3ggq0bpqi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe226jgeda6o3ggq0bpqi.png" alt="Reviewpad screenshot"&gt;&lt;/a&gt;&lt;/p&gt;
Reviewpad interface for &lt;a rel="noreferrer noopener" href="https://beta.reviewpad.com/review/github.com/reviewpad/dejavus/pull/2"&gt;pull request&lt;/a&gt; after review and merge



&lt;p&gt;Reviewpad performs a relational static analysis (in the style of [1] and [2]) over the git diff associated with the pull request to build semantic diffs. These semantic diffs form what we call the &lt;strong&gt;Explore Tree&lt;/strong&gt; in Reviewpad.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo7jzqmaws5rryw9ox9be.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo7jzqmaws5rryw9ox9be.png" alt="Reviewpad symbol tree"&gt;&lt;/a&gt;&lt;/p&gt;
Explore tree for &lt;a href="https://github.com/reviewpad/dejavus/pull/2" rel="noreferrer noopener"&gt;pull request&lt;/a&gt;



&lt;p&gt;An explore tree is an annotated file tree of the modified files. For each modified file, we present an annotated semantic tree of the changes. For example, the file &lt;code&gt;fakeFetcher.go&lt;/code&gt; as presented on &lt;a href="https://github.com/reviewpad/dejavus/pull/2/files#diff-242890664cf40fb88eaec89e6f477a923f63fec6fed10c42bb9e4fa2a95606f6" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; requires an entire scan to understand the main symbols added: 1) the type &lt;code&gt;fakeFetcher&lt;/code&gt;, 2) the struct &lt;code&gt;fakeResult&lt;/code&gt; with two fields &lt;code&gt;body&lt;/code&gt; and &lt;code&gt;urls&lt;/code&gt; and 3) the method &lt;code&gt;Fetch&lt;/code&gt;. Note that the method &lt;code&gt;Fetch&lt;/code&gt; is shown as a child of the type &lt;code&gt;fakeFetcher&lt;/code&gt; as it is the receiver type. At the moment, our analysers focus on types and methods – this is why we don’t show variable &lt;code&gt;fetcher&lt;/code&gt;. The color in the beginning of the symbol indicates the type of modification: green for added, red for deleted and yellow for modified.&lt;/p&gt;

&lt;p&gt;We show the explore tree on the left of the description and general conversation so that developers can quickly match the description and discussions to code changes.&lt;/p&gt;

&lt;p&gt;Each element of the explore tree is clickable to its representation in the git diff. For example, clicking on the &lt;code&gt;fakeFetcher&lt;/code&gt; type directs the user to the &lt;a href="https://beta.reviewpad.com/review/github.com/reviewpad/dejavus/pull/2?base=953653eb93f5a5f57811746e197eb19fd9bc8d74&amp;amp;head=e06496d88c2bb59c3cb17b497ef7caeb3c16594f&amp;amp;review-mode=true#diff-fakeFetcher.goR5" rel="noopener noreferrer"&gt;beginning of the symbol in the diff&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvc8r6icp372563a0zdho.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvc8r6icp372563a0zdho.png" alt="Reviewpad screenshot"&gt;&lt;/a&gt;&lt;/p&gt;
Navigation from the explore tree to the code diff



&lt;p&gt;Note: For those you noticed the coloured icon next to the file &lt;code&gt;go.mod&lt;/code&gt; – this means that the file is automatically hidden from the review mode. Each Reviewpad user can tweak their file view in their review settings to exclude files.&lt;/p&gt;

&lt;p&gt;In this PR, I did a &lt;a href="https://beta.reviewpad.com/review/github.com/reviewpad/dejavus/pull/2?base=953653eb93f5a5f57811746e197eb19fd9bc8d74&amp;amp;head=e06496d88c2bb59c3cb17b497ef7caeb3c16594f#review-d11ab796-13e5-4735-8060-9b45499e0069" rel="noopener noreferrer"&gt;first review&lt;/a&gt; to document parts of the code. For example, while the original code for &lt;code&gt;Crawl&lt;/code&gt; is:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Crawl uses fetcher to recursively crawl
// pages starting with url, to a maximum of depth.
func Crawl(url string, depth int, fetcher Fetcher) {
    // TODO: Fetch URLs in parallel.
    // TODO: Don't fetch the same URL twice.
    // This implementation doesn't do either:
...
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;I chose to &lt;a href="https://beta.reviewpad.com/review/github.com/reviewpad/dejavus/pull/2?base=953653eb93f5a5f57811746e197eb19fd9bc8d74&amp;amp;head=e06496d88c2bb59c3cb17b497ef7caeb3c16594f&amp;amp;review-mode=true#comment-ea03c917-a66f-454d-a3b8-74b7b30e05d1" rel="noopener noreferrer"&gt;comment&lt;/a&gt; on the function as a code diff comment. These review comments are inserted into the knowledge base maintained by Reviewpad:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0zlnkoy7544cyurld5i9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0zlnkoy7544cyurld5i9.png" alt="Reviewpad screenshot"&gt;&lt;/a&gt;&lt;/p&gt;
Diff comment in Crawl function



&lt;p&gt;Note that the comment in the explore tree appears as a child of &lt;code&gt;Crawl&lt;/code&gt; symbol. This means that the comment was made in the definition of the symbol (not just in its signature).&lt;/p&gt;

&lt;h4&gt;
  
  
  Comments from past reviews
&lt;/h4&gt;

&lt;p&gt;After the PR with the initial code was squash and merged, I created a &lt;a href="https://beta.reviewpad.com/review/github.com/reviewpad/dejavus/pull/3" rel="noopener noreferrer"&gt;new PR&lt;/a&gt; with a &lt;a href="https://www.notion.so/6a4979aa7f8b90db6cbc74400d0beb49" rel="noopener noreferrer"&gt;solution&lt;/a&gt; presented by the GitHub user &lt;a href="https://github.com/harryhare" rel="noopener noreferrer"&gt;harryhare&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Figqrf320iogzzf6f8yjx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Figqrf320iogzzf6f8yjx.png" alt="Reviewpad screenshot"&gt;&lt;/a&gt;&lt;/p&gt;
Reviewpad interface for &lt;a rel="noreferrer noopener" href="https://beta.reviewpad.com/review/github.com/reviewpad/dejavus/pull/3"&gt;pull request&lt;/a&gt; with first solution



&lt;p&gt;The explore tree again shows the overview of the solution which involve the introduction of a &lt;code&gt;SafeCounter&lt;/code&gt; struct with a map &lt;code&gt;v&lt;/code&gt; to check if an URL was visited, a mutex &lt;code&gt;mux&lt;/code&gt; and a method &lt;code&gt;checkvisited&lt;/code&gt; that checks if URL was already visited or not.&lt;/p&gt;

&lt;p&gt;The rest of the solution involves changes to the functions &lt;code&gt;Crawl&lt;/code&gt; and &lt;code&gt;main&lt;/code&gt; to fetch URLs in parallel. In the &lt;code&gt;Crawl&lt;/code&gt; method, Reviewpad presents the comment from the past PR that documents the method. This way, developers can retrieve discussions from previous PRs that changed this method.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvzx14m55fyrq9m5njz0a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvzx14m55fyrq9m5njz0a.png" alt="Reviewpad screenshot"&gt;&lt;/a&gt;&lt;/p&gt;
Code diff view with comment from previous pull request



&lt;p&gt;A user review raised an issue with the &lt;code&gt;checkvisited&lt;/code&gt; which is fixed in the commit &lt;code&gt;[fix from review](https://github.com/reviewpad/dejavus/pull/3/commits/a629a38fddad2305a13f2ce07da6a001c263920b)&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;A &lt;a href="https://beta.reviewpad.com/review/github.com/reviewpad/dejavus/pull/3?base=004717a707bb13b9b25cae49cb591c412ae7b8ff&amp;amp;head=a629a38fddad2305a13f2ce07da6a001c263920b#review-cb18ad6e-eb82-47f2-8626-d3dbb7f1e43c" rel="noopener noreferrer"&gt;final review&lt;/a&gt; approves the PR with the request to remove the TODOs in the code.&lt;/p&gt;

&lt;p&gt;In the final &lt;a href="https://beta.reviewpad.com/review/github.com/reviewpad/dejavus/pull/3?base=004717a707bb13b9b25cae49cb591c412ae7b8ff&amp;amp;head=17df68f8195eb427fd84d57fae7dc92663a8efd8&amp;amp;review-mode=true&amp;amp;hide_symbol_comments_history=false#diff-crawler.goR7" rel="noopener noreferrer"&gt;commit&lt;/a&gt; of this PR, we add the reference to the solution as a code comment in the &lt;code&gt;Crawl&lt;/code&gt; method and remove the TODOs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjmn4nqfepcu9brnhdm74.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjmn4nqfepcu9brnhdm74.png" alt="Reviewpad screenshot"&gt;&lt;/a&gt;&lt;/p&gt;
Reviewpad interface for all changes in &lt;a rel="noreferrer noopener" href="https://beta.reviewpad.com/review/github.com/reviewpad/dejavus/pull/3"&gt;pull request&lt;/a&gt;



&lt;p&gt;Hovering on the function &lt;code&gt;Crawl&lt;/code&gt; in the explore tree displays the code documentation associated with this function for readability.&lt;/p&gt;

&lt;h4&gt;
  
  
  Keeping track of comments and changes over time
&lt;/h4&gt;

&lt;p&gt;At this point you might be wondering:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  What happens if the comment was made in a PR that was not the exact previous one?&lt;/li&gt;
&lt;li&gt;  What happens if I start refactoring the code?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To answer these questions, let’s go over the two open PRs in our &lt;a href="https://beta.reviewpad.com/project/github.com/reviewpad/dejavus" rel="noopener noreferrer"&gt;project&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The first is an improvement proposed by another Github user that uses &lt;em&gt;wait groups&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F933mu23pptppv30rjt7g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F933mu23pptppv30rjt7g.png" alt="Reviewpad screenshot"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;a rel="noreferrer noopener" href="https://beta.reviewpad.com/review/github.com/reviewpad/dejavus/pull/4?base=b8faf59d56b2635b94a3a87431b6a654a917f8dd&amp;amp;head=e548593190974aa0327fb2d6b6ec516a6900eb61&amp;amp;review-mode=true"&gt;Pull request&lt;/a&gt; proposing an improvement using wait groups



&lt;p&gt;The comment shown in this pull request was the one made in the first PR. Reviewpad tracks comments regardless of their time difference. For example in the following &lt;a href="https://beta.reviewpad.com/review/github.com/google/error-prone/pull/1817?base=e7a6713dd4775efaece12a2facd2f29d5ba02c25&amp;amp;head=f57bdf7d67fb340abad6f3732f2b8e1cab12ea76&amp;amp;review-mode=true#diff-check_api/src/main/java/com/google/errorprone/fixes/SuggestedFixes.java" rel="noopener noreferrer"&gt;PR&lt;/a&gt; from the google/error-prone project:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8c13p63ke879gwv8o0xp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8c13p63ke879gwv8o0xp.png" alt="Reviewpad screenshot"&gt;&lt;/a&gt;&lt;/p&gt;
Reviewpad review mode for &lt;a rel="noreferrer noopener" href="https://beta.reviewpad.com/review/github.com/google/error-prone/pull/1817?base=e7a6713dd4775efaece12a2facd2f29d5ba02c25&amp;amp;head=f57bdf7d67fb340abad6f3732f2b8e1cab12ea76&amp;amp;review-mode=true#diff-check_api/src/main/java/com/google/errorprone/fixes/SuggestedFixes.java"&gt;pull request&lt;/a&gt; of the google/error-prone project. You can check it on Github &lt;a href="https://github.com/google/error-prone/pull/1817" rel="noopener noreferrer"&gt;here&lt;/a&gt;.



&lt;p&gt;The PR was opened in September 2020 and it is changing class methods that were commented in January 2020.&lt;/p&gt;

&lt;p&gt;The second open &lt;a href="https://beta.reviewpad.com/review/github.com/reviewpad/dejavus/pull/5" rel="noopener noreferrer"&gt;pull request&lt;/a&gt; demonstrates a beta version of our refactoring analyser:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnzsb03bsy9qvawjf46ui.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnzsb03bsy9qvawjf46ui.png" alt="Reviewpad screenshot"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;a href="https://beta.reviewpad.com/review/github.com/reviewpad/dejavus/pull/5" rel="noreferrer noopener"&gt;Pull request&lt;/a&gt; with a refactoring



&lt;p&gt;In this PR, we introduced two commits, the first that changes the signature of the function &lt;code&gt;Crawl&lt;/code&gt; by renaming the variable &lt;code&gt;url&lt;/code&gt; to &lt;code&gt;reqUrl&lt;/code&gt; and the second renames the file.&lt;/p&gt;

&lt;p&gt;Reviewpad understands that it is the same function and presents the comment made in the first PR. Note that we are squash and merging these pull requests – the commit associated with the comment is not an ancestor of the commits in this PR.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cool. How do I check this out by myself?
&lt;/h3&gt;

&lt;p&gt;We have a public beta version of Reviewpad available at &lt;a href="https://reviewpad.com/get-started/" rel="noopener noreferrer"&gt;https://reviewpad.com/get-started/&lt;/a&gt;. You will need to create a new account and once you log in for the first time, you will see the following page to connect to a code host:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnn7yr1j3wungd53tqwr0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnn7yr1j3wungd53tqwr0.png" alt="Reviewpad Screenshot"&gt;&lt;/a&gt;&lt;/p&gt;
Connect to code host page on Reviewpad



&lt;p&gt;You can connect to GitHub through our OAuth app or manually &lt;a href="https://docs.reviewpad.com/github" rel="noopener noreferrer"&gt;add a personal access token&lt;/a&gt;. The OAuth requires minimal scopes to be able to read and comment on public repositories.&lt;/p&gt;

&lt;p&gt;And that’s it – you will be able to give Reviewpad a spin on public repositories! We will be adding more and more public repositories in the upcoming days – feel free to reach us on our &lt;a href="https://reviewpad.com/slack" rel="noopener noreferrer"&gt;community Slack&lt;/a&gt; with requests!&lt;/p&gt;

&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;p&gt;[1]: &lt;a href="https://dl.acm.org/doi/abs/10.1145/2908080.2908092" rel="noopener noreferrer"&gt;Cartesian hoare logic for verifying k-safety properties&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;[2]: &lt;a href="https://www.notion.so/18-Stop-losing-knowledge-when-you-merge-pull-requests-c9696eafba52432ab09f62ac1abce95b" rel="noopener noreferrer"&gt;Verified three-way program merg&lt;/a&gt;&lt;a href="https://dl.acm.org/doi/10.1145/3276535" rel="noopener noreferrer"&gt;e&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>codereview</category>
      <category>pullrequest</category>
      <category>knowledge</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Visualising Changes With Semantic Git Differences</title>
      <dc:creator>Marcelo Sousa</dc:creator>
      <pubDate>Fri, 30 Jul 2021 16:52:12 +0000</pubDate>
      <link>https://dev.to/reviewpad/visualising-changes-with-semantic-git-differences-3omh</link>
      <guid>https://dev.to/reviewpad/visualising-changes-with-semantic-git-differences-3omh</guid>
      <description>&lt;p&gt;&lt;em&gt;Yay – you receive a notification for a code review in a pull request on GitHub. You open the files changed tab on GitHub and there it is: a basic UI showing you nothing more than a git diff. Surely, there is a better way to look at the changes, including comments, and navigate to them, right?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;git diff&lt;/code&gt;&lt;/strong&gt; is a great tool used by millions of developers every day. One of the ways developers consume it is through the UI of GitHub, GitLab, or Bitbucket when you doing a code review.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Unfortunately, what you see is literally what you get out of the git command.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For example, here is what you see on &lt;a href="http://github.com" rel="noopener noreferrer"&gt;GitHub.com&lt;/a&gt; for the following pull request of the &lt;a href="https://github.com/google/guava" rel="noopener noreferrer"&gt;google/guava&lt;/a&gt; project:&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/_5GZSyv_K04"&gt;
&lt;/iframe&gt;
&lt;/p&gt;
Files changes in google/guava – #3304 Unhandled overflow in the concat() method of per-type primitive utility classes



&lt;p&gt;We believe that in 2021, developers deserve better than having to exhaustively check textual diffs and try to reverse engineer the context of the changes.&lt;/p&gt;

&lt;p&gt;So we have incorporated into Reviewpad a special diff operation that captures an overview of the changes at the semantic level:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fonamf2rfai8l2x8f3v8g.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fonamf2rfai8l2x8f3v8g.jpg" alt="Reviewpad’s Explore Tree. Try our beta"&gt;&lt;/a&gt;&lt;/p&gt;
Reviewpad’s Explore Tree. Try our beta at beta.reviewpad.com.



&lt;p&gt;The Explore Tree was designed to immediately answer the following questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  From the list of modified files, which have changes that involve semantic changes and how many changes occurred?&lt;/li&gt;
&lt;li&gt;  Which semantic objects (e.g. methods and classes in Java) were modified and which type of modification (added, removed, or changed)?&lt;/li&gt;
&lt;li&gt;  Which files or symbols contain comments?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Answering these questions has saved us a lot of review time as the tree also acts as an index into the diff, and allows us to navigate directly into it.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/2o0SYdju1yo"&gt;
&lt;/iframe&gt;
&lt;/p&gt;
Interactions with the Explore Tree for Google / Guava – #3304 Unhandled overflow in the concat() method of per-type primitive utility classes. Check it out on beta.reviewpad.com/review/github.com/google/guava/pull/3304.



&lt;p&gt;In order to compute the Explore Tree, Reviewpad performs a semantic diff of two versions of the file, restricted only to the hunks associated with the git diff. From there, the challenge is to understand which symbol (function, method, class, type, etc) is associated with this change. We’ll write more details about the analyser in a future post. 😉&lt;/p&gt;

&lt;h2&gt;
  
  
  Cool. How do I check this out by myself?
&lt;/h2&gt;

&lt;p&gt;We have a public beta version of Reviewpad available at &lt;a href="https://beta.reviewpad.com" rel="noopener noreferrer"&gt;beta.&lt;/a&gt;&lt;a href="https://beta.reviewpad.com" rel="noopener noreferrer"&gt;reviewpad.com&lt;/a&gt;. You will need to create a new account and once you log in for the first time, you will see the following page to connect to a code host:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnq7sortt5dfkk06exgtx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnq7sortt5dfkk06exgtx.png" alt="Connect to code host page on Reviewpad."&gt;&lt;/a&gt;&lt;/p&gt;
Connect to code host page on Reviewpad.



&lt;p&gt;You can connect to GitHub through our OAuth app or manually &lt;a href="https://docs.reviewpad.com/github" rel="noopener noreferrer"&gt;add a personal access token&lt;/a&gt;. The OAuth requires minimal scopes to be able to read and comment on public repositories.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;And voilà – you are ready to get started with Reviewpad!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Our semantic analysis works for more than 10 languages including: C, C++, C#, Go, Haskell, Java, Javascript, Proto, Python, Ruby, Rust, Swift and TypeScript.&lt;/p&gt;

&lt;p&gt;We are adding more and more open source projects in different languages so that you can check it out easily. Feel free to reach us on our &lt;a href="https://reviewpad.com/slack" rel="noopener noreferrer"&gt;community Slack&lt;/a&gt; with requests!&lt;/p&gt;

</description>
      <category>codereview</category>
      <category>github</category>
      <category>gitdiff</category>
      <category>semantic</category>
    </item>
    <item>
      <title>A Board To Rule All Pull Requests</title>
      <dc:creator>Marcelo Sousa</dc:creator>
      <pubDate>Tue, 20 Jul 2021 11:24:25 +0000</pubDate>
      <link>https://dev.to/reviewpad/a-board-to-rule-all-pull-requests-2hie</link>
      <guid>https://dev.to/reviewpad/a-board-to-rule-all-pull-requests-2hie</guid>
      <description>&lt;p&gt;&lt;em&gt;Pull requests are king. Still, even royalty needs to be monitored to optimise certain processes. Project management tools do a good job keeping track of issues and their associated pull request but they are not close enough to the action. We propose a new way of monitoring pull requests to minimise their time to merge.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Pull requests are a widespread tool that developers use to propose changes to git repositories. Yesterday alone (July 15th, 2021), there were almost 120 000 pull requests opened over public repositories on &lt;a href="http://github.com/"&gt;GitHub.com&lt;/a&gt;. With all this activity, it can become hard to understand which open pull requests require attention and what is the appropriate action.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pull requests in large repositories
&lt;/h2&gt;

&lt;p&gt;Whenever a team is managing a large repository, it can become difficult to navigate the sea of open pull requests. The &lt;a href="https://github.com/google/guava/pulls"&gt;google/guava&lt;/a&gt; project, which contains Google core libraries for Java, is an example of such a large repository. Here’s what the open pull request list looks like:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--v6AIG6bv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b5wcs2nis2lps4s3ii0f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--v6AIG6bv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b5wcs2nis2lps4s3ii0f.png" alt="The standard view of open pull requests in Github.com" width="800" height="637"&gt;&lt;/a&gt;&lt;/p&gt;
The standard view of open pull requests in Github.com.
In this case, google/guava pull requests.



&lt;p&gt;Currently, GitHub provides a list of pull requests with filtering capabilities such as labels, review information, and relevant participants. However, with this view, for a particular pull request, it is not clear what is the main blocker and who could unblock it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pull requests in projects across multiple repositories
&lt;/h2&gt;

&lt;p&gt;The second scenario is when a project is distributed over multiple git repositories. If you want to get a sense of what is happening in the pull requests on the entire project, you need to open each individual project pull request listing. As an example, for the &lt;a href="https://apisix.apache.org/"&gt;Apache APISIX&lt;/a&gt; project, which involves 7 git repositories, you would need to open 7 different views individually.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FXoU2HJO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7dn4qwdqha2d5syhytnd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FXoU2HJO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7dn4qwdqha2d5syhytnd.png" alt="Overview of all the pull requests in a project with more than one repository" width="800" height="445"&gt;&lt;/a&gt;Overview of all the pull requests in a project with more than one repository.&lt;br&gt;
In this case, Apache APISIX.&lt;/p&gt;

&lt;p&gt;Not only is this annoying, but it also misses potential dependencies between pull requests from different repositories. Suppose that you have a project composed of two microservices distributed in two different git repositories where one is a library and another is a consumer of this library. It is not uncommon for, within the same release, to have a change that requires changes in both repositories where pull requests are related to each other.&lt;/p&gt;
&lt;h2&gt;
  
  
  A board to rule all pull requests
&lt;/h2&gt;

&lt;p&gt;To help teams structure their reviews and release processes, we have added to Reviewpad a fully automated board of pull requests that is fully integrated with GitHub, GitLab, and Bitbucket. The board represents the lifecycle of pull requests across all projects known to Reviewpad. It allows teams to easily understand and resolve bottlenecks when it comes to pull requests. By the way, by design, it requires zero configuration and it is not configurable for now. We wanted to have a board that emulates the simplest review process that could be used by teams that are starting to do code reviews, and teams that are going back to basics!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lrb42Z23--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ueut0iineg4x2fmolzji.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lrb42Z23--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ueut0iineg4x2fmolzji.png" alt="Pull Requests Board, as seen on Reviewpad Beta" width="800" height="477"&gt;&lt;/a&gt;&lt;/p&gt;
Reviewpad’s **Pull Requests Board**, as seen on Reviewpad Beta at https://beta.reviewpad.com/board



&lt;p&gt;The ultimate goal of this board is to facilitate communication during short meetings, to decrease the overall time to merge. At Reviewpad, we have been using this board for our daily syncs as opposed to a board of issues with the mindset of &lt;a href="https://reviewpad.com/blog/continuous-code-reviews-are-the-way-to-go/"&gt;continuous code reviews&lt;/a&gt;, and it has substantially reduced friction in our releases.&lt;/p&gt;

&lt;p&gt;In this current form, the release board has a pre-determined and fixed set of seven columns, and it should be interpreted as a pipeline. For example, a pull request in the column of &lt;em&gt;Missing approvals&lt;/em&gt; is guaranteed to have git conflicts. Similarly, a pull request that has &lt;em&gt;Failing protection rules&lt;/em&gt; is guaranteed to already have the required approvals for merge.&lt;/p&gt;

&lt;p&gt;Here’s the information on each card:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nNhcIIse--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eujjmo2yg4gvtwfj353h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nNhcIIse--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eujjmo2yg4gvtwfj353h.png" alt="Card for PR google/guava" width="800" height="615"&gt;&lt;/a&gt;Card for PR google/guava #3372 Improve efficiency of bulk removals in transformed lists.&lt;/p&gt;

&lt;p&gt;The information is composed of four sections:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; General information – project, title, author, last updated time and branches involved in the pull request;&lt;/li&gt;
&lt;li&gt; CI checks results;&lt;/li&gt;
&lt;li&gt; Reviewers state;&lt;/li&gt;
&lt;li&gt; Labels.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So far, we have found that with this information we can quickly understand the issue blocking the pull request and the person who can help unblock it.&lt;/p&gt;
&lt;h2&gt;
  
  
  Filter by repository, participant or label
&lt;/h2&gt;

&lt;p&gt;Simplicity is key. The only filters you can apply to the board are to select repositories, participants, or labels. Here’s an example of filtering by the &lt;a href="https://github.com/google/guava"&gt;google/guava&lt;/a&gt; project.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/5OQh30_Xoj8"&gt;
&lt;/iframe&gt;
&lt;/p&gt;
Filtering pull requests



&lt;p&gt;The board becomes particularly useful when you have a project that is distributed in multiple git repositories like the example we showed above.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/LcviKQ1x6LU"&gt;
&lt;/iframe&gt;
&lt;/p&gt;
Filtering pull requests of a project with more than one repository.
In this case, Apache APISIX.



&lt;p&gt;One trick that is particularly powerful with our board is to re-use labels between git repositories, for example for milestones or priorities.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fully automated
&lt;/h2&gt;

&lt;p&gt;A basic requirement we wanted for our board is that it must be fully automated. For instance, if a pull request is in the column for missing approvals gets the required approvals, the card that represents this pull request should automatically advance in the pipeline.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/BYFA6AoFKRc"&gt;
&lt;/iframe&gt;
&lt;/p&gt;
Automation in action.



&lt;p&gt;The automation is not tied to the usage of Reviewpad. In the example above, the card would automatically move forward, to the &lt;em&gt;Ready to merge&lt;/em&gt; column, if the approval was done directly on GitHub.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cool. How do I check this out by myself?
&lt;/h2&gt;

&lt;p&gt;We have a public beta version of Reviewpad available at &lt;a href="https://beta.reviewpad.com"&gt;http&lt;/a&gt;s://beta.reviewpad.com. You will need to create a new account and once you log in for the first time, you will see the following page to connect to a code host:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4PNM4uvq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5t94kbo6urizwljzpua1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4PNM4uvq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5t94kbo6urizwljzpua1.png" alt="Connect to code host page on Reviewpad" width="800" height="530"&gt;&lt;/a&gt;Connect to code host page on Reviewpad&lt;/p&gt;

&lt;p&gt;You can connect to GitHub through our OAuth app or manually &lt;a href="https://docs.reviewpad.com/github"&gt;add a personal access token&lt;/a&gt;. The OAuth requires minimal scopes to be able to read and comment on public repositories.&lt;/p&gt;

&lt;p&gt;And that’s it – you will be able to give Reviewpad and the release board a spin on public repositories! We will be adding more and more public repositories in the upcoming days – feel free to reach us on our &lt;a href="https://reviewpad.com/slack"&gt;community Slack&lt;/a&gt; with requests!&lt;/p&gt;

</description>
      <category>pullrequest</category>
      <category>board</category>
      <category>dashboard</category>
    </item>
    <item>
      <title>Continuous Code Reviews Are The Way To Go</title>
      <dc:creator>Marcelo Sousa</dc:creator>
      <pubDate>Tue, 15 Jun 2021 17:54:55 +0000</pubDate>
      <link>https://dev.to/reviewpad/continuous-code-reviews-are-the-way-to-go-190</link>
      <guid>https://dev.to/reviewpad/continuous-code-reviews-are-the-way-to-go-190</guid>
      <description>&lt;p&gt;&lt;em&gt;One of the major roadblocks for quality code reviews is how their complexity can quickly get overwhelming. The three major factors of this increasing complexity are well-known: the number of changes; the maturity of the codebase; the expertise of the reviewer. Of course, you also have time constraints that amplify this complexity.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;If we don’t figure out techniques and workarounds for these issues, we are hindering the full benefits of code reviews.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;We have made it our mission to tackle this complexity.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  It is all about the process
&lt;/h3&gt;

&lt;p&gt;In a recent &lt;a href="https://lnkd.in/db7nNuA" rel="noopener noreferrer"&gt;Harvard Business Review article&lt;/a&gt;, David De Cremer and Garry Kasparov write about &lt;strong&gt;&lt;em&gt;Augmented Intelligence&lt;/em&gt;&lt;/strong&gt; and how the synergy between artificial intelligence and human intelligence can lead us to new levels of productivity.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Weak human + machine + better process was superior to a strong computer alone and, more remarkably, superior to a strong human + machine + inferior process.&lt;/p&gt;

&lt;p&gt;&lt;cite&gt;Garry Kasparov&lt;/cite&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The key aspect for success is the &lt;strong&gt;process&lt;/strong&gt; by which humans and machines collaborate. This is our philosophy for Reviewpad. So what’s this process for us?&lt;/p&gt;

&lt;h3&gt;
  
  
  Continuous code reviews are the way to go
&lt;/h3&gt;

&lt;p&gt;We are stating this &lt;strong&gt;outright&lt;/strong&gt;. We are very much continuous code review evangelists.&lt;/p&gt;

&lt;p&gt;We believe it is the practice that best allows us to avoid the single greatest hurdle in code reviews, which is its mounting complexity. In this article, we will explain why. We will also explain what we mean, because:&lt;/p&gt;

&lt;h3&gt;
  
  
  Continuous can mean different things
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Context switching incurs a lot of overhead. (…) In a continuous code review you don’t have this problem. Your pair is right there giving you feedback as you go. From little things like variable naming to bigger things like noticing a bug or telling you about an existing class you should use. The code is updated in real time.&lt;/p&gt;

&lt;p&gt;&lt;cite&gt;&lt;a href="https://www.pluralsight.com/tech-blog/continuous-code-reviews/" rel="noopener noreferrer"&gt;Allan Stuart on Continuous Code Reviews&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;His solution implies two developers working on the same code at the same time. One of them actually creating original code, and the other reviewing live.&lt;/p&gt;

&lt;p&gt;This is possibly as close to &lt;em&gt;actually&lt;/em&gt; continuous as you can possibly get, but it’s not the only way to achieve this effect.&lt;/p&gt;

&lt;p&gt;Not every company can assign two developers to the same job at any given time. Also, not every company has a pair like &lt;a href="https://www.newyorker.com/magazine/2018/12/10/the-friendship-that-made-google-huge" rel="noopener noreferrer"&gt;Jeff Dean and Sanjay Ghemawat&lt;/a&gt;. And the truth is, we are still understanding how pair or mob programming is adapting to remote environments.&lt;/p&gt;

&lt;p&gt;Reviewpad is being designed to provide the same sort of &lt;strong&gt;collaborative and continuous mindset&lt;/strong&gt; without this multiplication of effort.&lt;/p&gt;

&lt;p&gt;The analyses it provides address the aspects where people are more error-prone. &lt;strong&gt;It’s a tool that augments human intelligence.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We believe in &lt;strong&gt;breaking things up into tiny parts.&lt;/strong&gt; We also know that you don’t need pull requests to achieve that.&lt;/p&gt;

&lt;h3&gt;
  
  
  Our process: code review centric development
&lt;/h3&gt;

&lt;p&gt;It is a well-known practice in software development to separate work into sprints and do daily syncs. In these daily syncs, you have a &lt;em&gt;squad&lt;/em&gt;, which typically includes developers, designers, and a product owner. Someone puts up a board of issues from Jira (or some other project management tool) and the entire team goes over it.&lt;/p&gt;

&lt;p&gt;This is a problem.&lt;/p&gt;

&lt;p&gt;Miscommunication between the description of a Jira task and the description of a pull request happens all the time.&lt;/p&gt;

&lt;p&gt;We propose an &lt;strong&gt;inversion of control&lt;/strong&gt;. After a written high-level specification is shared with a developer, it is up to them to specify the intent of a particular changeset for development. The product owner must then understand what fraction of the high-level task these changes amount to, and adjust if necessary.&lt;/p&gt;

&lt;p&gt;Why is this preferable? It significantly reduces &lt;strong&gt;specification overhead&lt;/strong&gt; by product owners who do not have (or don’t have the time to acquire) a good understanding of the codebase. It also reduces artificial pressure on development by reducing the guesswork regarding the completion of a task.&lt;/p&gt;

&lt;h3&gt;
  
  
  Reviewing ideas will save you ages
&lt;/h3&gt;

&lt;p&gt;Think of it as architecture. You’re building a castle. When do you bring in someone to check your work? &lt;strong&gt;When the castle’s already built may be a tad too late&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The idea that code reviews should only be about fixing mistakes is misguided. Code reviews should be about creating better, more efficient, code. &lt;strong&gt;If an idea is misguided, or flawed, then it hardly matters whether the code brings it to life perfectly&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Reviewers should be a part of the process from the get-go.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code reviews&lt;/strong&gt; are the central piece of this approach and that’s why we call it &lt;strong&gt;code review centric&lt;/strong&gt; development.&lt;/p&gt;

&lt;h3&gt;
  
  
  How does it work?
&lt;/h3&gt;

&lt;p&gt;As soon as a developer plans to change something in the codebase, the first step is to open a code review stating the intent of the changes and assigning reviewers. This signals to the rest of the team what this person is working on and how we can help them achieve success &lt;strong&gt;continuously&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Some of the benefits we have experienced in the past months are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;reduced miscommunication&lt;/strong&gt;, because we are asking early technical and non-technical questions about the approach;&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;faster development,&lt;/strong&gt; because we are regularly checking changes to see the progress;&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;more shared knowledge&lt;/strong&gt;, because of more frequent and better feedback;&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;fewer integration problems&lt;/strong&gt;, becausewe detect potential future conflicts.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Reviewpad was built to facilitate this type of development. Instead of forcing developers to look at a kanban of issues (which relate to the product owner, but not them), we use a dashboard of code reviews to easily communicate &lt;strong&gt;real&lt;/strong&gt; progress and potential pain points.&lt;/p&gt;

&lt;p&gt;The length of the review is as long as the developer &lt;strong&gt;wants it to be&lt;/strong&gt;, since feedback is given on a continuous basis.&lt;/p&gt;

&lt;p&gt;Instead of forcing developers to switch between contexts a dozen times to complete a code review, you can do reviews that are quicker, more focused, and kinder to your brain. &lt;/p&gt;

&lt;h3&gt;
  
  
  Draft Pull/Merge Requests are an excellent starting point
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fna2fc8m56u0h01fvtnx6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fna2fc8m56u0h01fvtnx6.png" alt="GitHub's draft pull requests"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The adoption of code review-centric development is going to take time. This is why Reviewpad seamlessly integrates with GitHub and GitLab. &lt;/p&gt;

&lt;p&gt;An excellent starting point  to this approach is to use WIP or &lt;a href="https://github.blog/2019-02-14-introducing-draft-pull-requests/" rel="noopener noreferrer"&gt;draft pull requests&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;This feature allows you to create a draft of your pull request before you make any changes at all. And you can immediately assign a reviewer. &lt;strong&gt;Ideally, more than one.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you do this diligently (and we recommend making at least two checkpoints in your draft PR a day), any reviewer who is available will be able to come in whenever they’re notified of changes, and provide you with more feedback. This way, you and your team can start feeling the benefits of continuous, iterative code reviews. &lt;/p&gt;

&lt;p&gt;Reviewpad’s integration of the code host draft pull/merge requests, alongside its sophisticated communications arsenal means that it’s possible and easy to start the review process earlier. In the &lt;strong&gt;brilliant idea&lt;/strong&gt; stage.&lt;/p&gt;

&lt;p&gt;We recommend that developers draft every pull request they do as soon as they think it up. &lt;strong&gt;Before they even touch the code&lt;/strong&gt;. Again: If you clearly signal your code changes before they are even made, a reviewer will not only know what they’re looking for, they’ll be able to comment on your intention as well.&lt;/p&gt;

&lt;h3&gt;
  
  
  Async, yet continuous
&lt;/h3&gt;

&lt;p&gt;If you take this iterative approach and take full advantage of the draft PRs, your reviewer doesn’t need to be working the code at the same time as you. They will be notified as soon as you have your idea, and they will be able to provide feedback on it much earlier.&lt;/p&gt;

&lt;p&gt;Still, you need to help them! They will only be able to understand changes that much &lt;strong&gt;quicker&lt;/strong&gt; if your intent is laid out clearly. If they know what they’re looking at, they will have an &lt;strong&gt;easier&lt;/strong&gt; time spotting mistakes, or code that quite simply doesn’t do what it’s supposed to.&lt;/p&gt;

&lt;p&gt;This back and forth between a developer and a reviewer is the perfect way to go about it. It’s async, yet continuous. We’re working on the right set of features to make this process easy and enjoyable.&lt;/p&gt;

&lt;p&gt;If reviews are done this way, then they will effectively keep up with development. Over time, your codebase will &lt;strong&gt;never build up unreviewed&lt;/strong&gt;, regardless of how mature it is. Conversations between developers and product owners will feel more natural and transparent. In the long-term, your team will have the right mechanisms to re-enforce trust and ownership – and when that happens, you have coding superpowers.&lt;/p&gt;




&lt;p&gt;If you are interested in Reviewpad or hearing more about code review centric development &lt;a href="https://reviewpad.com/slack" rel="noopener noreferrer"&gt;talk with us&lt;/a&gt;!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Context Switching: Why It Hurts Code Reviews And What We Are Doing About It</title>
      <dc:creator>Marcelo Sousa</dc:creator>
      <pubDate>Fri, 11 Jun 2021 13:44:40 +0000</pubDate>
      <link>https://dev.to/reviewpad/context-switching-why-it-hurts-code-reviews-and-what-we-are-doing-about-it-2g0g</link>
      <guid>https://dev.to/reviewpad/context-switching-why-it-hurts-code-reviews-and-what-we-are-doing-about-it-2g0g</guid>
      <description>&lt;p&gt;&lt;em&gt;Context switching, not fear, is&lt;/em&gt;&lt;a href="https://www.youtube.com/watch?v=A54yfyi00dI&amp;amp;t=77s"&gt; &lt;em&gt;the mind-killer&lt;/em&gt;&lt;/a&gt;&lt;em&gt;. One of the main obstacles to quality code reviews is the simple fact that developers have a lot to do. The cost of going back and forth during code reviews and between code reviews and other tasks is standing between us and excellence.&lt;/em&gt;  &lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;But we can help.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  We are letting context switching get in our way
&lt;/h3&gt;

&lt;p&gt;In several ways, actually. There are several types of context switching, and they are all harmful in their own specific manner.&lt;/p&gt;

&lt;p&gt;One of Reviewpad’s main goals is to reduce the amount of context switching you are doing today.&lt;/p&gt;

&lt;p&gt;So, what exactly do we mean by context switching?&lt;/p&gt;

&lt;h3&gt;
  
  
  Our brains don’t excel at multitasking
&lt;/h3&gt;

&lt;p&gt;A bold claim, right? But it’s true. &lt;a href="https://link.springer.com/article/10.1023/A:1022193728205"&gt;Cognitive load theory&lt;/a&gt; is a useful framework to understand how our brain processes information. There’s a &lt;a href="https://www.mindtools.com/pages/article/cognitive-load-theory.htm"&gt;lot&lt;/a&gt; &lt;a href="https://www.sciencedirect.com/topics/psychology/cognitive-load-theory"&gt;of&lt;/a&gt; &lt;a href="https://www.bbc.com/worklife/article/20201103-cognitive-load-theory-explaining-our-fight-for-focus"&gt;science&lt;/a&gt; about this.&lt;/p&gt;

&lt;p&gt;The basic idea is that we store knowledge in the long-term memory of our brains, yet we are only consciously aware of a chunk of this memory. The so-called &lt;strong&gt;working memory&lt;/strong&gt;. In other words, our brains (much in the same way as a computer that has limited RAM) can only store and manipulate a certain amount of information at any given time. If you exceed that amount, you generate errors, stereotyping, or both.&lt;/p&gt;

&lt;p&gt;No two brains are the same. However, according to &lt;a href="https://en.wikipedia.org/wiki/Miller%27s_law"&gt;Miller’s law&lt;/a&gt;, an average human can only concurrently store and manipulate seven different elements in their working memory. This is what we call &lt;strong&gt;cognitive load&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Whether the &lt;a href="https://en.wikipedia.org/wiki/The_Magical_Number_Seven,_Plus_or_Minus_Two"&gt;magic number&lt;/a&gt; is 7, 9 or 4, several studies have suggested that humans are particularly poor at complex reasoning using totally new information in working memory. Still, this memory is fundamental to form knowledge that will be stored in long-term memory.&lt;/p&gt;

&lt;p&gt;According to cognitive load theory, working memory load can be affected by three kinds of cognitive load.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Intrinsic cognitive load&lt;/strong&gt;: How difficult the subject matter actually is. (2+2 is easier to understand than E=mc&lt;sup&gt;2&lt;/sup&gt;).&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Extraneous cognitive load&lt;/strong&gt;: How much the format is helping or hindering you. (It’s easier to read in your native language than your second language).&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Germane cognitive load&lt;/strong&gt;: How efficient you are at structuring your thoughts. (A trained mathematician will learn new math faster than an equally skilled linguist).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What happens when you’re reading a novel and you &lt;strong&gt;stop&lt;/strong&gt; to reply to a tweet? Even if you were paying the utmost attention to what you were reading, you will replace whatever elements were in your working memory. When you get back, you will have to reread a couple of words, maybe a couple of sentences, to find your place. It may take you a couple of minutes to refocus on what you were doing.&lt;/p&gt;

&lt;p&gt;This is pretty much how we’re doing code reviews &lt;strong&gt;at all times&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Context switching hurts all developers
&lt;/h3&gt;

&lt;p&gt;We have &lt;a href="https://www.alleydog.com/glossary/definition.php?term=Context+Dependent+Memory#:~:text=Context%20dependent%20memory%20refers%20to,the%20original%20encoding%20and%20retrieval."&gt;context-dependent memories&lt;/a&gt;. We have, as we mentioned above, limited cognitive loads. Modern work environments aren’t ideal for total focus. Especially in the kind of fast-paced environments that most developers find themselves in. Context switching is constant. Email, Slack, IDE, Jira, Teams, Zoom, meetings, clients. Every time you go from one environment to another, your brain needs to gather context so it can refocus. The effects of this &lt;a href="https://www.linkedin.com/pulse/context-switching-developers-paul-graham/"&gt;are known&lt;/a&gt;, and they’re not ideal.&lt;/p&gt;

&lt;p&gt;Code reviews, in particular, are heavily affected by this.&lt;/p&gt;

&lt;h3&gt;
  
  
  We need to prioritize code reviews in our work
&lt;/h3&gt;

&lt;p&gt;Code reviews often &lt;strong&gt;are&lt;/strong&gt; context switches. If a developer is squeezing code reviews into a busy schedule, then the code review itself will constitute a switch in context.&lt;/p&gt;

&lt;p&gt;So why would we prioritize code reviews?&lt;/p&gt;

&lt;p&gt;Shouldn’t we let code review requests accumulate and then handle them all at once?&lt;/p&gt;

&lt;p&gt;Absolutely &lt;strong&gt;not&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;As I have discussed in &lt;a href="https://reviewpad.com/why-you-need-to-be-doing-code-reviews/"&gt;my previous post&lt;/a&gt;, the complexity of reviews increases exponentially with the number of changes, the maturity of the codebase and the expertise of the reviewer. For a team to move forward with a project with a lot of unreviewed code is &lt;strong&gt;a costly thing to do&lt;/strong&gt;. It will lead to mistakes and bugs that will be costlier to fix with every passing day.&lt;/p&gt;

&lt;p&gt;It goes without saying that for any elements of your team to be stuck waiting for code reviews &lt;strong&gt;isn’t ideal either&lt;/strong&gt;. Even if they do have other tasks they can get to in the meantime, that’s just extra context switches.&lt;/p&gt;

&lt;p&gt;There are solutions for this. Greg Sanford, from Slack, advocates for checking (and resolving) your code review requests &lt;a href="https://medium.com/@9len/on-code-review-16ea85f7c585"&gt;whenever you interrupt work&lt;/a&gt;. Allan Stewart, of Pluralsight, advocates for &lt;a href="https://www.pluralsight.com/tech-blog/continuous-code-reviews/"&gt;continuous code reviews&lt;/a&gt;, with developers working in pairs. We’ll write about how we cope with it in a future post.&lt;/p&gt;

&lt;p&gt;Teams need to find strategies to reduce the amount of &lt;strong&gt;context switching between development and code reviews&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;But that’s not the only kind of context switching.&lt;/p&gt;

&lt;h3&gt;
  
  
  Context switching between tools during review is hell
&lt;/h3&gt;

&lt;p&gt;And that’s where we come in.&lt;/p&gt;

&lt;p&gt;When developers are doing code reviews, they are using &lt;strong&gt;an excessive number of tools&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Slack, or another &lt;strong&gt;messaging app&lt;/strong&gt;, will be there, to get a notification and reach the original author of the code.&lt;/p&gt;

&lt;p&gt;Then you move to a &lt;strong&gt;review interface&lt;/strong&gt; to understand the differences and provide feedback. This typically will be the Web UI of GitHub, GitLab, Bitbucket or some other code host.&lt;/p&gt;

&lt;p&gt;After that, there will be some juggling with a &lt;strong&gt;project management tool&lt;/strong&gt;, such as Jira, to understand the scope of the changes, and with the &lt;strong&gt;IDE&lt;/strong&gt; to understand some parts of the code.&lt;/p&gt;

&lt;p&gt;This is a veritable Babel tower of context switching. Reviewers will be switching between a series of environments to help &lt;strong&gt;understand the code and its scope&lt;/strong&gt;.And then, they will switch between tools to &lt;strong&gt;communicate the review&lt;/strong&gt;. A typical code review requires the developer to switch context endless times and none of these tools was actually designed from the ground-up for the review process. What ends up happening is that you spend a big chunk of your review time context switching. After a while, your brain will be screaming “LGTM”.&lt;/p&gt;

&lt;p&gt;This is detrimental not only to the review itself but to all the other tasks being carried out alongside them. Can you imagine what happens to your short-term memory with that much extraneous cognitive load? It’s not a coincidence that you get a coffee before and after doing a complex review.&lt;/p&gt;

&lt;h3&gt;
  
  
  Here’s how we’re fixing it
&lt;/h3&gt;

&lt;p&gt;I acknowledge that &lt;strong&gt;context switching between tasks&lt;/strong&gt; isn’t something Reviewpad can fix. That’s a question of team culture that companies have to tackle (we hope they will!). But we can help with both the tools used to &lt;strong&gt;understand the code&lt;/strong&gt; and those used to &lt;strong&gt;communicate&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code reviewers shouldn’t be switching between these many tools&lt;/strong&gt;. At Reviewpad, we believe that your browser can replace most of the suite of apps we described above.&lt;/p&gt;

&lt;p&gt;We are integrating the entire review cycle into &lt;strong&gt;one tool&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;First of all, you shouldn’t need an IDE anymore. &lt;strong&gt;IDEs are for coding&lt;/strong&gt; –that’s a different cognitive task than understanding code or suggesting edits in a review. Reviewpad will provide you with the semantic context that you need to understand the code changes and identify functional bugs and security vulnerabilities. You will also be able to review changes easily by iteration (push or commit) to break down complex reviews into manageable chunks. We’re designing Reviewpad while aware of the limits in cognitive load so that you don’t feel overwhelmed with information.&lt;/p&gt;

&lt;p&gt;How about &lt;strong&gt;communication&lt;/strong&gt;?&lt;/p&gt;

&lt;p&gt;Reviewpad provides new ways of giving and receiving feedback during reviews. It achieves this without comments being lost (because you modified a line of code) or having to go into a meeting to understand the overall structure of the changes. Everything is integrated with current code hosts so that you can have a smooth transition process.&lt;/p&gt;

&lt;p&gt;If this looks good to you, you should &lt;a href="https://reviewpad.com/book-a-demo"&gt;book a demo&lt;/a&gt; with us. We would love to show you how much time Reviewpad can save you and your team. &lt;/p&gt;

&lt;p&gt;If you are facing problems with code reviews, please share them with us – we’re here to help.&lt;/p&gt;

</description>
      <category>codereview</category>
      <category>contextswitching</category>
    </item>
    <item>
      <title>The need for simpler code reviews</title>
      <dc:creator>Marcelo Sousa</dc:creator>
      <pubDate>Mon, 24 May 2021 09:03:52 +0000</pubDate>
      <link>https://dev.to/marcelosousa/the-need-for-simpler-code-reviews-4h6g</link>
      <guid>https://dev.to/marcelosousa/the-need-for-simpler-code-reviews-4h6g</guid>
      <description>&lt;p&gt;Code reviews are one of the best ways to ensure code quality. &lt;/p&gt;

&lt;p&gt;A recent survey has found that 36% of the companies that do code reviews think it is the best way to improve code quality. Too often, however, they are understood as an individual task, instead of a team effort.&lt;/p&gt;

&lt;p&gt;Here are five reasons that motivate the need for simpler code reviews.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;We aren’t teaching enough how to do code reviews.&lt;/strong&gt; People are entering the market much faster than they are being promoted. Code reviews, by and large, are not taught at University.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Code reviews are not being prioritised.&lt;/strong&gt; When the code is being developed without an effective integration of the reviewing processes, it often gets done last minute.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Code reviews are not an individual task.&lt;/strong&gt; Most teams assign this responsibility of code reviews to either team leads or senior developers alone. This is unsustainable when there are the ration of junior to senior developers is increasing.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Code reviews need to withstand staffing changes.&lt;/strong&gt; Leads and senior developers leave. Sometimes they’re absent. If they are the ones doing code reviews, in these events we observe huge bottlenecks in code reviews.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;We need the right tools.&lt;/strong&gt; A large number of teams are still doing manual code reviews or using tools that are time consuming and error prone.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you want to read more, check out the full article on &lt;a href="https://reviewpad.com/blog/the-case-for-simpler-code-reviews/"&gt;Reviewpad's blog&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>codereview</category>
      <category>codequality</category>
      <category>programming</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Six best practices to improve your code reviews</title>
      <dc:creator>Marcelo Sousa</dc:creator>
      <pubDate>Thu, 13 May 2021 19:37:02 +0000</pubDate>
      <link>https://dev.to/marcelosousa/six-best-practices-to-improve-your-code-reviews-a01</link>
      <guid>https://dev.to/marcelosousa/six-best-practices-to-improve-your-code-reviews-a01</guid>
      <description>&lt;p&gt;Code reviews are complex. They involve good time management, high emotional intelligence, knowledge of the codebase, and technical expertise. It is a team process where practice and communication are everything. &lt;/p&gt;

&lt;p&gt;Here are six best practices to improve your code reviews:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Review Your Pull Requests Before Others&lt;/li&gt;
&lt;li&gt;Encourage Reviewers To Be Co-Owners&lt;/li&gt;
&lt;li&gt;Leverage Automation&lt;/li&gt;
&lt;li&gt;Always Have A Reviewer In Mind&lt;/li&gt;
&lt;li&gt;Time Your Code Reviews &lt;/li&gt;
&lt;li&gt;Create A Top 10 List Of Pull Requests To Learn From&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you want to read more, check out the full blog &lt;a href="https://reviewpad.com/blog/six-best-practices-to-improve-your-code-reviews/"&gt;post&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>codereview</category>
      <category>codequality</category>
      <category>productivity</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
