A template-based approach to automatic program repair of Sonarqube static warnings

As the prevalence of software continues to increase, so does the number of bugs. Static analysis can uncover a multitude of bugs in a reasonable time frame compared to its dynamic equivalent but is plagued by other issues such as high false-positive alert rates and unclear calls to action, making it...

Full description

Bibliographic Details
Main Author: Adzemovic, Haris
Format: Others
Language:English
Published: KTH, Skolan för elektroteknik och datavetenskap (EECS) 2020
Subjects:
Online Access:http://urn.kb.se/resolve?urn=urn:nbn:se:kth:diva-273924
Description
Summary:As the prevalence of software continues to increase, so does the number of bugs. Static analysis can uncover a multitude of bugs in a reasonable time frame compared to its dynamic equivalent but is plagued by other issues such as high false-positive alert rates and unclear calls to action, making it underutilized considering the benefits it can bring with its bug-finding abilities. This thesis aims to reduce the shortcomings of static analysis by implementing and evaluating a template-based approach of automatically repairing bugs found by static analysis. The approach is evaluated by automatically creating and submitting patches containing bug fixes to open-source projects already utilizing static analysis. The results show that the approach and developed tool are valuable and decrease the number of bugs of the kind which static analysis finds. Two possible ways of integrating the created tool into existing developer workflows are prototyped and a comparison with a similar tool is performed to showcase the different approaches’ differences, strengths and weaknesses === Antalet buggar i världen fortsätter öka i takt med utbredningen av mjukvara. Statisk analys kan avslöja en mängd av buggar inom en rimlig tidsram jämfört med dess dynamiska motsvarighet men plågas av andra problem som en hög falskt positiv alarmfrekvens samt oklara uppmaningar till handling vilket gör det underutnyttjat med tanke på fördelarna det kan medföra med sin förmåga att finna buggar. Denna studie ämnar minska bristerna i statisk analys genom att implementera och utvärdera ett mallbaserat tillvägagångssätt för att automatiskt reparera buggar som avslöjas genom statisk analys. Tillvägagångssättet utvärderas genom att automatiskt skapa och skicka in korrigeringar som innehåller bugfixar till open source - projekt som redan använder statisk analys. Resultaten visar att tillvägagångssättet och det utvecklade verktyget är värdefulla och minskar antalet buggar av det slag som statisk analys hittar. Två protyper skapas av möjliga sätt att integrera det skapade verktyget i befintliga utvecklarflöden och en jämförelse med ett liknande verktyg utförs för att visa de olika strategiernas skillnader, styrkor och svagheter.