Squiggly doesn't respect eastwood config specified in :env map
Closed this issue · 4 comments
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]}}"
I can't reproduce this. In particular,
user=> (type (squiggly-clojure.core/env 'user))
clojure.lang.PersistentArrayMap
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.
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.