Fork me on GitHub
#clj-kondo
<
2022-08-04
>
bortexz01:08:16

I am trying to make a custom macro to be linted as one in another library, specifically I want a while-let macro in a library to be linted as better-cond.core when-let , I have this on clj-kondo.exports

{:lint-as {bortexz.utils.core/while-let better-cond.core/when-let}}
But can’t make it work, on a third library using bortexz.utils.core , both the exported config.edn ’s appear con .clj-kondo (both better-cond config.edn and utils.core config.edn). When I change to lint as clojure.core/when-let, it works properly and doesn’t complain. Any clue how can I solve this? Thanks!

bortexz08:08:18

On the other hand, better-cond’s export seems to work fine

borkdude09:08:59

This would work if you also include better-cond in your classpath

borkdude09:08:33

If this doesn't work, please create a repro and I'll look into it

bortexz09:08:18

I am requiring better-cond in bortexz.utils.core, and also tried from the library that uses bortexz.utils.core directly instead of transitively, couldn’t make it work (although the better-cond config.edn works fine)

bortexz09:08:00

On it 👍

bortexz08:08:10

Hi @U04V15CAJ were you able to have a look at this? Do you want me to open an issue? specifically, in this file https://github.com/bortexz/kondo-exports-issue-repro/blob/main/src/bortexz/kondo_exports_issue_repro.clj for me using Calva it lints the v as being unresolved symbol in while-let, although in .clj-kondo both of these config.edn exist (exported from their own libraries)

;; bortexz.utils.core
{:lint-as
 {bortexz.utils.core/while-let better-cond.core/when-let
  bortexz.utils.core/while-some better-cond.core/when-some}}

;; better-cond.code
{:hooks
 {:analyze-call
  {better-cond.core/cond better-cond.core/cond-hook
   better-cond.core/defnc better-cond.core/defnc-hook
   better-cond.core/defnc- better-cond.core/defnc-hook
   better-cond.core/if-let better-cond.core/if-let-hook
   better-cond.core/if-some better-cond.core/if-let-hook
   better-cond.core/when-let better-cond.core/when-let-hook
   better-cond.core/when-some better-cond.core/when-let-hook}}}

borkdude09:08:10

Haven't checked, will look now

borkdude09:08:17

I can reproduce the issue. clj-kondo issue welcome

bortexz09:08:33

Thanks, will open an issue

liborio06:08:04

In my project, clj-kondo does not seem to detect invalid arity errors on method calls coming from dependencies that are imported with :local/root in my deps.edn. Do I need to specify something in particular to enable it?

borkdude09:08:01

Dependencies are linted when you provide the classpath. See https://github.com/clj-kondo/clj-kondo/#project-setup

liborio09:08:01

Thanks for the answer 🙏 This solved my issue

Dumch23:08:02

Does anyone has an example of a project, where the same code is reused between sorce code and clj-kondo hook?

Joshua Suskalo15:08:07

That's not really something I'd do without just copying the code. I guess you could like symlink a file into the directory and get it with require, but that severely limits what you can do in that utility file.

Dumch15:08:19

I end up copying the code 🙂 thanks

👍 1