Code Review Quality: How Developers See It

Total Page:16

File Type:pdf, Size:1020Kb

Code Review Quality: How Developers See It Code Review Quality: How Developers See It Oleksii Kononenko Olga Baysal Michael W. Godfrey School of Computer Science School of Computer Science School of Computer Science University of Waterloo Carleton University University of Waterloo Waterloo, ON, Canada Ottawa, ON, Canada Waterloo, ON, Canada [email protected] [email protected] [email protected] ABSTRACT Due to volume of submitted contributions and the need to In a large, long-lived project, an effective code review pro- handle them in a timely manner, many code review pro- cess is key to ensuring the long-term quality of the code base. cesses have become more lightweight and less formal in na- In this work, we study code review practices of a large, open ture [4, 25]. This evolution of review process increases the source project, and we investigate how the developers them- risks of letting bugs slip into the version control repository, selves perceive code review quality. We present a qualita- as reviewers are unable to detect all of the bugs. In our tive study that summarizes the results from a survey of 88 recent study [18], we explored the topic of code review qual- Mozilla core developers. The results provide developer in- ity by conducting a quantitative investigation of what fac- sights into how they define review quality, what factors con- tors may influence the quality of evaluating code contribu- tribute to how they evaluate submitted code, and what chal- tions. The study was of quantitative nature as it employed lenges they face when performing review tasks. We found data mining and analysis of project's repositories. While we that the review quality is primarily associated with the thor- found that both technical and personal attributes are asso- oughness of the feedback, the reviewer's familiarity with the ciated with the review quality, many other factors such as code, and the perceived quality of the code itself. Also, we organization, its culture and structure, development cycles, found that while different factors are perceived to contribute time pressures, etc., can potentially influence how reviewers to the review quality, reviewers often find it difficult to keep assess code changes. Since these \hidden" factors are diffi- their technical skills up-to-date, manage personal priorities, cult to take into account in a quantitative analysis because and mitigate context switching. such data is not available, easily accessible, or extractable from the available artifacts, we decided to employ qualita- CCS Concepts tive research methods to fill the gap in the knowledge we •Software and its engineering ! Maintaining soft- had about the developer perception and attitude towards ware; Collaboration in software development; the code review quality. Our qualitative study is organized around an exploratory Keywords survey that we design based on the state-of-the-art quali- Code review, review quality, survey, developer perception tative research [8, 12, 28] and our own observations of the Mozilla code review process and interactions with Mozilla 1. INTRODUCTION developers during our previous research project [5]. We In a large, long-lived project, an effective code review pro- conducted an exploratory survey with 88 Mozilla core de- cess is key to ensuring the long-term quality of the code base. velopers. Our qualitative analysis of the survey data aims Code review is considered to be one of the most effective at addressing the following research questions: QA practices in software development. While it is relatively • RQ1: How do Mozilla developers conduct code review? expensive in terms of time and effort, it delivers benefits Existing literature offers several case studies of how of identifying defects in code modifications before they are code review processes are employed by various software committed into the project's code base [9]. Reviewers play development projects and organizations [4,6,11,21,26, a vital role in the code review process not only by shaping 27]. and evaluating individual contributions but also by ensuring • RQ2: What factors do developers consider to be influ- the high quality of the project's master code repository. ential to review time and decision? Code review explicitly addresses the quality of contribu- tions before they are integrated into project's code base. Code review is a complex process that involves people, their skills and social dynamics, as well as development Permission to make digital or hard copies of all or part of this work for personal or artifacts and environments; thus, it can be affected classroom use is granted without fee provided that copies are not made or distributed by both technical [15,21,25,27] and non-technical fac- for profit or commercial advantage and that copies bear this notice and the full cita- tors [7, 12, 19, 29]. tion on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or re- • RQ3: What factors do developers use to assess code publish, to post on servers or to redistribute to lists, requires prior specific permission review quality? and/or a fee. Request permissions from [email protected]. ICSE ’16, May 14-22, 2016, Austin, TX, USA While the quality assessment of code contributions is c 2016 ACM. ISBN 978-1-4503-3900-1/16/05. $15.00 an active research area, the topic of code review qual- DOI: http://dx.doi.org/10.1145/2884781.2884840 ity remains largely unexplored. To better understand developer perception and attitudes towards the quality plored the way stakeholders interact with one another during of the process that evaluates code changes, we further the code review process. Their findings provided insights to refine this research question into the following subques- developers about how to effectively manage large quantities tions: of reviews. Additionally, their investigation reveals that the identification of defects is not the sole motivation for modern { RQ3.1: How do reviewers assess the quality of a code review. Resolving non-technical issues, such as scope or patch? process issues, was among other motivations of code review. { RQ3.2: How do developers define a well-done code Baysal et al. [7] empirically studied the WebKit project review? and showed that review positivity, i.e., the proportion of { RQ3.3: What factors are perceived to contribute accepted patches, is also affected by non-technical factors. to the review quality? The authors found that factors from both personal and orga- • RQ4: What challenges do developers face when per- nizational dimensions affect code review response time and forming review tasks? the outcome of a review. Jiang et al. [15] studied, through We believe that it is important to understand what on- an analysis of the Linux Kernel, the relation between patch going problems developers deal with to provide them characteristics and the probability of patch acceptance as with better tools to support their daily tasks and ac- well as the time taken for patches to be integrated into the tivities. code base. The results of their study indicated that devel- oper experience and patch maturity impact the patch ac- Our main findings reveal that the review quality is pri- ceptance, while the number of suggested reviewers, affected marily associated with the thoroughness of the feedback, the subsystems, developer experience, and the time of submis- reviewer's familiarity with the code, and the perceived qual- sion affect the duration of a review. Bacchelli and Bird [4] ity of the code itself. As expected, we found that different examined the motivations, challenges, and outcomes of tool- factors including technical, personal and social signals, are based code reviews. They found that while the identification perceived to contribute to the review quality. Also, we found of defects is the main purpose of code review, other motiva- that reviewers often find it difficult to keep their technical tions such as team awareness and knowledge sharing exist skills up-to-date, manage personal priorities, and mitigate as well. context switching. Kemerer et al. [16] investigated the effect of review rate The paper makes the following contributions: (i.e., lines of code reviewed per hour) on the effectiveness of • A qualitative study with the professional OSS devel- defect removal and the quality of software products. Their opers who participated in our survey on the topic of study showed that allowing sufficient preparation time for re- code review quality. views and inspections can improve their quality. Hatton [13] • A thorough survey analysis that offers insights into found that defect detection capabilities differ among code re- the developer perception of the code review quality viewers | the \worst" reviewer was ten times less effective and factors affecting it, as well as identifies of the than the best reviewer. Moreover, he found almost 50% im- main challenges developers face when conducting re- provement in defects detection between settings where the view tasks. source code is inspected by two developers together (76% of • A publicly available dataset of 88 anonymized survey faults found) and where the source code is inspected by two responses. developers separately (53% of faults found). The rest of the paper organized as follows. Section 2 sum- Pull-based development is a new model for distributed marizes prior related work. Section 3 describes our method- software development; in this model proposed changes sub- ology including the survey design, participants, and data mitted as pull requests. In a quantitative study, Gousios et analysis. Section 4 presents the results of the qualitative al. [11] explored what factors affect the decision to accept a study. Section 5 discusses implications of our work and sug- pull request, as well as the time needed to make such a deci- gests possible future research directions. Section 6 addresses sion.
Recommended publications
  • Parasoft Dottest REDUCE the RISK of .NET DEVELOPMENT
    Parasoft dotTEST REDUCE THE RISK OF .NET DEVELOPMENT TRY IT https://software.parasoft.com/dottest Complement your existing Visual Studio tools with deep static INCREASE analysis and advanced PROGRAMMING EFFICIENCY: coverage. An automated, non-invasive solution that the related code, and distributed to his or her scans the application codebase to iden- IDE with direct links to the problematic code • Identify runtime bugs without tify issues before they become produc- and a description of how to fix it. executing your software tion problems, Parasoft dotTEST inte- grates into the Parasoft portfolio, helping When you send the results of dotTEST’s stat- • Automate unit and component you achieve compliance in safety-critical ic analysis, coverage, and test traceability testing for instant verification and industries. into Parasoft’s reporting and analytics plat- regression testing form (DTP), they integrate with results from Parasoft dotTEST automates a broad Parasoft Jtest and Parasoft C/C++test, allow- • Automate code analysis for range of software quality practices, in- ing you to test your entire codebase and mit- compliance cluding static code analysis, unit testing, igate risks. code review, and coverage analysis, en- abling organizations to reduce risks and boost efficiency. Tests can be run directly from Visual Stu- dio or as part of an automated process. To promote rapid remediation, each problem detected is prioritized based on configur- able severity assignments, automatical- ly assigned to the developer who wrote It snaps right into Visual Studio as though it were part of the product and it greatly reduces errors by enforcing all your favorite rules. We have stuck to the MS Guidelines and we had to do almost no work at all to have dotTEST automate our code analysis and generate the grunt work part of the unit tests so that we could focus our attention on real test-driven development.
    [Show full text]
  • Parasoft Static Application Security Testing (SAST) for .Net - C/C++ - Java Platform
    Parasoft Static Application Security Testing (SAST) for .Net - C/C++ - Java Platform Parasoft® dotTEST™ /Jtest (for Java) / C/C++test is an integrated Development Testing solution for automating a broad range of testing best practices proven to improve development team productivity and software quality. dotTEST / Java Test / C/C++ Test also seamlessly integrates with Parasoft SOAtest as an option, which enables end-to-end functional and load testing for complex distributed applications and transactions. Capabilities Overview STATIC ANALYSIS ● Broad support for languages and standards: Security | C/C++ | Java | .NET | FDA | Safety-critical ● Static analysis tool industry leader since 1994 ● Simple out-of-the-box integration into your SDLC ● Prevent and expose defects via multiple analysis techniques ● Find and fix issues rapidly, with minimal disruption ● Integrated with Parasoft's suite of development testing capabilities, including unit testing, code coverage analysis, and code review CODE COVERAGE ANALYSIS ● Track coverage during unit test execution and the data merge with coverage captured during functional and manual testing in Parasoft Development Testing Platform to measure true test coverage. ● Integrate with coverage data with static analysis violations, unit testing results, and other testing practices in Parasoft Development Testing Platform for a complete view of the risk associated with your application ● Achieve test traceability to understand the impact of change, focus testing activities based on risk, and meet compliance
    [Show full text]
  • Devnet Module 3
    Module 3: Software Development and Design DEVASCv1 1 Module Objectives . Module Title: Software Development and Design . Module Objective: Use software development and design best practices. It will comprise of the following sections: Topic Title Topic Objective 3.1 Software Development Compare software development methodologies. 3.2 Software Design Patterns Describe the benefits of various software design patterns. 3.3 Version Control Systems Implement software version control using GIT. 3.4 Coding Basics Explain coding best practices. 3.5 Code Review and Testing Use Python Unit Test to evaluate code. 3.6 Understanding Data Formats Use Python to parse different messaging and data formats. DEVASCv1 2 3.1 Software Development DEVASCv1 3 Introduction . The software development process is also known as the software development life cycle (SDLC). SDLC is more than just coding and also includes gathering requirements, creating a proof of concept, testing, and fixing bugs. DEVASCv1 4 Software Development Life Cycle (SDLC) . SDLC is the process of developing software, starting from an idea and ending with delivery. This process consists of six phases. Each phase takes input from the results of the previous phase. SDLC is the process of developing software, starting from an idea and ending with delivery. This process consists of six phases. Each phase takes input from the results of the previous phase. Although the waterfall methods is still widely used today, it's gradually being superseded by more adaptive, flexible methods that produce better software, faster, with less pain. These methods are collectively known as “Agile development.” DEVASCv1 5 Requirements and Analysis Phase . The requirements and analysis phase involves the product owner and qualified team members exploring the stakeholders' current situation, needs and constraints, present infrastructure, and so on, and determining the problem to be solved by the software.
    [Show full text]
  • Metrics for Gerrit Code Reviews
    SPLST'15 Metrics for Gerrit code reviews Samuel Lehtonen and Timo Poranen University of Tampere, School of Information Sciences, Tampere, Finland [email protected],[email protected] Abstract. Code reviews are a widely accepted best practice in mod- ern software development. To enable easier and more agile code reviews, tools like Gerrit have been developed. Gerrit provides a framework for conducting reviews online, with no need for meetings or mailing lists. However, even with the help of tools like Gerrit, following and monitoring the review process becomes increasingly hard, when tens or even hun- dreds of code changes are uploaded daily. To make monitoring the review process easier, we propose a set of metrics to be used with Gerrit code review. The focus is on providing an insight to velocity and quality of code reviews, by measuring different review activities based on data, au- tomatically extracted from Gerrit. When automated, the measurements enable easy monitoring of code reviews, which help in establishing new best practices and improved review process. Keywords: Code quality; Code reviews; Gerrit; Metrics; 1 Introduction Code reviews are a widely used quality assurance practice in software engineer- ing, where developers read and assess each other's code before it is integrated into the codebase or deployed into production. Main motivations for reviews are to detect software defects and to improve code quality while sharing knowledge among developers. Reviews were originally introduced by Fagan [4] already in 1970's. The original, formal type of code inspections are still used in many com- panies, but has been often replaced with more modern types of reviews, where the review is not tied to place or time.
    [Show full text]
  • Best Practices for the Use of Static Code Analysis Within a Real-World Secure Development Lifecycle
    An NCC Group Publication Best Practices for the use of Static Code Analysis within a Real-World Secure Development Lifecycle Prepared by: Jeremy Boone © Copyright 2015 NCC Group Contents 1 Executive Summary ....................................................................................................................................... 3 2 Purpose and Motivation ................................................................................................................................. 3 3 Why SAST Often Fails ................................................................................................................................... 4 4 Methodology .................................................................................................................................................. 4 5 Integration with the Secure Development Lifecycle....................................................................................... 5 5.1 Training ................................................................................................................................................. 6 5.2 Requirements ....................................................................................................................................... 6 5.3 Design ................................................................................................................................................... 7 5.4 Implementation ....................................................................................................................................
    [Show full text]
  • Code Review Guide
    CODE REVIEW GUIDE 2.0 RELEASE Project leaders: Larry Conklin and Gary Robinson Creative Commons (CC) Attribution Free Version at: https://www.owasp.org 1 F I 1 Forward - Eoin Keary Introduction How to use the Code Review Guide 7 8 10 2 Secure Code Review 11 Framework Specific Configuration: Jetty 16 2.1 Why does code have vulnerabilities? 12 Framework Specific Configuration: JBoss AS 17 2.2 What is secure code review? 13 Framework Specific Configuration: Oracle WebLogic 18 2.3 What is the difference between code review and secure code review? 13 Programmatic Configuration: JEE 18 2.4 Determining the scale of a secure source code review? 14 Microsoft IIS 20 2.5 We can’t hack ourselves secure 15 Framework Specific Configuration: Microsoft IIS 40 2.6 Coupling source code review and penetration testing 19 Programmatic Configuration: Microsoft IIS 43 2.7 Implicit advantages of code review to development practices 20 2.8 Technical aspects of secure code review 21 2.9 Code reviews and regulatory compliance 22 5 A1 3 Injection 51 Injection 52 Blind SQL Injection 53 Methodology 25 Parameterized SQL Queries 53 3.1 Factors to Consider when Developing a Code Review Process 25 Safe String Concatenation? 53 3.2 Integrating Code Reviews in the S-SDLC 26 Using Flexible Parameterized Statements 54 3.3 When to Code Review 27 PHP SQL Injection 55 3.4 Security Code Review for Agile and Waterfall Development 28 JAVA SQL Injection 56 3.5 A Risk Based Approach to Code Review 29 .NET Sql Injection 56 3.6 Code Review Preparation 31 Parameter collections 57 3.7 Code Review Discovery and Gathering the Information 32 3.8 Static Code Analysis 35 3.9 Application Threat Modeling 39 4.3.2.
    [Show full text]
  • Nudge: Accelerating Overdue Pull Requests Towards Completion
    Nudge: Accelerating Overdue Pull Requests Towards Completion CHANDRA MADDILA, Microsoft Research SAI SURYA UPADRASTA, Microsoft Research CHETAN BANSAL, Microsoft Research NACHIAPPAN NAGAPPAN, Microsoft Research GEORGIOS GOUSIOS, Delft University of Technology ARIE van DEURSEN, Delft University of Technology Pull requests are a key part of the collaborative software development and code review process today. However, pull requests can also slow down the software development process when the reviewer(s) or the author do not actively engage with the pull request. In this work, we design an end-to-end service, Nudge, for accelerating overdue pull requests towards completion by reminding the author or the reviewer(s) to engage with their overdue pull requests. First, we use models based on effort estimation and machine learning to predict the completion time for a given pull request. Second, we use activity detection to filter out pull requests that may be overdue, but for which sufficient action is taking place nonetheless. Lastly, we use actor identification to understand who the blocker of the pull request is and nudge the appropriate actor (author or reviewer(s)). We also conduct a correlation analysis to understand the statistical relationship between the pull request completion times and various pull request and developer related attributes. Nudge has been deployed on 147 repositories at Microsoft since 2019. We perform a large scale evaluation based on the implicit and explicit feedback we received from sending the Nudge notifications on 8,500 pull requests. We observe significant reduction in completion time, by over 60%, for pull requests which were nudged thus increasing the efficiency of the code review process and accelerating the pull request progression.
    [Show full text]
  • The Impact of Code Review Coverage and Code Review Participation on Software Quality
    The Impact of Code Review Coverage and Code Review Participation on Software Quality A Case Study of the Qt, VTK, and ITK Projects Shane McIntosh1, Yasutaka Kamei2, Bram Adams3, and Ahmed E. Hassan1 1Queen’s University, Canada 2Kyushu University, Japan 3Polytechnique Montréal, Canada 1{mcintosh, ahmed}@cs.queensu.ca [email protected] [email protected] ABSTRACT 1. INTRODUCTION Software code review, i.e., the practice of having third-party Software code reviews are a well-documented best practice team members critique changes to a software system, is a for software projects. In Fagan's seminal work, formal design well-established best practice in both open source and pro- and code inspections with in-person meetings were found prietary software domains. Prior work has shown that the to reduce the number of errors detected during the testing formal code inspections of the past tend to improve the qual- phase in small development teams [8]. Rigby and Bird find ity of software delivered by students and small teams. How- that the modern code review processes that are adopted in a ever, the formal code inspection process mandates strict re- variety of reviewing environments (e.g., mailing lists or the view criteria (e.g., in-person meetings and reviewer check- Gerrit web application1) tend to converge on a lightweight lists) to ensure a base level of review quality, while the mod- variant of the formal code inspections of the past, where ern, lightweight code reviewing process does not. Although the focus has shifted from defect-hunting to group problem- recent work explores the modern code review process qual- solving [34].
    [Show full text]
  • Modern Code Review: a Case Study at Google
    Modern Code Review: A Case Study at Google Caitlin Sadowski, Emma Söderberg, Alberto Bacchelli Luke Church, Michal Sipko University of Zurich Google, Inc. bacchelli@ifi.uzh.ch {supertri,emso,lukechurch,sipkom}@google.com ABSTRACT novel context. Rigby and Bird quantitatively analyzed code Employing lightweight, tool-based code review of code changes review data from software projects spanning varying domains (aka modern code review) has become the norm for a wide as well as organizations and found five strongly convergent variety of open-source and industrial systems. In this pa- aspects [33], which they conjectured can be prescriptive to per, we make an exploratory investigation of modern code other projects. The analysis of Rigby and Bird is based on the review at Google. Google introduced code review early on value of a broad perspective (that analyzes multiple projects and evolved it over the years; our study sheds light on why from different contexts). For the development of an empirical Google introduced this practice and analyzes its current body of knowledge, championed by Basili [7], it is essential status, after the process has been refined through decades of to also consider a focused and longitudinal perspective that code changes and millions of code reviews. By means of 12 analyzes a single case. This paper expands on work by Rigby interviews, a survey with 44 respondents, and the analysis and Bird to focus on the review practices and characteristics of review logs for 9 million reviewed changes, we investigate established at Google, i.e., a company with a multi-decade motivations behind code review at Google, current practices, history of code review and a high-volume of daily reviews to and developers’ satisfaction and challenges.
    [Show full text]
  • What Makes a Code Review Trustworthy?
    What makes a Code Review Trustworthy? Stacy Nelson† and Johann Schumann‡ †Nelson Consulting Company, [email protected] ‡RIACS / NASA Ames, [email protected] Abstract then, a rich body of checklists, coding standards, and litera- ture about this topic has been published. Despite the exist- Code review is an important step during the process of ing lists of properties, the actual decision of which proper- certifying safety-critical software because only code that ties are most important is usually based on the experience of passes review can be implemented. Reviews are performed the person in charge. In this paper, we address the question by review boards composed of highly skilled and experi- how code review can contribute to certification of trustwor- enced computer scientists, engineers and analysts who gen- thy code. erally rely upon a checklist of properties ranging from high- We made a survey within NASA and the Aerospace in- level requirements to minute language details. While many dustry regarding which of the properties are most impor- checklists and coding standards exist, the actual decision of tant during the code review, and if there exists a subset of which properties are most important is generally based on properties, that, when fulfilled, the code is considered to be the experience of the person in charge. trustworthy. This paper addresses the questions: How can code re- For a better presentation, we have developed a classifica- view ensure certification of trustworthy code? and Is code tion of the most common properties along different ”views”, review trustworthy? We surveyed technical leaders at NASA for example, a standards-oriented view (defined as the prop- and the Aerospace industry to find out which properties are erties needed to satisfy a specific standard like IEEE 12207, most important during the code review.
    [Show full text]
  • Large-Scale Analysis of Modern Code Review Practices and Software Security in Open Source Software
    Large-Scale Analysis of Modern Code Review Practices and Software Security in Open Source Software Christopher Thompson Electrical Engineering and Computer Sciences University of California at Berkeley Technical Report No. UCB/EECS-2017-217 http://www2.eecs.berkeley.edu/Pubs/TechRpts/2017/EECS-2017-217.html December 14, 2017 Copyright © 2017, by the author(s). All rights reserved. Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. To copy otherwise, to republish, to post on servers or to redistribute to lists, requires prior specific permission. Acknowledgement I want to thank the people who have supported and guided me along my path to eventually finishing this dissertation. My parents, who encouraged me to explore my various wild fascinations while I was growing up, and who supported me through my undergraduate studies. Nick Hopper, who mentored me throughout my undergraduate studies, and who gave me a chance to learn my love of computer security and research. David Wagner, my doctoral advisor, who has been a constant sounding board for my ideas (including what led to this dissertation), for always having something interesting to teach me, and for always wanting to learn from me as I explored new ideas. And finally, thank you to Hina, who has supported me through graduate school with love and lots of understanding.
    [Show full text]
  • By Gerard Coleman School of Computer Applications, Dublin City University, Glasnevin, Dublin 9. M. Sc., September 1997
    A Quality Software Process for Rapid Application Development By Gerard Coleman School of Computer Applications, Dublin City University, Glasnevin, Dublin 9. M. Sc., September 1997 A Quality Software Process for Rapid Application Development A Dissertation Presented in Fulfilment of the Requirement for the M.Sc. Degree September 1997 Gerard Coleman School of Computer Applications Dublin City University Supervisor: Mr. Renaat Verbruggen Declaration I hereby certify that this material, which I now submit for assessment on the programme of study leading to the award of M.Sc. is entirely my own work and has not been taken from the work of others save and to the extent that such work has been cited and acknowledged within the text of my work. Date: Acknowledgements I would like to thank Renaat for his assistance, insight and guidance during the research. I would also like to thank my wife, Fiona, for her encouragement and understanding throughout the compilation of this work. Finally, I would like to thank Patrick O’Beime, Shay Curtin and Gerard McCloskey who gave so generously of their time to review this work. iv Abstract Having a defined and documented standardised software process, together with the appropriate techniques and tools to measure its effectiveness, offers the potential to software producers to improve the quality of their output. Many firms have yet to define their own software process. Yet without a defined process it is impossible to measure success or focus on how development capability can be enhanced. To date, a number of software process improvement frameworks have been developed and implemented.
    [Show full text]