Understanding Weighted Scoring: How Commit Gates Make Decisions
How Weighted Scoring Works
The commit gate uses a sophisticated weighted scoring system to evaluate the overall risk of a commit. Each finding contributes points based on its category and severity, and the total score determines whether a commit should be blocked.
Scoring Weights by Category
Different categories have different weights, reflecting their importance:
- Security Concerns: CRITICAL=5, WARNING=3, INFO=2
- Critical Issues: CRITICAL=4, WARNING=3, INFO=2
- Performance Notes: WARNING=1.5, INFO=0.5
- Suggestions: WARNING=1, INFO=0.5
- Code Quality: WARNING=1, INFO=0.5
- Testing Recommendations: WARNING=0.5, INFO=0.25
Thresholds by Gate Level
Each gate level has a threshold that triggers blocking:
- INFO: Blocks if score ≥ 4.0
- WARNING: Blocks if score ≥ 6.0
- CRITICAL: Blocks if score ≥ 8.0, or any CRITICAL security/issue
Hard-Block Conditions
Certain conditions always trigger blocking, regardless of score:
- Any CRITICAL Security Concern
- High-risk security issues (SQL injection, RCE, etc.)
Understanding the Math
Example: A commit with 1 CRITICAL security issue (5 points) and 2 WARNING code quality issues (2 points) = 7 total points. At WARNING gate level (threshold 6), this would block.
Conclusion
Understanding weighted scoring helps you configure gates effectively and interpret blocking decisions. The system balances different types of issues to provide fair, effective protection.
Ready to configure scoring? Install AI Diff Review and set up your commit gates with understanding of how scoring works.