# Identical condition appears twice

Source: https://findproxyforurl.net/rules/duplicate-condition/ · last updated 2026-10-04

Rule PAC-C013 (`duplicate-condition`), severity low, category: 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.

## Bad

```js
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";
}
```

## Good

```js
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";
}
```
