Getafix: Learning to fix bugs automatically

by   Andrew Scott, et al.

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.



There are no comments yet.


page 8

page 14


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...

Assessing Validity of Static Analysis Warnings using Ensemble Learning

Static Analysis (SA) tools are used to identify potential weaknesses in ...

Debugging Crashes using Continuous Contrast Set Mining

Facebook operates a family of services used by over two billion people d...

Repairnator patches programs automatically

Repairnator is a bot. It constantly monitors software bugs discovered du...

Mining Idioms in the Wild

Existing code repositories contain numerous instances of code patterns t...

Fast and Precise On-the-fly Patch Validation for All

Generate-and-validate (G V) automated program repair (APR) techniques ...
This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.