This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-15
Channels
- # aws (25)
- # babashka (2)
- # babashka-sci-dev (3)
- # beginners (39)
- # clj-kondo (69)
- # cljdoc (2)
- # clojars (6)
- # clojure (13)
- # clojure-dev (8)
- # clojure-europe (3)
- # clojure-uk (1)
- # clojurescript (6)
- # datomic (3)
- # honeysql (5)
- # introduce-yourself (3)
- # lsp (10)
- # malli (8)
- # membrane (16)
- # off-topic (8)
- # pedestal (6)
- # re-frame (28)
- # releases (3)
- # shadow-cljs (10)
- # tools-deps (38)
I'm looking to add a linter for a macro proxy+
- https://github.com/redplanetlabs/proxy-plus .
The macro is used to extend java abstract classes.
Any hints on how to approach this ?
Where can I publish the linting so it's usable by other people when it's done?
Sample code:
https://github.com/ieugen/ofbiz-tooling-ro/blob/main/development/src/dev/schema.clj
There is also this https://github.com/redplanetlabs/proxy-plus/issues/14
Seems lint-as works in getting rid of the warnings - will see how this behaves in the future:
(ns dev.schema
{:clj-kondo/config '{:lint-as {com.rpl.proxy-plus/proxy+ clojure.core/proxy}}}
Is there a rule for unused this
in reify ?
I would like to ignore them.
Perhaps I can use _
this is just a convention, you can call it whatever
@eugen.stan you can start any name with an underscore, like _this to get it ignored
There is an issue about an option for ignoring the self referring local automatically, feel free to upvote
thanks. I will check it out. lint-as for proxy+ does not work that great. hides errors for undefined symbols inside the construct. any hints on how should I go by implementing linting for this? it'similar to reify and proxy, I could not find how those are implemented though
@eugen.stan You can support any macro by writing a hook for it. The :macroexpand
hook is the easiest as you can just place a simplified macro in your config.
thanks, the difficult part IMO is that it references methods from classes and interfaces and that could be anything
so a lint-as reify might work for each case where it's implementing an interface or class
$ clj-kondo --lint development/src/dev/schema.clj
development/src/dev/schema.clj:151:24: warning: unused binding parent-schema
development/src/dev/schema.clj:151:46: warning: unused binding name
development/src/dev/schema.clj:151:56: warning: unused binding operand
linting took 59ms, errors: 0, warnings: 3
yes, but if I change line 124 to len (- (count undefined-symbol) 1)
and run linting I get the same errors as above
that is inside reify org.apache.calcite.linq4j.Enumerator
of enumerator
method of proxy+ AbstractEnumerable
I changed that, but I don't see an error. Are you sure this error is coming from clj-kondo and not from some other tool?
Yes, this is not an issue with your config, it's an incompleteness in clj-kondo which can be improved. Proxy is one of the few things that I kept postponing to support fully ;)
Feel free to post an issue. You can reproduce this with normal clojure proxy as well
the issue is here https://github.com/clj-kondo/clj-kondo/issues/1544
I've notived reify and proxy are quite different IMO - since they work with classes and interfaces and introduce a lot of symbols. Are there building blocks in clj-kondo for dealing with that?
thanks, I'll probably take a look this week. btw, cool stuff with nbb. I did a bit of work on https://github.com/titonbarua/shadow-cljs-gjs-target . Maybe I will have some time to continue and have something similar for Gnome desktop - uses gjs
Oh, that's cool :) There is #nbb but also #obb which is for macOS JXA which I believe is similar to the Gnome stuff, maybe
multitasking is hard. now that I have windows + WSL2 + wslg I can easily try this gjs stuff out I think
what's the status of gnome? isn't it a bit old/deprecated in favor of other stuff in the coming years? or it's not going away soon?
anyway, feel free to experiment with obb -> gbb and perhaps it can join the babashka org if you think it's a useful thing :)
I heard gnome plugins are quite notorious in that they are single threaded and can crash gnome?
Wayland is getting some traction to replace ancient http://X.org
Gnome 40 came out last year and they promissed they are taking more care of plugin compatibility and stability
perhaps https://www.npmjs.com/package/node-gtk can also be used with #nbb already, or something else on node
ok, but it's good to hear gnome is not going anyway, then gbb might be a good idea :)
Quick follow-up bugfix release to the previous one: clj-kondo 2022.01.15 • Fix https://github.com/clj-kondo/clj-kondo/issues/1537: stackoverflow with potemkin import vars with cyclic references • Fix https://github.com/clj-kondo/clj-kondo/issues/1545: `recur` in `cond->` gives warning about `recur` not in tail position. • Fix https://github.com/clj-kondo/clj-kondo/issues/1535: support CLJS vars / protocols references via dot rather than slash.