蚂蚁集团大规模代码分析的原理与实践:一种面向数据和逻辑的方法
Principles and Practices of Large-Scale Code Analysis at Ant Group: A Data- and Logic-Oriented Approach
AI总结:
提出CodeFuse-Query,一种基于Datalog和两层模式COREF的大规模代码分析数据系统,通过逻辑计算和领域优化设计实现高效跨语言分析,每日处理超100亿行代码。
摘要:
大规模软件开发需要动态且多方面的静态代码分析,这超出了传统工具的能力。现有工具如CodeQL缺乏跨语言分析能力,且可能耗时且资源密集。我们提出了CodeFuse-Query,一个专为大规模代码分析定制的数据系统。首先,CodeFuse-Query采用面向逻辑的计算设计,使用带有两层模式COREF的Datalog将源代码转换为数据事实,并使用Godel以逻辑术语表达复杂分析任务。此外,CodeFuse-Query采用领域优化的系统设计。这种方法优化了资源利用,优先考虑数据可重用性,应用增量代码提取,并专门针对代码变更引入任务类型特征,突出了其领域优化设计。我们展示了实证结果,证明了CodeFuse-Query在蚂蚁集团大规模真实场景中的鲁棒性、可扩展性和效率,它作为核心静态分析基础设施。在生产环境中部署,CodeFuse-Query每天处理多达100亿行代码,涵盖超过30万个不同的分析任务。CodeFuse-Query已开源。
英文摘要:
Large-scale software development requires dynamic and multifaceted static code analysis that extends beyond the capabilities of traditional tools. Existing tools like CodeQL lack cross-language analysis capabilities and can be time-consuming and resource-intensive. We present CodeFuse-Query, a data system tailored for large-scale code analysis. First, CodeFuse-Query adopts a Logic-Oriented Computation Design, employing Datalog with a two-tiered schema, COREF, to convert source code into data facts, and Godel to express complex analysis tasks in logical terms. Furthermore, CodeFuse-Query adopts a Domain-Optimized System Design. This approach optimizes resource utilization, prioritizes data reusability, applies incremental code extraction, and introduces task-type characteristics specifically for code changes, underscoring its domain-optimized design. We present empirical results demonstrating CodeFuse-Query's robustness, scalability, and efficiency in large-scale real-world scenarios at Ant Group, where it serves as a core static analysis infrastructure. Deployed in production environments, CodeFuse-Query processes up to 10 billion lines of code daily across more than 300,000 distinct analysis tasks. CodeFuse-Query has been open-sourced.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。