technomancy/slamhound — pull request #41 by guns (2013-06-06 00:37:02+00:00)
Title: Fix var conflicts among different namespaces with improved :require-as matching

Hello,

This branch fixes an issue where slamhound chooses the wrong :require-as libspec when two namespaces contain the same var:

```clojure
;; alpha/beta.clj
(ns alpha.beta)

(defn hello [])

;; alpha/gamma.clj
(ns alpha.gamma)

(defn hello [])

;; alpha/core.clj
(ns alpha.core
(:require [alpha.beta :as beta]
[alpha.gamma :as gamma]))

(beta/hello)
(gamma/hello)
```

Running slamhound on alpha/core.clj produces the erroneous ns form:

```clojure
(ns alpha.core
(:require [alpha.beta :as beta]
[alpha.beta :as gamma]))
```

This is due to `in-originals-pred` erroneously returning a true value for the candidate `[alpha.beta :as gamma]` with the original requires above.

Matching the full candidate against a regular set of fully qualified symbols and libspecs avoids this error, assuming the candidate is a regular, fully qualified libspec itself.

The commit messages go into a little more detail if this is a bit unclear.

This branch also addresses issue #35, at least @kenrestivo's second comment about slamhound not respecting the original requires. I couldn't reproduce his initial example.

Please tell me if you would like me to squash the branch into a single commit or if you would like to see any changes.

Cheers,
Sung Pae