Method Level Refactoring Prediction Using CodeBERT Model
摘要
CodeBERT is an autoencoder model used for code search, code synthesis and classification. It is to improve the code quality by handling large amounts of codebases. As it operates on two natural languages, it is considered as bimodal. Objectives: In this work we have used this model for generating automated refactoring suggestions at method level by using java code snippets.Materials and Methods: Our works focuses on the details implementation of automated model which is used for refactoring prediction. Binary labels are used for synthesizing the code snippets which is classified in two category that is high probability and low probability refactoring. Result Analysis: Code analysis is done on five different java code snippets that is related to method level refactoring category. CodeBERT model performed refactoring prediction using the labels and the analysis is done by using snippets related to extract method, inline method, rename method, move method and pull up method techniques. Performance of the pre-trained model for snippet 4 is high with accuracy 97%, precision 0.98, recall 0.98 and f-measure 0.98 respectively.Conclusion: CodeBERT model gives good results for java code snippets with maximum accuracy of 97%. Refactoring suggestions provided by the model helps to identify the requirement of code alteration which is highly beneficial to the code developer.