Getafix: Learning to fix bugs automatically

02/16/2019
by   Andrew Scott, et al.
0

Static analyzers, including linters, can warn developers about programming errors, bugs, style errors, and generally suspicious code. Sometimes analyzer rules have obvious fixes but other times choosing an appropriate fix is more nuanced and can take some time for a developer to proceed. Offering fix suggestions for these trickier analyzers can therefore help save developer time, but in order for developers to accept the offered fix the patch must look natural. Additionally, in a production environment there is a limited amount of resources that can be spent validating fix candidates, so there is not time to evaluate a large number of fix candidates. In fact, at Facebook we can generally only afford to validate a single suggested fix. To solve these issues, we built Getafix, a tool which mines patterns from past fixes made by developers with enough context to accurately create natural-looking autofix suggestions. The patches we learn contain all the context needed to apply and rank them, so even though we only validate the top fix candidate we still are able to offer fix suggestions in a lot of cases. Additionally, our pattern mining approach can be directed at the whole code change history to find new lint warnings, avoiding the manual effort from developers to create new lint rules. Our pattern mining approach is more effective in discovering new and applicable patterns than previous work because it includes context about where and how the pattern should apply.

READ FULL TEXT

page 8

page 14

research
11/04/2019

An Expert System for Learning Software Engineering Knowledge (with Case Studies in Understanding Static Code Warning)

Knowledge-based systems reason over some knowledge base. Hence, an impor...
research
03/01/2023

The Inversive Relationship Between Bugs and Patches: An Empirical Study

Software bugs pose an ever-present concern for developers, and patching ...
research
11/12/2019

Debugging Crashes using Continuous Contrast Set Mining

Facebook operates a family of services used by over two billion people d...
research
04/21/2021

Assessing Validity of Static Analysis Warnings using Ensemble Learning

Static Analysis (SA) tools are used to identify potential weaknesses in ...
research
07/13/2021

Mining Idioms in the Wild

Existing code repositories contain numerous instances of code patterns t...
research
07/02/2020

Random errors are not politically neutral

Errors are inevitable in the implementation of any complex process. Here...

Please sign up or login with your details

Forgot password? Click here to reset