IEEE Access (Jan 2019)

History-Driven Fix for Code Quality Issues

  • Jiangtao Xue,
  • Xinjun Mao,
  • Yao Lu,
  • Yue Yu,
  • Shangwen Wang

DOI
https://doi.org/10.1109/ACCESS.2019.2934975
Journal volume & issue
Vol. 7
pp. 111637 – 111648

Abstract

Read online

To ensure the internal code quality of contributions in open source software (OSS) communities, static analysis tools (e.g. Code Climate and SonarQube) have been integrated into the modern pull-based workflow for detecting code quality issues (CQIs). Automated CQI fixing is conducive to improve the efficiency of converging massive contributions. In this paper, we propose a history-driven approach to automatically fix CQIs utilizing the fixing knowledge mined from the change history in the code repositories. We collected 5,047,678 CQI isstances, 31,013 fixes of the CQIs that were detected by SonarQube from 206 GitHub projects and mined 68 common Fix Patterns for 56 CQI types. Evaluated by fixing the unfix CQI Instances, we find that the average correctness of our approach is 80% in top 1 fix patch and 69.17% of Top 5. We further conducted a live study by sending CQI's fix patches to GitHub projects. The results show that developers approved or merged 11 of 17 patches.

Keywords