clj-commons / kibit

There's a function for that!
1.77k stars 135 forks source link

Cleaning up ns clauses #25

Closed tsdh closed 12 years ago

tsdh commented 12 years ago

It would be awesome, if kibit could support the programmer with cleaning up (ns ...) declarations. By that I mean the following:

  1. Suggest removing unused but :import-ed classes.
  2. Suggest removing unused but :require-ed or :use-d namespaces.
  3. Suggest removing unused vars in the :only clause of :use.
  4. If a namespace is required with alias (e.g., (:require [foo.bar.baz :as fbb])), suggest replacing fully qualified var accesses like foo.bar.baz/some-var with fbb/some-var.
  5. If a class is imported, suggest replacing fully qualified accesses with non-qualified ones.

Is that doable with kibit?

jonase commented 12 years ago

On Mon, Mar 26, 2012 at 6:47 PM, Tassilo Horn reply@reply.github.com wrote:

It would be awesome, if kibit could support the programmer with cleaning up (ns ...) declarations.  By that I mean the following:

  1. Suggest removing unused but  :import-ed classes.
  2. Suggest removing unused but :require-ed or :use-d namespaces.
  3. Suggest removing unused vars in the :only clause of :use.
  4. If a namespace is required with alias (e.g.,  (:require [foo.bar.baz :as fbb])), suggest replacing fully qualified var accesses like foo.bar.baz/some-var with fbb/some-var.
  5. If a class is imported, suggest replacing fully qualified accesses with non-qualified ones.

Is that doable with kibit?

I guess everything is doable but it's not the current focus which is to simplify expressions. I think that this kind of analysis is better achieved with something like analyze[1] by @frenchy64. I've done some experimental work with it here[2].

[1] https://github.com/frenchy64/analyze [2] https://github.com/jonase/eastwood

Jonas


Reply to this email directly or view it on GitHub: https://github.com/jonase/kibit/issues/25

itegebo commented 12 years ago

It also seems like slamhound[1] is applicable.

[1] https://github.com/technomancy/slamhound

tsdh commented 12 years ago

Thanks for the suggestions. It seems, slamhound is exactly what I've been looking for.