Fork me on GitHub
#clj-kondo
<
2022-02-12
>
Sam Ritchie00:02:44

potentially silly Q - if I have a dependency like https://github.com/gfredericks/test.chuck that has its own clj-config in it, how can I get clj-kondo to see that dependency? I’ve bumped the dep in project.clj;

Sam Ritchie00:02:27

but I also have a deps edn so I suspect kondo is looking there. but under what alias?

Sam Ritchie00:02:40

(since I don’t want to declare this as a dependency that others have to pull when they pull the library)

dorab01:02:38

I think you might be able to generate an appropriate classpath for clj-kondo by using the appropriate deps. (Don't know or sure. Just suggesting avenues to look at).

Sam Ritchie01:02:05

for sure, that is what I was counting on, I am just not sure how clj-kondo is building its classpath…

dorab01:02:12

The example command in the section of the documentation is $ clj-kondo --copy-configs --dependencies --lint "$(clojure -Spath)". So, I'm guessing that the classpath is actually generated by "$(clojure -Spath)" and you could change that to "$(clojure -Spath -A:test)"

dorab01:02:57

On second thoughts, I'm not sure I'm answering the question you are asking. Sorry.

borkdude09:02:06

Indeed, @U0AT6MBUL’s correct

🙏 1
Sam Ritchie05:02:36

Is it possible to emit a binding form like (let [x 'x y 'y z 'z] …) from a hook… but to suppress any unused binding warnings with metadata applied inside the hook?

Sam Ritchie05:02:02

I have a macro that expands calls like this:

(let-coordinates [[x y z] m/R3-rect
                  [x0 y0] m/R2-rect]
  (+ x y z))
into this (the actual macro does more with the values of course):
(let [R3-rect (quote R3-rect)
      R2-rect (quote R2-rect)
      x (quote x)
      y (quote y)
      z (quote z)
      x0 (quote x0)
      y0 (quote y0)
      d:dx (quote d:dx)
      d:dy (quote d:dy)
      d:dz (quote d:dz)
      d:dx0 (quote d:dx0)
      d:dy0 (quote d:dy0)
      dx (quote dx)
      dy (quote dy)
      dz (quote dz)
      dx0 (quote dx0)
      dy0 (quote dy0)]
  (+ x y z))
the idea is that all of these symbols will be bound and available inside of the binding, but if they’re not used, no problem. I am seeing lots of warnings like
src/sicmutils/calculus/coordinate.cljc::: warning: unused binding R2-rect
src/sicmutils/calculus/coordinate.cljc::: warning: unused binding d:dy0
src/sicmutils/calculus/coordinate.cljc::: warning: unused binding dy0
src/sicmutils/calculus/coordinate.cljc::: warning: unused binding d:dx

Sam Ritchie05:02:03

so ideally I would suppress all of them, or maybe all except the ones that appear in the initial form like x y z x0 y0… but the linted version is still quite useful, since inside the body d:dt etc will not show up as unresolved symbols

borkdude07:02:48

Yes, just use the bindings once in the body

Sam Ritchie07:02:56

ah! nice, so just emit the full list of them in a vector, for example?

Sam Ritchie07:02:14

worked great!