Sorald: Automatic Patch Suggestions for SonarQube Static Analysis Violations
Authors:
- Khashayar EtemadiKEKhashayar Etemadi
- Nicolas HarrandNHNicolas Harrand
- Simon LarsenSLSimon Larsen
- Haris AdzemovicHAHaris Adzemovic
- Henry Luong PhuHPHenry Luong Phu
- Ashutosh VermaAVAshutosh Verma
- Fernanda MadeiralFMFernanda Madeiral
- Douglas WikstromDWDouglas Wikstrom
- Martin MonperrusMMMartin Monperrus
Preprint
Abstract
Previous work has shown that early resolution of issues detected by static code analyzers can prevent major costs later on. However, developers often ignore such issues for two main reasons. First, many issues should be interpreted to determine if they correspond to actual flaws in the program. Second, static analyzers often do not present the issues in a way that is actionable. To address these problems, we present Sorald: a novel system that devise metaprogramming templates to transform the abstract syntax trees of programs and suggest fixes for static analysis warnings. Thus, the burden on the developer is reduced from interpreting and fixing static issues, to inspecting and approving full fledged solutions. Sorald fixes violations of 10 rules from SonarJava, one of the most widely used static analyzers for Java. We evaluate Sorald on a dataset of 161 popular repositories on Github. Our analysis shows the effectiveness of Sorald as it fixes 65% (852/1,307) of the violations that meets the repair preconditions. Overall, our experiments show it is possible to automatically fix notable violations of the static analysis rules produced by the state-of-the-art static analyzer SonarJava.Keywords
All Related Versions
This publication has 20 references indexed in Scilit:
- Styler: learning formatting conventions to repair Checkstyle violationsEmpirical Software Engineering, 2022
- Understanding static code warnings: An incremental AI approachExpert Systems with Applications, 2021
- Automated patch assessment for program repair at scaleEmpirical Software Engineering, 2021
- Some SonarQube issues have a significant but small effect on faults and changes. A large-scale empirical studyJournal of Systems and Software, 2020
- On the diffuseness of technical debt items and accuracy of remediation time when using SonarQubeInformation and Software Technology, 2020
- SpongeBugs: Automatically generating fix suggestions in response to static code analysis warningsJournal of Systems and Software, 2020
- A longitudinal study of static analysis warning evolution and the effects of PMD on software quality in Apache open source projectsEmpirical Software Engineering, 2020
- How developers engage with static analysis tools in different contextsEmpirical Software Engineering, 2019
- SPOON: A library for implementing analyses and transformations of Java source codeSoftware: Practice and Experience, 2015
- An Algorithm for Layout Preservation in Refactoring Transformations2012