9 challenges of managing PRs and how to solve them
Tags: devops, programming, computerscience, management
Published: 2022-09-14 15:54:43

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify">Developers have been using Pull Requests to review code on branches before it reaches master for a very long time. However, this workflow is one of the most challenging and time-consuming parts of the software delivery process.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify">Every Pull Request comes with different challenges, which can happen before, during, or after the PR is open. In a previous article, we gave you <a href="https://blog.codacy.com/13-tips-to-make-your-pr-easier-to-review/" target="_blank" rel="noreferrer noopener">13 tips to make your PR easier to review</a>. Today, we’ll cover how you can have a better PR workflow by solving 9 challenges you might face.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":1} -->
<h1 id="h-before-opening-the-pr"><strong>Before opening the PR&nbsp;</strong></h1>
<!-- /wp:heading -->

<!-- wp:heading -->
<h2 id="h-personnel-bottlenecks"><strong>Personnel bottlenecks</strong></h2>
<!-- /wp:heading -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify"><strong>Problem:</strong>&nbsp; To ensure that high-quality code gets merged into production, some teams only allow some developers to merge PRs. This is well-intentioned, but senior developers tend to get overburdened since they are more knowledgeable. Overwork also increases the likelihood of an error occurring during the review process.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify"><strong>Solution:</strong> Include everyone in the code review process. You can use the logic of pair programming in code reviews with senior and junior developers. Everyone will broaden their knowledge of the code base, and the reviews will serve as learning tools where junior developers can improve their skills.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2 id="h-difficulties-in-reaching-consensus"><strong>Difficulties in reaching consensus</strong></h2>
<!-- /wp:heading -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify"><strong>Problem:</strong> Developers sometimes struggle between defending their individual ideas and incorporating contributions different from their vision, either because they don’t agree with the project's direction or the way other developers wrote the code. In those cases, reaching a consensus is challenging.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify"><strong>Solution:</strong> Having a shared vision with a clear roadmap about the project's future direction will help developers reach consensus faster. Plus, you can show developers that different ways of writing code are not inherently wrong. If it doesn’t compromise the quality and understandability of the code and if it’s following the agreed coding standards, it should get accepted.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2 id="h-too-extensive-pull-requests"><strong>Too extensive Pull Requests </strong></h2>
<!-- /wp:heading -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify"><strong>Problem:</strong> The more lines of code you need to check, the higher the chance you’ll overlook something. Plus, developers don’t usually thoroughly review big PRs, because they are time-consuming and easier to get lost. As such, it’s fair to say that the bigger the PR, the poorer the code review will be.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify"><strong>Solution:</strong> Make smaller and self-contained Pull Requests. Because the PRs are small, it’s easier for reviewers to understand the context and reason with the logic, so the review is quicker and more thorough, and the PR is easier to merge, leading to fewer merge conflicts.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":1} -->
<h1 id="h-when-the-pr-is-open"><strong>When the PR is open</strong></h1>
<!-- /wp:heading -->

<!-- wp:heading -->
<h2 id="h-the-code-is-hard-to-understand"><strong>The code is hard to understand</strong></h2>
<!-- /wp:heading -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify"><strong>Problem:</strong> Sometimes, developers write code in a way that makes it difficult to understand. If one developer writes unstructured and hard-to-maintain code that other developers cannot read, this will affect the speed of the code reviews and the overall team’s velocity.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify"><strong>Solution: </strong>Establish <a href="https://blog.codacy.com/coding-standards-what-are-they-and-why-do-you-need-them/" target="_blank" rel="noreferrer noopener">coding standards and guidelines</a> for your code structure and logic. They’ll help your team ship faster and more often since they lead to lower code complexity and more elegant design solutions. Plus, with coding standards, any developer can examine any part of the code, understand it, and change it independently of when and who wrote it.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2 id="h-lack-of-information-and-context-on-prs"><strong>Lack of information and context on PRs</strong></h2>
<!-- /wp:heading -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify"><strong>Problem:</strong> When a reviewer opens a PR, all they have is what the author gave him. When there’s insufficient information on the PR description, the reviewer loses the context of the code, making the code review less effective and more time-consuming.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify"><strong>Solution:</strong> You’ll save everyone time by providing as much context as possible in a relevant and informative PR description. The most helpful descriptions explain the what, how, and why and give additional information that might help the reviewer in the code review process.&nbsp;</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify">💡Check out <strong>tip #6 on </strong><a href="https://blog.codacy.com/13-tips-to-make-your-pr-easier-to-review/" target="_blank" rel="noreferrer noopener"><strong>how to make your PR easier to review</strong></a>.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2 id="h-a-high-volume-of-prs"><strong>A high volume of PRs</strong></h2>
<!-- /wp:heading -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify"><strong>Problem:</strong> When there are many PRs and not enough people to review them promptly, it can lead to triaging and work prioritization problems. Plus, PRs that are not checked for a long time, while others change the project in terms of functionality, will make it harder to merge without conflicts.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify"><strong>Solution:</strong> Set a daily limit on the number of PRs your team can open, and optimize your review workflow. Start by identifying long-running Pull Requests, and check if they still need to be reviewed or if the work doesn’t make sense anymore.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":1} -->
<h1 id="h-after-the-pr-is-open"><strong>After the PR is open</strong></h1>
<!-- /wp:heading -->

