Font Size: a A A

Change-History-based Automatically Fixing Of Code Internal Quality Issues

Posted on:2020-10-03Degree:MasterType:Thesis
Country:ChinaCandidate:J T XueFull Text:PDF
GTID:2518306548490424Subject:Master of Engineering
Abstract/Summary:PDF Full Text Request
With the rapid development of Internet technology,developers from all over the world have collaborated to contribute code through the open source community to form a large-scale open source software library.Software quality is an important indicator to measure software reliability and maintainability,which plays an important role in software's success.The code internal quality reflects the readability and maintainability of software quality and high-quality code can improve the efficiency of developing open source software.While OSS can provide great productivity,the rapid increase of contributions and the difference among individuals have challenged the code quality management and assurance.Traditional code quality assurance include manual review and tool check.However,developers fix Code internnal Quality Issues(CQI)only by manual effort,which is a time-consuming task,and greatly affects the efficiency of merging OSS contribution.How to automatically fixing CQI has become an important research topic in Crowd Intelligence Software Engineering.Software repository in OSS community contains tremendous knowledge of software development,such as feature enhancement,performance improvement and bug fixing.How to learn the knowledge from the code repository and apply it to the real-world development of software has been a research hotspot of software engineering.This thesis proposed CQIFixer,a change-history-based automatically fix for Code Quality Issues.The contribution of our work are as follows:(1)This thesis investigates the code quality of OSS community and the feature of CQIs fixed by developers to provide empirical evidence for mining fix patterns from code change history of software repository.First,this thesis selects 206 popular JAVA projects from the GitHub platform,extract versions which are related to fixing CQIs,and analyze the code quality by Sonar Qube.The thesis mined 9,876,064 CQI instances and 32,093 CQI fix instances.Further,this thesis quantitatively analyzes the distribution difference among different type and severity of CQI,as well as distribution of fixed CQI.The empirical experiment shows that(1)CQIs are recurrent,7.12% of CQI types account for more than 90%;(2)most CQI types are concerned by developers,the fixed CQI types account for 73.7% of all detected types.(2)This thesis extracts the CQI Fix Instances,abstracts and models the CQI Fix Pattern.First,an algorithm to extract CQI Fix Instances is designed.The thesis collects CQI code and extracts its feature by Sonar Qube.Then,this thesis uses code diff tool Gum Tree to extract the code Fix Actions at Abstract Syntactic Tree(AST)level.Further,a model to abstract CQI Fix Pattern is proposed.The thesis abstracts CQI type,Code Context and Fix Action at AST-level to model CQI Fix Pattern for each CQI Fix instance.This thesis obtains 68 Common Fix Patterns of 56 CQI types and concrete Fix Patterns related to the specific CQI code context.(3)The thesis designs CQI Fix Pattern matching algorithm and the module of automatic CQI fix.First,a two-phase match algorithm is proposed.The match algorithm compute and output the most similar Fix Patterns for CQI code by CQI Type and the code feature based on Word2 Vec.Then the automatic CQI fix tool,CQIFixer,is designed.The fix algorithm fo CQIFixer changes CQI source code at Abstract Syntactic Tree(AST)level guided by matched Fix Pattern,and finally use Sonar Qube to verify the fix patch.As a result,in Top1 Fix Pattern,CQIFixer can reach 80% of average correctness rate,69.17% in Top 5.What's more,real-world live study in GitHub community shows that11 of the 17 Pull Request about CQI fix submitted are approved or merged by developers.
Keywords/Search Tags:Crowd Intelligence Software Engineering, Open Source Software, Contribution Quality Insurance, Code Quality, Fix Pattern, Mining Software Repository
PDF Full Text Request
Related items