Sorald: Automatic Patch Suggestions for SonarQube Static Analysis Violations
Open Access
- 13 April 2022
- journal article
- research article
- Published by Institute of Electrical and Electronics Engineers (IEEE) in IEEE Transactions on Dependable and Secure Computing
- Vol. 20 (4) , 2794-2810
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 uses metaprogramming templates to transform the abstract syntax trees of programs and suggests 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
Funding Information
- Knut och Alice Wallenbergs Stiftelse
- Swedish Foundation for Strategic Research
- Swedish National Infrastructure for Computing
This publication has 45 references indexed in Scilit:
- Measure it? Manage it? Ignore it? software practitioners and technical debt2015
- SPOON: A library for implementing analyses and transformations of Java source codeSoftware: Practice and Experience, 2015
- Moving Fast with Software Verification2015
- Fine-grained and accurate source code differencing2014
- Modular and verified automatic program repair2012
- An Algorithm for Layout Preservation in Refactoring Transformations2012
- Combined Static and Dynamic AnalysisElectronic Notes in Theoretical Computer Science, 2005
- Finding bugs is easyACM SIGPLAN Notices, 2004
- Parse-tree annotations meet re-engineering concerns2004
- Preserving the documentary structure of source code in language-based transformation tools2002