PAC-B003 · unused-code

Unused functions or variables

low · Best practice and maintainability

Helper functions and variables that nothing references are leftovers from earlier versions. They are harmless to the engine but mislead reviewers and hide the rules that actually run.

Why it matters

PAC files accumulate: an old proxy string kept “just in case”, a helper that was replaced by an inline check, a list that no longer feeds any rule. Each unused item costs review time and can be mistaken for an active rule. Helper functions that are called from FindProxyForURL are fine and often improve readability; only unreferenced ones are reported.

How to fix

Delete unused declarations; keep history in version control, not in the file.

Examples

Bad

var OLD_PROXY = "PROXY old-proxy.corp.example:8080";
function isLab(host) {
  return dnsDomainIs(host, ".lab.example");
}
function FindProxyForURL(url, host) {
  if (dnsDomainIs(host, ".corp.example")) {
    return "DIRECT";
  }
  return "PROXY proxy.corp.example:8080";
}
Open bad example in checker

Good

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

Related rules