Fork me on GitHub
#clj-kondo
<
2021-06-25
>
dharrigan07:06:35

I have an interesting one. I'm working on a project that has something like this (sql/defsql "filetoload.sql" :as q)

dharrigan07:06:22

the sql/defsql is a defmacro that uses hugsql. I've read the helpful tips about hugsql on the wiki, but in this case it doesn't apply, since...

dharrigan07:06:58

the macro does this (in its internals) (alias '~alias query-namespace#) where the alias is the q above.

dharrigan07:06:09

so, in the namespace, I get this:

dharrigan07:06:44

(a moment, just editing file)

dharrigan07:06:33

So, the q is defined in the namespace as an alias. It is then used in that namespace as q/some-hugsql-thingie, but clj-kondo doesn't know anything about it.

dharrigan07:06:08

I've put up an example here

borkdude07:06:17

I didn't even know hugsql could do this

dharrigan07:06:51

I think it's more the project I'm working on, and the way they've done it, rather than hugsql 🙂

dharrigan07:06:00

but yeah....I hear you

borkdude07:06:02

but I think you could write a hook for this, shouldn't be too hard

dharrigan07:06:04

I'll see if I can get some time to think about how to do it

borkdude07:06:20

or perhaps you could put (comment (alias 'q ...)) in there, so clj-kondo thinks there is an alias q, but this would be a workaround