Many conditions and branches
info
A PAC with dozens of conditions is slow to read, slow to review and slow to run for default-route traffic. Complexity metrics are reported so the trend can be watched; grouping rules by domain and helper functions keep the file maintainable.
Why it matters
Each condition is evaluated for every connection that is not decided earlier. Beyond a few dozen rules, authors lose track of ordering effects (PAC-C014), duplicates (PAC-C013) and dead code (PAC-E016). The informational finding carries the metrics; the fix is structural: one rule per domain suffix instead of one per host, helper functions per rule group, and proxy-side policy for anything that is not routing.
How to fix
Collapse host lists into domain suffixes, group related rules in helper functions and move non-routing policy to the proxy.
Examples
Bad
function FindProxyForURL(url, host) {
if (host == "a.corp.example") { return "DIRECT"; }
if (host == "b.corp.example") { return "DIRECT"; }
if (host == "c.corp.example") { return "DIRECT"; }
if (host == "d.corp.example") { return "DIRECT"; }
// ... dozens more
return "PROXY proxy.corp.example:8080";
}
Open bad example in checkerGood
function isInternal(host) {
return isPlainHostName(host) || dnsDomainIs(host, ".corp.example");
}
function FindProxyForURL(url, host) {
if (isInternal(host)) {
return "DIRECT";
}
return "PROXY proxy.corp.example:8080";
}
Open good example in checkerRelated rules
- PAC file is large PAC-P006
- Deeply nested conditions PAC-P008
- Branch can never match because an earlier branch covers it PAC-C014