质量门是管道中的自动化检查,代码必须通过这些检查才能继续进行——包括测试、linting、静态分析、覆盖率阈值和安全扫描。它们自动执行质量标准,防止不达标的代码向生产环境推进。
什么是质量门
A QUALITY GATE is an automated CHECK that code must PASS to advance in the pipeline:
→ if the check fails, the pipeline STOPS (code doesn't merge/deploy)
→ enforces standards AUTOMATICALLY and consistently (not relying on humans to remember)
→ "Code must meet these standards to proceed" — automated, objective gates.
常见的质量检查
✓ TESTS — automated tests must pass (the primary gate)
✓ LINTING — code style/format consistency (ESLint, Prettier, etc.)
✓ STATIC ANALYSIS — detect bugs, code smells, complexity (SonarQube, etc.)
✓ CODE COVERAGE — require a minimum test coverage threshold (e.g. ≥80%)
✓ SECURITY SCANS — dependency vulnerabilities (SCA), code (SAST), secrets detection
✓ BUILD must succeed; type checking (TypeScript, etc.)
✓ Sometimes: performance budgets, bundle size limits, accessibility checks
