PAC-C013 · duplicate-condition

Identical condition appears twice

low · Correctness

The same condition (or the same pattern literal in the same function) occurs more than once. If the first occurrence returns, the second is dead; if it does not, one of them is probably a copy-paste error.

Why it matters

Duplicate conditions arise from copy-paste editing where the pattern was not changed. When both branches return the same value nothing breaks, but the file carries a rule that does nothing and misleads reviewers. When they return different values the second one never wins, which is almost certainly not what the author meant.

How to fix

Remove the duplicate or correct the pattern that was meant to be different.

Examples

Bad

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

Good

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

Related rules