Accurate and Efficient Refactoring Detection in Commit History

Refactoring detection algorithms have been crucial to a variety of applications: (i) empirical studies about the evolution of code, tests, and faults, (ii) tools for library API migration, (iii) improving the comprehension of changes and code reviews, etc. However, recent research has questioned the accuracy of the state-of-the-art refactoring detection tools, which poses threats to the reliability of their application. Moreover, previous refactoring detection tools are very sensitive to user-provided similarity thresholds, which further reduces their practical accuracy. In addition, their requirement to build the project versions/revisions under analysis makes them inapplicable in many real-world scenarios. To reinvigorate a previously fruitful line of research that has stifled, we designed, implemented, and evaluated RMiner, a technique that overcomes the above limitations. At the heart of RMiner is an AST-based statement matching algorithm that determines refactoring candidates without requiring user-defined thresholds. To empirically evaluate RMiner, we created the most comprehensive oracle to date that uses triangulation to create a dataset with considerably reduced bias, representing 3,188 refactorings from 185 open-source projects. Using this oracle, we found that RMiner has a precision of 98% and recall of 87%, which is a significant improvement over the previous state-of-the-art.

[1]  Emerson R. Murphy-Hill,et al.  Reconciling manual and automatic refactoring , 2012, 2012 34th International Conference on Software Engineering (ICSE).

[2]  William G. Griswold Program restructuring as an aid to software maintenance , 1992 .

[3]  Frank Tip,et al.  Refactoring support for class library migration , 2005, OOPSLA '05.

[4]  Gabriele Bavota,et al.  ARENA: An Approach for the Automated Generation of Release Notes , 2017, IEEE Transactions on Software Engineering.

[5]  Eleni Stroulia,et al.  The JDEvAn tool suite in support of object-oriented evolutionary development , 2008, ICSE Companion '08.

[6]  Harald C. Gall,et al.  Change Distilling:Tree Differencing for Fine-Grained Source Code Change Extraction , 2007, IEEE Transactions on Software Engineering.

[7]  Emerson R. Murphy-Hill,et al.  Refactoring-aware code review , 2017, 2017 IEEE Symposium on Visual Languages and Human-Centric Computing (VL/HCC).

[8]  Eleni Stroulia,et al.  Refactoring Detection based on UMLDiff Change-Facts Queries , 2006, 2006 13th Working Conference on Reverse Engineering.

[9]  Stephan Diehl,et al.  Comparison of similarity metrics for refactoring detection , 2011, MSR '11.

[10]  Andreas Zeller,et al.  When do changes induce fixes? , 2005, ACM SIGSOFT Softw. Eng. Notes.

[11]  William F. Opdyke,et al.  Refactoring object-oriented frameworks , 1992 .

[12]  Ralph E. Johnson,et al.  Effective Software Merging in the Presence of Object-Oriented Refactorings , 2008, IEEE Transactions on Software Engineering.

[13]  Arie van Deursen,et al.  Refactoring test code , 2001 .

[14]  Georgios Gousios,et al.  Untangling fine-grained code changes , 2015, 2015 IEEE 22nd International Conference on Software Analysis, Evolution, and Reengineering (SANER).

[15]  Mauricio Finavaro Aniche,et al.  SATT: Tailoring Code Metric Thresholds for Different Software Architectures , 2016, SCAM.

[16]  Tibor Gyimóthy,et al.  Empirical evaluation of software maintainability based on a manually validated refactoring dataset , 2018, Inf. Softw. Technol..

[17]  Martin P. Robillard,et al.  Non-essential changes in version histories , 2011, 2011 33rd International Conference on Software Engineering (ICSE).

[18]  William G. Griswold,et al.  The Future of Refactoring (Dagstuhl Seminar 14211) , 2014, Dagstuhl Reports.

[19]  Vladimir I. Levenshtein,et al.  Binary codes capable of correcting deletions, insertions, and reversals , 1965 .

[20]  Eleni Stroulia,et al.  UMLDiff: an algorithm for object-oriented design differencing , 2005, ASE.

