静态分析:在不运行程序的情况下,对源代码或中间表示进行检查与推断,以发现潜在错误、安全漏洞、代码异味(可维护性问题)或验证某些性质(如类型、变量使用、控制流等)。常见于编译器、IDE、代码扫描工具与 CI 流水线中。
/ˈstætɪk əˈnæləsɪs/
Static analysis found a bug before we ran the program.
静态分析在我们运行程序之前就发现了一个漏洞。
By integrating static analysis into the CI pipeline, the team reduced security issues and enforced consistent coding standards across the codebase.
通过把静态分析集成到 CI 流水线中,团队减少了安全问题,并在整个代码库中统一了编码规范。
static 来自希腊语 statikos(“使……站立的、静止的”),强调“在静止状态下”。analysis 源自希腊语 analyein(“分解、拆开”),引申为“分析”。合起来,“static analysis”字面意思就是“在不让程序动起来(不执行)的前提下,把代码拆开来检查与推断”。