PAC-B004 · undocumented-default-route

Default route has no comment

info · Best practice and maintainability

The final unconditional return is the most consequential line in the file; it decides every request no exception matched. A one-line comment stating the intended default ("everything else via the corporate proxy") documents the design and is one of the conditions for an A+ grade.

Why it matters

Readers of a PAC need to know whether “default to proxy” or “default to DIRECT” was a decision or an accident. A comment immediately above the final return answers that and gives reviewers a reference point for every exception above it. It costs one line.

How to fix

Add a comment above the final return, e.g. // default - all other traffic via the corporate proxy.

Examples

Bad

function FindProxyForURL(url, host) {
  if (isPlainHostName(host)) {
    return "DIRECT";
  }
  return "PROXY proxy.corp.example:8080";
}
Open bad example in checker

Good

function FindProxyForURL(url, host) {
  if (isPlainHostName(host)) {
    return "DIRECT";
  }
  // default: everything else goes through the corporate proxy
  return "PROXY proxy.corp.example:8080";
}
Open good example in checker

Related rules