technomancy / slamhound

Slamhound rips your namespace form apart and reconstructs it.
Other
473 stars 38 forks source link

Removes require with no alias #71

Closed seancorfield closed 10 years ago

seancorfield commented 10 years ago

If a namespace is required (with no alias or refer etc) and used in a fully-qualified way to reference Vars, Slamhound still removes it.

Example:

(ns slamtest.core
  (:require [slamtest.aux]))

(defn foo [x]
    (slamtest.aux/helper x))

After Slamhound:

(ns slamtest.core)

(defn foo [x]
    (slamtest.aux/helper x))

This won't work since slamtest/aux is not loaded before it referenced.

I initially ran into this with a private function being used via full qualification but tested locally and repro'd with both private and public functions.

guns commented 10 years ago

Unfortunately, this is not something Slamhound can fix until we switch to a static analyzer (maybe):

https://github.com/technomancy/slamhound#fully-qualified-and-dynamically-resolved-vars

ATM I work around this by always using an alias. Sorry, but thanks for the report!

seancorfield commented 10 years ago

Fair enough. I'll update our code. I think we only do this in one place, maybe two.