clojure-emacs / squiggly-clojure

Flycheck checker for Clojure, using eastwood and core.typed.
GNU General Public License v3.0
204 stars 25 forks source link

Squiggly doesn't respect eastwood config specified in :env map #49

Closed OlegTheCat closed 7 years ago

OlegTheCat commented 7 years ago

I have the following config in my profiles.clj:

{:user {...
        :env {:squiggly {:eastwood-options
                         {:exclude-linters [:constant-test]
                          :add-linters [:unused-private-vars
                                        :unused-locals
                                        :unused-fn-args]}}}}}

and when launching squiggly with cider :constant-test linter is still being executed and linters specified in :add-linters are not.

After performing some investigation it seems that problem may be that environ stores value behind some key as a raw string. See the following:

user> (squiggly-clojure.core/env 'my.namespace)
;;  thanks for pretty-print, cider
{:eastwood-options {:exclude-linters [:constant-test], :add-linters [:unused-private-vars :unused-locals :unused-fn-args]}}
user> (:eastwood-options (squiggly-clojure.core/env 'my.namespace))
nil
user> (type (squiggly-clojure.core/env 'my.namespace))
java.lang.String

When pretty-printing in repl is disabled the output is the following:

user> (squiggly-clojure.core/env 'my.namespace)
"{:eastwood-options {:exclude-linters [:constant-test], :add-linters [:unused-private-vars :unused-locals :unused-fn-args]}}"
pnf commented 7 years ago

I can't reproduce this. In particular,

user=> (type (squiggly-clojure.core/env 'user))
clojure.lang.PersistentArrayMap
OlegTheCat commented 7 years ago

Turns out, it can be reproduced only with environ 1.0.2+ (actually I'm using 1.1.0 version). Starting from 1.0.2 environ is coercing non-string values to strings.

OlegTheCat commented 7 years ago

Can we come up with workaround on this? Like, applying clojure.edn/read-string to values of env map in case those are strings? I can prepare a PR, if it sounds good to you.

pnf commented 7 years ago

Yes, that would be great.

On Mar 24, 2017, at 10:45 AM, Oleh Palianytsia notifications@github.com wrote:

Can we come up with workaround on this? Like, applying clojure.edn/read-string to values of env map in case those are strings? I can prepare a PR, if it sounds good to you.

― You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.