[21]  Emerson R. Murphy-Hill,et al.  Towards refactoring-aware code review , 2014, CHASE.

[22]  Tiago L. Alves,et al.  Deriving metric thresholds from benchmark data , 2010, 2010 IEEE International Conference on Software Maintenance.

[23]  Stas Negara,et al.  Is It Dangerous to Use Version Control Histories to Study Source Code Evolution? , 2012, ECOOP.

[24]  Miryung Kim,et al.  An empirical investigation into the impact of refactoring on regression testing , 2012, 2012 28th IEEE International Conference on Software Maintenance (ICSM).

[25]  Ralph E. Johnson,et al.  Automated upgrading of component-based applications , 2006, OOPSLA '06.

[26]  Emerson R. Murphy-Hill,et al.  Comparing approaches to analyze refactoring activity on software repositories , 2013, J. Syst. Softw..

[27]  Gibson Adam,et al.  Deeplearning4j: Distributed, open-source deep learning for Java and Scala on Hadoop and Spark , 2016 .

[28]  Mauricio A. Saca Refactoring improving the design of existing code , 2017, 2017 IEEE 37th Central America and Panama Convention (CONCAPAN XXXVII).

[29]  Francesca Arcelli Fontana,et al.  DPB: A Benchmark for Design Pattern Detection Tools , 2012, 2012 16th European Conference on Software Maintenance and Reengineering.

