深入探讨PMD和SonarQube生成的警告,其规则及其对已建立编码标准的合规性
Taking a Closer Look at Warnings Generated by PMD and SonarQube, their Rules and Compliance to Established Coding Standards
AI总结:
本文通过分析Stack Overflow和Apache Tomcat的代码,探讨PMD和SonarQube生成的警告规则及其对编码标准的合规性,发现部分规则存在假阳性问题,并建议进一步研究以改进SCA工具的准确性。
摘要:
背景:静态代码分析(SCA)工具在软件开发中起着至关重要的作用,有助于减少代码审查所需的成本和时间。然而,社区中最好的工具也报告了较高的假阳性率和假阴性率。因此,研究往往旨在开发数据集以学习SCA警告模式,以减少假结果。这些数据集旨在具有高质量和高容量,以覆盖通常导致假警告的完整范围的故障/规则,并符合已建立的编码标准。然而,现有研究并未利用此类数据集或识别容易产生假阳性的规则的广度及其对编码标准的合规性。目标:我们分析了Stack Overflow和Apache Tomcat的代码,以捕捉代码长度和风格的变化,以检测最佳性能工具PMD和SonarQube的假阳性警告,解决这一缺口。方法:在推导假阳性警告时,使用已建立的编码标准对工具的输出进行标记。然后进行更深入的分析,以识别容易产生假阳性的规则、这些规则的原因,以及SCA规则与已建立标准之间的共识或差距。结果:在我们的主要结果中,我们观察到只有少数SCA规则会产生假阳性,四个数据集中占比从4.64%到18.45%。此外,消除与已建立标准相矛盾的规则会显著降低假阳性率。此外,我们的发现揭示了工具与已建立标准之间的差异。结论:鉴于本研究中建立的证据,我们建议进一步研究工具与已建立标准之间的差距,包括使用机器学习方法来标注更大的数据集。
英文摘要:
Context: Static code analysis (SCA) tools play a vital role in software development, reducing the cost and time required for code reviews. However, high false-positive and false-negative rates are reported for the best tools in the community. Accordingly, studies often aim to develop datasets for learning SCA warning patterns to reduce false results. These datasets are meant to possess high-quality and high-volume in covering the full range of faults/rules that typically result in false warnings and be compliant with established coding standards. However, existing studies have not utilised such datasets or identified the breadth of rules that are prone to false positives and their compliance to coding standards. Objectives: We analysed code from Stack Overflow and Apache Tomcat to capture variations in code length and style in detecting false-positive warnings from best-performing tools PMD and SonarQube, addressing this gap. Method: In deriving false-positive warnings, outcomes from the tools were labelled using established coding standards. Deeper analyses were then conducted to identify the rules that are prone to false-positives, reasons for these, and agreement/gaps between SCA rules and established standards. Results: Among our main outcomes, we observe that only a few SCA rules generate false positives, ranging from 4.64% to 18.45% across four datasets. Additionally, eliminating rules that contradict established standards significantly reduce the false-positive rate. Additionally, our findings reveal discrepancies between tools and established standards. Conclusion: Given the evidence established in this study, we recommend further investigations into gaps between tools and established standards, including the use of machine learning approaches to annotate larger datasets.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。