To optimize the process of software testing and to improve software quality and reliability, many attempts have been made to develop more effective methods for predicting software defects. Previous work on defect prediction has used machine learning and artificial software metrics. Unfortunately, artificial metrics are unable to represent the features of syntactic, semantic, and context information of defective modules. In this article, therefore, we propose a practical approach for identifying software defect patterns via the combination of semantics and context information using abstract syntax tree representation learning. Graph neural networks are also leveraged to capture the latent defect information of defective subtrees, which are pruned based on a fix-inducing change. To validate the proposed approach for predicting defects, we define mining rules based on the GitHub workflow and collect 6052 defects from 307 projects. The experiments indicate that the proposed approach performs better than the state-of-the-art approach and five traditional machine learning baselines. An ablation study shows that the information about code concepts leads to a significant increase in accuracy.
Recognizing and repairing defects to enhance quality in software life circle has become a critical research topic. Unfortunately, it is difficult to guarantee the validity of the defect prediction method based on manually designed features proposed in previous studies. Numerous scholars have endeavored to use a single model to obtain prediction results for different types of fault, but this is difficult to perform. This article improves the defect representation and prediction model in software defect prediction, proposing Augmented-Code Property Graph (CPG) based defect prediction method (ACGDP). Augmented-CPG is a novel encoding graph format introduced in this article. Based on Augmented-CPG, we suggested defect region candidate extraction approach linked to the defect category. Graph neural networks are used for obtaining defect characteristics. Experiments on three distinct types of defects indicate that ACGDP can predict certain classed of defects effectively.
With the increasing scale and complexity of software systems, the defects of software are increasing every day. Software defect data is the foundation of research and application of software reliability. Currently, the lack of software defect data, its insufficient coverage, and the limits of the software types involved have become the bottleneck of software reliability research and application. Starting from GitHub, the open-source software hosting platform, this paper analyzes software defect data in open source projects and classifies the available software data. Based on the research of the GitHub and Git repository, we propose a defect data acquisition technology based on open-source software that uses pull requests as the breakthrough point of the method. Moreover, we advanced a software defect data preliminary treatment and built a software defect big datasets collecting system that contains fix-inducing change and contextual information of defects, which solves the class imbalance problem. According to this method, a software defect big data automatic acquisition platform based on GitHub was developed to realize the automatic collection of software defect data. Finally, the efficiency of data collection, correctness of data, and validity of the dataset application were verified by experiments. The results show that the proposed method is efficient and effective.
Software defect prediction is a popular method for optimizing software testing and improving software quality and reliability. However, software defect datasets usually have quality problems, such as class imbalance and data noise. Oversampling by generating the minority class samples is one of the most well-known methods to improving the quality of datasets; however, it often introduces overfitting noise to datasets. To better improve the quality of these datasets, this paper proposes a method called US-PONR, which uses undersampling to remove duplicate samples from version iterations and then uses oversampling through propensity score matching to reduce class imbalance and noise samples in datasets. The effectiveness of this method was validated in a software prediction experiment that involved 24 versions of software data in 11 projects from PROMISE in noisy environments that varied from 0% to 30% noise level. The experiments showed a significant improvement in the quality of datasets pre-processed by US-PONR in noisy imbalanced datasets, especially the noisiest ones, compared with 12 other advanced dataset processing methods. The experiments also demonstrated that the US-PONR method can effectively identify the label noise samples and remove them.
Recognizing defects in source code through deep learning methods has become an important research subject for improving software quality. Although Transformer-based models such as CodeBERT have demonstrated impressive performance improvement in defect prediction tasks, models relying on single-structured input data, such as sequences, have limited ability to capture the code's structural features. Treating code simply as text overlooks essential information such as control dependencies, data dependencies, and syntactic structures inherent in the code. This paper proposes the Heterogeneous Discrete Code Graph (HDCG), which assigns structural information to code tokens from multiple perspectives. We also introduce an improved transformer model FINEGATE that leverages HDCG to guide self-attention. The experiments demonstrate that FINEGATE can effectively predict source code defects and perform fine-grained defect localization.