technomancy / slamhound

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

Make slamhound work for GET #7

Closed amalloy closed 13 years ago

amalloy commented 13 years ago

Make failure-type return a list of possible fixes, so that regrow can try them all before failing, rather than having failure-details throw an exception if a fix doesn't work.

amalloy commented 13 years ago

Added improved grouping for :use statements while I was waiting for you to pull. See https://gist.github.com/951227 for an example in action.

technomancy commented 13 years ago

The first commit looks good. It might be nice to split the double if-let out into its own function though. I'm not too sold on the second; I do prefer the full namespace to be visible on each :use line for greppability purposes.

amalloy commented 13 years ago

I don't think I've ever wanted to grep for a namespace declaration. I guess the "reduced size of ns form" doesn't matter as much when (a) each ns has an :only clause (so you can't just slam a bunch of namespaces on each line), and (b) slamhound writes the whole thing for you. But it seems to me that it's more readable, and more user-friendly if not everyone on a project uses slamhound. Say I fix all the (currently pretty awful) 4clojure namespace declarations with slamhound. The next guy to add a new file has three choices:

I don't like any of those choices; do you recommend something better?

technomancy commented 13 years ago

Write all those tediously verbose fully-qualified namespaces himself to conform with the rest of the project

It's really not tedious when you have completion available. Even naieve "whatever else is in this file" completion is helpful for something like that.

It's likely that a future ns overhaul will remove the prefix support according to the first comment on http://dev.clojure.org/jira/browse/CLJ-272 for the same reasons, so I would rather go with that.