Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CCleanNS removes used dependencies #30

Open
nimaai opened this issue Jul 16, 2018 · 2 comments
Open

CCleanNS removes used dependencies #30

nimaai opened this issue Jul 16, 2018 · 2 comments

Comments

@nimaai
Copy link

nimaai commented Jul 16, 2018

Hi,

I think CCleanNS has a bug. When applied to the following test file:

(ns clean-ns.reproduce-issue
  (:refer-clojure :exclude [str keyword])
  (:require [leihs.procurement.utils.core :refer [keyword str presence]])
  (:require
    [bidi.bidi :as bidi]))

(defn wrap-resolve-handler
  ([handler] (fn [request] (wrap-resolve-handler handler request)))
  ([handler request]
   (let [path (or (-> request
                      :path-info
                      presence)
                  (-> request
                      :uri
                      presence))
         {route-params :route-params, handler-key :handler}
           (bidi/match-pair paths {:remainder path, :route paths})
         handler-fn (handler-resolver handler-key)]
     (handler (assoc request
                :route-params route-params
                :handler-key handler-key
                :handler handler-fn)))))

The result is:

(ns clean-ns.reproduce-issue
  (:refer-clojure :exclude [str keyword])
  (:require [leihs.procurement.utils.core :refer [presence]]))

(defn wrap-resolve-handler
  ([handler] (fn [request] (wrap-resolve-handler handler request)))
  ([handler request]
   (let [path (or (-> request
                      :path-info
                      presence)
                  (-> request
                      :uri
                      presence))
         {route-params :route-params, handler-key :handler}
           (bidi/match-pair paths {:remainder path, :route paths})
         handler-fn (handler-resolver handler-key)]
     (handler (assoc request
                :route-params route-params
                :handler-key handler-key
                :handler handler-fn)))))

[bidi.bidi :as bidi] was removed but is used in (bidi/match-pair paths {:remainder path, :route paths}).

I have observed this behaviour in several files and in several required dependencies.

Thanks,
Matus

@SevereOverfl0w
Copy link
Member

SevereOverfl0w commented Jul 16, 2018

Does it only happen when there's multiple :require blocks? What does refactor.el do in the same case?

Are multiple :require common in your codebase? I've never encountered them.

@nimaai
Copy link
Author

nimaai commented Jul 16, 2018

Does it only happen when there's multiple :require blocks?

Yes, it seems so. I could confirm it with another file.

What does refactor.el do in the same case?

I don't know. I am not an emacs user. Could you try it?

Are multiple :require common in your codebase?

Yes, it seems. Without particular reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants