Improving IDE code inspections with tree automata
Published in Foundations of Software Engineering ESEC/FSE, 2022
Integrated development environments (IDEs) are equipped with code inspections to warn developers of malformed or incorrect code by analyzing the code’s data flow. However, the data flow analysis performed by the IDE code inspections may issue warnings in code where warnings are irrelevant. Existing methods to prevent any bogus warnings are either too conservative — suppressing the same type of warnings in the entire codebase — or are not sustainable as they require adding a set of heuristics to the data flow analysis. We propose a programming-by-example (PBE) framework that synthesizes tree automata (TAs) to suppress bogus warnings in all the code containing the same patterns as the user-provided examples. Experiments with a prototype of the framework demonstrate that several real-world patterns heuristically suppressed in production IDE can be mechanically translated to a TA in a systematic way. Furthermore, we briefly discuss how TA-based solution can be useful in other IDE features such as code refactoring.