Sorald: Automatic Patch Suggestions for SonarQube Static Analysis Violations

Khashayar Etemadi, Nicolas Harrand, Simon Larsen, Haris Adzemovic, Henry Luong Phu +4 more
3/22/2021
27 citations
cs.SE

Official code: ASSERT-KTH/sorald (100 stars, Java, MIT, last commit 2026-11-10).

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.

Show full abstract

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.

View on arXivView PDF

Code Implementations(1)

ASSERT-KTH/soraldOfficial100%
MIT

Automatic repair system for static analysis warnings from SonarQube's SonarJava, TDSC 2022 http://arxiv.org/pdf/2103.12033

10029Java, PythonMay 9, 20183 weeks agoMIT
kthprogram-repairsonarjavasonarqubessf

Similar Papers

Cite this paper

@article{etemadi2021sorald,
  title  = {Sorald: Automatic Patch Suggestions for SonarQube Static Analysis Violations},
  author = {Khashayar Etemadi and Nicolas Harrand and Simon Larsen and Haris Adzemovic and Henry Luong Phu and Ashutosh Verma and Fernanda Madeiral and Douglas Wikstrom and Martin Monperrus},
  year   = {2021},
  eprint = {2103.12033},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2103.12033}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2103.12033.svg)](https://codeofpaper.com/paper/2103.12033)

Discussion