Fork me on GitHub
#clj-kondo
<
2021-09-03
>
Noah Bogart16:09:38

Iā€™m using https://github.com/hyperfiddle/rcf to write some inline tests, and iā€™d like to have :skip-comments also apply to the tests blocks. is that possible?

Noah Bogart16:09:20

oh, nevermind me, this is accomplished by :lint-as

Noah Bogart16:09:27

i had mispelled something šŸ˜¬

Noah Bogart16:09:20

yeah! every day iā€™m pleasantly surprised by how powerful clj-kondo is

Joshua Suskalo16:09:43

Hey @borkdude do you have a recommended way to build graalvm images? The way I did it a while back was cambada, but I don't know if that's really recommended anymore.

borkdude16:09:15

@suskeyhose do you mean for clj-kondo?

Joshua Suskalo16:09:58

clj-kondo does it with that custom compile script I saw. I'm looking to do a graal distribution of the formatter I'm getting started working on though.

borkdude16:09:18

@suskeyhose I recommend doing it like this: https://github.com/borkdude/jayfu As this will work on all platforms

borkdude16:09:28

including windows

borkdude16:09:37

nothing else is needed than bb + graalvm download

borkdude16:09:43

not even the clojure CLI

borkdude16:09:51

and this is quite the pain on Windows CI, the clojure CLI

Joshua Suskalo16:09:59

I'll definitely take a look. In an ideal world here I'd be able to make it a part of my build.clj, but we'll see if that ends up actually being achievable.

borkdude16:09:30

yeah I think you can also do that, but other than building the uberjar I don't think there is any other benefit to build.clj and building the uberjar already works well without build.clj

Joshua Suskalo16:09:55

Yeah, I'm just trying it out for the first time to see how it feels.

borkdude16:09:10

and you'll still need to install the clojure CLI on the three platforms (including Windows) to make that run

borkdude16:09:26

except when you use the bb clojure one of course

Joshua Suskalo16:09:26

Yeah, that's true

borkdude16:09:12

you can do bb clojure -Tbuild foo (or whatever the command for this is)

borkdude16:09:28

the built-in clojure runner is the same as the official Clojure CLI (or at least, it should be)

borkdude16:09:48

but using the bb task runner is faster for things that don't need a clojure process

JonR16:09:16

Hi channel! Wondering if anyone can give me any tips on ignoring function args with clj-kondo? I have found the :exclude-destructured-keys-in-fn-args doc which helps for maps but I'm hoping to find this for normal fn args as well. In particular for multimethods but would be nice to know how to do it system wide too.

Joshua Suskalo17:09:27

What exactly do you mean? Do you mean disabling the :unused-binding warning on function arguments?

Joshua Suskalo17:09:52

In general there are comment forms you can use to disable particular lints for certain forms. Like this:

(defmulti some-multimethod
  (fn #_{:clj-kondo/ignore [:unused-binding]}
      [a b c]
    (keyword a b)))
This won't emit a warning for c being unused.

Joshua Suskalo17:09:42

Also @borkdude is that something we'd want to consider as a lint config in general? Like is there a reasonable way to ignore unused bindings for function arguments that are defmulti dispatch functions in particular?

Joshua Suskalo17:09:18

Since generally you wouldn't want the arglist to report that the name of an arg starts with _, since implementations probably use it.

JonR17:09:17

sorry, just saw this repl. Yes! That is pretty much the issue

JonR17:09:46

I'd like to not have to add inline comments all over but be able to just say for multimethods ignore unused arguments

JonR17:09:10

Which maybe clj-kondo already supports, I just can't find it

Joshua Suskalo17:09:19

The other thing that I'd consider doing in some cases is to include the :arglists metadata on your functions. That one can have whatever you want in it and isn't linted.

Joshua Suskalo17:09:39

Although I don't know if that works on multimethods.

Joshua Suskalo17:09:19

It doesn't support ignoring unused arguments only in multimethods atm. I was just asking borkdude if that was something feasible to be added.

JonR17:09:10

Ah, the :arglists makes sense. That's good to know about

borkdude17:09:01

yeah, I think we should add that option

šŸ™ 2
borkdude18:09:32

You can upvote it by doing a thumbs up

borkdude18:09:17

I proposed a solution there and marked the issue as PR welcome, if anybody wants to have a stab at it.

JonR18:09:06

Oh, I didn't realize the thumbs up is an actual upvote. Do I do that on the initial description?

JonR18:09:27

Done, thanks for sharing the issue

borkdude18:09:31

Github allows you to sort by emoticon, which is weird, but that's their only option currently

JonR18:09:49

hahaha, I didn't know that. Pretty funny

borkdude18:09:52

it's a toy JIRA in this regard, but everybody hates JIRA ;)

JonR18:09:27

I'm in the boat with everybody šŸ™‚ Agreed on GH lacking a bit though. I've been exploring actions for more custom issue and project automation. It's aight

JonR18:09:00

While you're here, random question, do you know of a way in emacs with cider to accept clj-kondo suggestions? In particular removing unused imports? Or if not in emacs a way to do that in a script or something

borkdude18:09:20

@jon693 Oh boy, you are in for a treat, try #lsp

borkdude18:09:56

it builds on the clj-kondo analysis so it knows all about the linting and how to deal with the warnings, you get navigation for free, etc

borkdude18:09:24

The command you need in emacs with lsp-mode is lsp-organize-imports

borkdude18:09:16

@ericdallo can tell you more in #lsp where to start. if you install clojure-lsp then you don't need a separate clj-kondo binary installed

borkdude18:09:33

and you can remove the flycheck stuff

JonR18:09:34

awesome! Thanks so much for this info

ericdallo18:09:24

Hey šŸ‘‹ @jon693 Check https://clojure-lsp.io/features/, any issues/questions, feel free to ask in #lsp :)

JonR18:09:45

Thanks @ericdallo, this looks awesome! Gonna try and dig in later and will circle back if I have questions.

metal 4