Fork me on GitHub
#clj-kondo
<
2021-10-28
>
pmooser11:10:24

Is there a way to do something like ... have an entry in a file that disables kondo in general for that file ?

borkdude11:10:36

@pmooser you can exclude files globally in .clj-kondo/config.edn as well

pmooser11:10:18

Yeah, I was specifically looking for a way to be able to say in a file "this file is ok!" instead of having to mark that in a central location elsewhere.

borkdude11:10:34

the other option is {:clj-kondo/config {:linters {:unresolved-symbol {:level :off}}}

borkdude11:10:38

in the metadata of your namespace

pmooser11:10:54

I should say thank you, first of all, because this is a pretty neat tool.

pmooser11:10:06

It actually found 3 errors in my production application that we hadn't run across yet.

pmooser11:10:19

Namespace metadata - perfect! Thank you.

pmooser11:10:30

Is there any way to say "don't warn me about things in comment blocks" ?

borkdude11:10:43

yes, {:skip-comments true}

pmooser11:10:55

You are a god among men, borkdude. Thanks.

😆 1
borkdude11:10:19

@pmooser there is also #_:clj-kondo/ignore that you can apply locally before a form, to ignore warnings

👍 1
pmooser11:10:43

The only remaining challenge are a couple macros that the linter gets confused by, and one error that I cannot make sense of because the line number doesn't make sense with the given output. I'm probably doing something to confuse it.

pmooser11:10:17

(to be clear, there's no way for the linter to understand these macros, so that's obviously not a bug)

borkdude11:10:53

@pmooser is the macro syntactically similar to another macro?

borkdude11:10:01

there are a couple of ways to deal with this in clj-kondo

borkdude11:10:18

it's best if you could give me some more info / examples on this

pmooser11:10:07

@borkdude The macro isn't similar enough to be able to say "treat it like this" ... It's a macro that has a couple of arguments that are essentially symbol names to bind things to, so when the linter runs it sees me passing (for example) _ as the name of such an argument and it complains that it is undefined.

pmooser11:10:03

It's very simple:

pmooser11:10:22

(defmacro run-in-lane
  [lane-id state-name & body]
  `(run-function-in-lane ~lane-id
                         (fn [~state-name]
                           ~@body)))

pmooser11:10:29

Ahhh very cool, thanks!

pmooser11:10:36

I have one other question ... let me see.

pmooser11:10:02

I'm seeing an error reported as: Unresolved symbol: reagent and that symbol does not occur on the corresponding reported line. Any tips on how I could debug this ?

borkdude11:10:50

Not sure... if you can make a repro, I could help with this.

pmooser11:10:21

Mmm, pretty challenging ... it's in the middle of a mess of deftypes.

pmooser11:10:53

Interestingly the symbol reagent doesn't even occur in the file, except as part of various reagent symbols etc.

pmooser11:10:12

Maybe someday I can learn to set up kondo in such a way that I can just debug the linter myself, instead of wasting your time with it.

borkdude11:10:47

Well you can check out clj-kondo from git and then use it as a local/repo library and insert some printlns here and there ;)

pmooser11:10:09

Perfect ... I will try to do that.

pmooser11:10:13

Thank you again for this cool project.

borkdude11:10:28

But I would be happy to join you in a call to take a look, especially if you ended up sponsoring my open source eventually :)

pmooser11:10:57

I'd have to get permission from my corporate overlords to even take advantage of your generous offer, but I appreciate it!

borkdude11:10:04

which is not required, just want to communicate that this is a possibility

pmooser11:10:18

Yes, totally fair to provide that reminder!

mynomoto20:10:49

Would be ok if I did some triage on the Github issues? Seems like there are things already solved, at least glancing at them.

borkdude20:10:35

@mynomoto very welcome!

👍 1
pmooser20:10:33

@borkdude It would be nice to be able to distinguish between unused bindings in function arguments versus let blocks, since one of those means you are likely doing unnecessary work, whereas the other might just be a matter of style (I don't always rename all my unused incoming fn args as _ for example).

borkdude20:10:01

It depends. When writing a new function, it's often quite useful to see that you've forgotten to use an argument you expected to be necessary

borkdude20:10:49

But we can split the linter into multiple if there are more people who want this, sure

borkdude20:10:06

or add another config option