Empty block
low
An if, else or catch with an empty body is usually an unfinished edit. The condition is still evaluated (possibly a DNS lookup) and the reader has to guess what was intended.
Why it matters
if (dnsDomainIs(host, ".partner.example")) { } costs the evaluation and does nothing; an
empty catch (e) { } swallows errors silently, which in a PAC means the request continues
to whatever follows. Both are signs of a half-done change.
How to fix
Complete the branch with a return or delete it.
Examples
Bad
function FindProxyForURL(url, host) {
if (dnsDomainIs(host, ".partner.example")) {
}
return "PROXY proxy.corp.example:8080";
}
Open bad example in checkerGood
function FindProxyForURL(url, host) {
if (dnsDomainIs(host, ".partner.example")) {
return "PROXY partner-proxy.corp.example:8080";
}
return "PROXY proxy.corp.example:8080";
}
Open good example in checkerRelated rules
- Condition is a constant PAC-C017
- Exceptions are caught and turned into DIRECT PAC-X011