<!-- wp:heading -->
<h2 id="h-lack-of-response-from-the-author-of-the-pr"><strong>Lack of response from the author of the PR</strong> </h2>
<!-- /wp:heading -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify"><strong>Problem:</strong> The distributed nature of pull-based development means that a lack of responsiveness on behalf of the PR author hurts the entire code review process, making it slower than it should be.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify"><strong>Solution: </strong>Foster a culture where the PR author is ready to respond to comments once feedback starts appearing. By replying, the authors are helping everyone keep track of the feedback that has been seen and considered.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2 id="h-merge-conflicts"><strong>Merge conflicts</strong></h2>
<!-- /wp:heading -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify"><strong>Problem: </strong>When two developers have made changes to the same set of lines of code, there is a conflict when merging, where the version controller doesn’t know which code to keep and which to discard.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify"><strong>Solution:</strong> You can avoid merge conflicts by improving your team’s communication. Use internal communication and project management tools to keep track of the changes and where in the codebase the developers are making them.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2 id="h-a-lengthy-review-process"><strong>A lengthy review process </strong></h2>
<!-- /wp:heading -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify"><strong>Problem:</strong> A typical PR workflow implies a lengthy series of reviews and tests before you officially deploy the code into production. The process aims to ensure code quality and an alignment between the functionality and the project’s vision.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify"><strong>Solution:</strong> Improve the speed of the PR reviews by committing small and often. Plus, ensure that your team understands the importance of code reviews and that they have enough time to perform them. You can help them to meet your expectations by introducing a standard code review checklist.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":1} -->
<h1 id="h-live-talk-become-a-code-review-master"><strong>[Live Talk] Become a Code Review Master</strong></h1>
<!-- /wp:heading -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify">Would you like to hear an expert dive deeper into code reviews? Join <strong>Codacy CEO Jaime Jorge</strong> in an exclusive talk with <strong>Curtis Einsmann</strong>, creator of the <a href="https://curtiseinsmann.gumroad.com/l/code-review-course" target="_blank" rel="noreferrer noopener">Master the Code Review course</a>. Let's have an open talk and share our questions.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":6532,"sizeSlug":"large","linkDestination":"none","tdCaptionAlign":"https://blog.codacy.com/wp-content/uploads/2022/09/Becoming-a-Code-Review-Master.png"} -->
<figure class="wp-block-image aligncenter size-large td-caption-align-https://blog.codacy.com/wp-content/uploads/2022/09/Becoming-a-Code-Review-Master.png"><img src="https://blog.codacy.com/wp-content/uploads/2022/09/Becoming-a-Code-Review-Master-1024x576.png" alt="Becoming a Code Review Master" class="wp-image-6532"/></figure>
<!-- /wp:image -->

<!-- wp:paragraph {"align":"center"} -->
<p class="has-text-align-center"><strong>Join us in our Talk </strong><strong><em>Become a Code Review Master</em></strong><strong>. See you there!</strong></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"align":"center"} -->
<p class="has-text-align-center"><strong>👉 When: September 20th, 2022, 4 pm UTC / 11 am CDT</strong><br><strong>👉 Where: </strong><a href="https://us02web.zoom.us/webinar/register/9416619526958/WN_TcLTok1jTamydt426Kklsg" target="_blank" rel="noreferrer noopener"><strong>online</strong></a> – <em>registration needed</em></p>
<!-- /wp:paragraph -->

<!-- wp:buttons -->
<div class="wp-block-buttons"><!-- wp:button {"textColor":"white","align":"center","className":"is-style-round"} -->
<div class="wp-block-button aligncenter is-style-round"><a class="wp-block-button__link has-white-color has-text-color wp-element-button" href="https://us02web.zoom.us/webinar/register/9416619526958/WN_TcLTok1jTamydt426Kklsg" target="_blank" rel="noreferrer noopener">Save me a seat</a></div>
<!-- /wp:button --></div>
<!-- /wp:buttons -->