[30]  Thomas Zimmermann,et al.  Automatic Identification of Bug-Introducing Changes , 2006, 21st IEEE/ACM International Conference on Automated Software Engineering (ASE'06).

[31]  Gabriele Bavota,et al.  An experimental investigation on the innate relationship between quality and refactoring , 2015, J. Syst. Softw..

[32]  Marc Roper,et al.  Comparing text‐based and dependence‐based approaches for determining the origins of bugs , 2014, J. Softw. Evol. Process..

[33]  Miryung Kim,et al.  Ref-Finder: a refactoring reconstruction tool based on logic query templates , 2010, FSE '10.

[34]  Tom Mens,et al.  Towards a taxonomy of software change , 2005, J. Softw. Maintenance Res. Pract..

[35]  William G. Griswold,et al.  WitchDoctor: IDE support for real-time auto-completion of refactorings , 2012, 2012 34th International Conference on Software Engineering (ICSE).

[36]  Jaime Spacco,et al.  SZZ revisited: verifying when changes induce fixes , 2008, DEFECTS '08.

[37]  Andrew P. Black,et al.  How we refactor, and how we know it , 2009, 2009 IEEE 31st International Conference on Software Engineering.

[38]  Andy Zaidman,et al.  Circumventing refactoring masking using fine-grained change recording , 2015, IWPSE.

[39]  Stephan Diehl,et al.  Are refactorings less error-prone than other changes? , 2006, MSR '06.

[40]  Eleni Stroulia,et al.  API-Evolution Support with Diff-CatchUp , 2007, IEEE Transactions on Software Engineering.

[41]  Shinji Kusumoto,et al.  CCFinder: A Multilinguistic Token-Based Code Clone Detection System for Large Scale Source Code , 2002, IEEE Trans. Software Eng..

[42]  Francesca Arcelli Fontana,et al.  Automatic Metric Thresholds Derivation for Code Smell Detection , 2015, 2015 IEEE/ACM 6th International Workshop on Emerging Trends in Software Metrics.

[43]  Gabriele Bavota,et al.  When Does a Refactoring Induce Bugs? An Empirical Study , 2012, 2012 IEEE 12th International Working Conference on Source Code Analysis and Manipulation.

[44]  Ralph E. Johnson,et al.  Automated Detection of Refactorings in Evolving Components , 2006, ECOOP.

[45]  Giuliano Antoniol,et al.  An automatic approach to identify class evolution discontinuities , 2004, Proceedings. 7th International Workshop on Principles of Software Evolution, 2004..

[46]  Carsten Görg,et al.  Detecting and visualizing refactorings from software archives , 2005, 13th International Workshop on Program Comprehension (IWPC'05).

[47]  Stas Negara,et al.  A Comparative Study of Manual and Automated Refactorings , 2013, ECOOP.

[48]  Nan Niu,et al.  Supporting requirements traceability through refactoring , 2013, 2013 21st IEEE International Requirements Engineering Conference (RE).

[49]  Roberto da Silva Bigonha,et al.  Identifying thresholds for object-oriented software metrics , 2012, J. Syst. Softw..

[50]  Emerson R. Murphy-Hill,et al.  Manual refactoring changes with automated refactoring validation , 2014, ICSE.

[51]  Marco Tulio Valente,et al.  RefDiff: Detecting Refactorings in Version Histories , 2017, 2017 IEEE/ACM 14th International Conference on Mining Software Repositories (MSR).

[52]  Grzegorz Kondrak,et al.  N-Gram Similarity and Distance , 2005, SPIRE.

[53]  Stephan Diehl,et al.  Identifying Refactorings from Source-Code Changes , 2006, 21st IEEE/ACM International Conference on Automated Software Engineering (ASE'06).

[54]  Miryung Kim,et al.  An empirical investigation into the role of API-level refactorings during software evolution , 2011, 2011 33rd International Conference on Software Engineering (ICSE).

[55]  Marco Tulio Valente,et al.  Extracting relative thresholds for source code metrics , 2014, 2014 Software Evolution Week - IEEE Conference on Software Maintenance, Reengineering, and Reverse Engineering (CSMR-WCRE).

[56]  Tibor Gyimóthy,et al.  A Manually Validated Code Refactoring Dataset and Its Assessment Regarding Software Maintainability , 2016, PROMISE.

[57]  Amer Diwan,et al.  CatchUp!: capturing and replaying refactorings to support API evolution , 2005, ICSE.

[58]  Uirá Kulesza,et al.  A Framework for Evaluating the Results of the SZZ Approach for Identifying Bug-Introducing Changes , 2017, IEEE Transactions on Software Engineering.

[59]  Günter Kniesel,et al.  Standing on the shoulders of giants - A data fusion approach to design pattern detection , 2009, 2009 IEEE 17th International Conference on Program Comprehension.

[60]  Tibor Gyimóthy,et al.  Towards a Benchmark for Evaluating Design Pattern Miner Tools , 2008, 2008 12th European Conference on Software Maintenance and Reengineering.

[61]  Gabriele Bavota,et al.  There and back again: Can you compile that snapshot? , 2017, J. Softw. Evol. Process..

[62]  Mika Mäntylä,et al.  Comparing and experimenting machine learning techniques for code smell detection , 2015, Empirical Software Engineering.

[63]  Andrea De Lucia,et al.  An Exploratory Study on the Relationship between Changes and Refactoring , 2017, 2017 IEEE/ACM 25th International Conference on Program Comprehension (ICPC).

[64]  Gabriele Bavota,et al.  On the Impact of Refactoring Operations on Code Quality Metrics , 2014, 2014 IEEE International Conference on Software Maintenance and Evolution.

[65]  Michael W. Godfrey,et al.  Using origin analysis to detect merging and splitting of source code entities , 2005, IEEE Transactions on Software Engineering.

[66]  Miryung Kim,et al.  Template-based reconstruction of complex refactorings , 2010, 2010 IEEE International Conference on Software Maintenance.

[67]  Oscar Nierstrasz,et al.  Finding refactorings via change metrics , 2000, OOPSLA '00.

[68]  Nan Niu,et al.  Supporting requirements to code traceability through refactoring , 2013, Requirements Engineering.

[69]  Miryung Kim,et al.  RefDistiller: a refactoring aware code review tool for inspecting manual refactoring edits , 2014, SIGSOFT FSE.

[70]  Ralph E. Johnson,et al.  How do APIs evolve? A story of refactoring , 2006, J. Softw. Maintenance Res. Pract..

[71]  Marco Tulio Valente,et al.  Why we refactor? confessions of GitHub contributors , 2016, SIGSOFT FSE.