clj-kondo

https://github.com/clj-kondo/clj-kondo
nikolavojicic 2021-06-29T13:49:23.290400Z

(alias 'sn (create-ns 'some-namespace))
::sn/foo ;=> :some-namespace/foo
... Unresolved namespace sn. Are you missing a require?

nikolavojicic 2021-06-29T13:50:52.291600Z

How to avoid this warning? Note: there is no file some_namespace.clj so I can't require it.

borkdude 2021-06-29T13:51:51.292Z

(alias 'sn (create-ns 'some-namespace))
::sn/foo ;; false positive
sn/foo ;; works
yes, this seems a bug, feel free to post an issue

👍 1
borkdude 2021-06-29T13:52:43.292500Z

ah no, I was fooled, clj-kondo only reports the first occurrence of the unresolved namespace

borkdude 2021-06-29T13:53:07.292800Z

this does seem to work:

(alias 'sn 'foo #_(create-ns 'some-namespace))
::sn/foo

borkdude 2021-06-29T13:53:29.293100Z

this could be improved though, so issue still welcome

borkdude 2021-06-29T13:53:52.293300Z

for now you could write:

(create-ns 'foo)
(alias 'sn 'foo)
::sn/foo

nikolavojicic 2021-06-29T13:55:36.294100Z

Ok, I will post an issue. Thx for workaround.

2021-06-29T22:20:18.294600Z

Are there any common causes for unsupported binding form errors to occur in code generated by hooks?

borkdude 2021-06-29T22:20:59.295300Z

@suskeyhose it's usually best to just print the node to see what it looks like

2021-06-29T22:21:06.295500Z

Like right now I'm just putting a symbol into a vector used in an argument list to a fn

2021-06-29T22:21:13.295800Z

Yeah, I'm printing the node, and it looks fine

2021-06-29T22:21:58.296300Z

<list: (fn [] (fn [field value second item timestamp] [field value second item timestamp] [second field] {:type :http :method :get :body {:field field :value value :timestamp timestam}} ()))>

2021-06-29T22:22:02.296500Z

This is what's being generated

2021-06-29T22:22:23.296900Z

And it's saying timestamp is an unsupported binding form.

2021-06-29T22:22:46.297100Z

Oh, I think I might know

2021-06-29T22:22:53.297400Z

I forgot to turn the symbol into a token node

borkdude 2021-06-29T22:23:02.297700Z

right, that's a common thing

2021-06-29T22:23:07.297900Z

yup, that was it