paperbot · PL 论文追踪

全部论文 待读 收藏

P1 Synthesizing code quality rules from examples

从示例合成代码质量规则
OOPSLA 6(OOPSLA2)2022匹配度 5/10 · 该论文属于静态分析/程序分析领域,用程序合成自动生成代码质量规则,并有 Amazon CodeGuru Reviewer 的工业落地,符合对理论+工程和工业应用的偏好;但它不涉及 LLM/Agent,也不属于浮点程序分析或贝叶斯程序分析,与当前画像的核心交叉方向匹配有限。引用 8 inbox
Pranav Garg, Srinivasan H. Sengamedu
crossref: 2026-09-10

AI 速览

一句话:提出 RhoSynth,利用开发者代码变更示例自动合成一阶逻辑代码质量规则,并部署于 Amazon CodeGuru Reviewer。

代码质量静态分析规则通常由专家手工编写,成本高且难以覆盖大量问题。本文提出从示例自动合成代码质量规则,将其形式化为在代码图表示上合成一阶逻辑公式。作者提出 RhoSynth,基于整数线性规划(ILP)进行图对齐以识别规则关注的代码元素,并利用开发者实际代码变更作为正负示例引导合成,同时支持依据用户新示例增量精化规则。作者在 Java 上合成了 30 余条代码质量规则并部署到 Amazon CodeGuru Reviewer;基于 Amazon 内部实时代码审查的开发者反馈,规则精确率超过 75%。与近期基线相比,当前最先进的程序合成方法无法合成其中大多数规则。

问题
静态分析中的代码质量规则依赖专家手工编写,本文研究如何从正负示例自动合成此类规则。
方法
将规则合成形式化为代码图上的第一阶逻辑公式合成,提出基于整数线性规划图对齐的 RhoSynth 算法,并利用开发者代码变更作为示例进行引导与增量精化。
评估
在 Java 上合成 30 余条规则并部署于 Amazon CodeGuru Reviewer,基于实时代码审查反馈精确率超过 75%,且优于现有程序合成基线。
原文摘要(Abstract)

Static Analysis tools have rules for several code quality issues and these rules are created by experts manually. In this paper, we address the problem of automatic synthesis of code quality rules from examples. We formulate the rule synthesis problem as synthesizing first order logic formulas over graph representations of code. We present a new synthesis algorithm RhoSynth that is based on Integer Linear Programming-based graph alignment for identifying code elements of interest to the rule. We bootstrap RhoSynth by leveraging code changes made by developers as the source of positive and negative examples. We also address rule refinement in which the rules are incrementally improved with additional user-provided examples. We validate RhoSynth by synthesizing more than 30 Java code quality rules. These rules have been deployed as part of Amazon CodeGuru Reviewer and their precision exceeds 75% based on developer feedback collected during live code-reviews within Amazon. Through comparisons with recent baselines, we show that current state-of-the-art program synthesis approaches are unable to synthesize most of these rules.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot1422,
  title = {Synthesizing code quality rules from examples},
  author = {Pranav Garg and Srinivasan H. Sengamedu},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {6},
  number = {OOPSLA2},
  year = {2022},
  doi = {10.1145/3563350}
}