Fork me on GitHub
#clj-kondo
<
2020-04-01
>
Jakob Durstberger07:04:18

Morning, I’ve raised above mentioned PR. I don’t quite understand why (get-in (from-cache-1 nil :clj 'clojure.core) ['defn]) would be a false positive? Also now I am not sure if I should comment here or on the PR 😄

borkdude07:04:06

@jakob.durstberger Sorry, that was a false false positive 🙂

👍 4
borkdude07:04:59

@jakob.durstberger As for the suggestion: use (:foo ...) or (get x :foo) instead: maybe we shouldn't be doing that, since that may be stretching it: there are often multiple ways to get something out of something

Jakob Durstberger07:04:38

Yeah, I think it leads down a brittle path as we would also have to add suggestions for assoc-in and update-in.

Jakob Durstberger07:04:18

I am currently looking into adding those. About it being on or off by default. I have no strong opinions. Another option would be to make it :info instead of :warning

borkdude07:04:55

I'd say turn it off by default. Document it in config.md under optional linters.

Jakob Durstberger08:04:36

Sounds good to me

borkdude09:04:08

@jakob.durstberger Made 3 small remarks to the code.

Jakob Durstberger09:04:35

Awesome, thank you. I’ll address these later today

Jakob Durstberger09:04:16

And I also just realised that I haven’t added the linter to the docs yet

chadhs10:04:40

does anyone have tips for slingshot and it’s try+ macro? getting errors on unknown symbols

borkdude10:04:11

so something like {:linters {:unresolved-symbol {:exclude [(slingshot/try+)]}}}

chadhs10:04:27

{:linters {:unresolved-symbol {:exclude [(slingshot.slingshot/try+)]}}} this did the trick 🙂

chadhs11:04:03

i didn’t want to do that wholesale, but being able to target just one function is perfecto 👌

chadhs11:04:37

thanks @borkdude (btw, watched your recent talk on clj-kondo; well done!)

Jakob Durstberger12:04:39

Do you have a link to that?

borkdude11:04:06

thanks 🙂

nate22:04:51

I noticed that there is a :exclude-destructured-keys-in-fn-args to tweak the behavior of :unused-bindings, would you be amenable to adding a :exclude-fn-args that would not report on fn args at all?

borkdude22:04:45

@nate in that case you can just start your fn args with an underscore

nate22:04:32

the underscores are not popular, unfortunately (among the others that also work on the codebase I'm hacking on)

seancorfield22:04:03

_foo is idiomatic Clojure for "this is not used" so maybe an opportunity to "educate" the others? 🙂

nate22:04:43

I will try

bfabry22:04:15

it's also idiomatic python and ruby

bfabry22:04:22

so the education will be multi-use!

bfabry22:04:10

I had to satisfy pylint for this just yesterday

borkdude13:04:42

@nate You can slap your colleagues around the head with the Clojure style guide: https://guide.clojure.style/#underscore-for-unused-bindings

nate14:04:22

Hahaha. Thanks for the link. Unfortunately, they are remote from me, so I'll have to ask them to print out a copy and slap themselves.

😆 8
seancorfield22:04:38

If I configure

:lint-as {expectations.clojure.test/defexpect clojure.test/deftest}
I would not expect to get a "missing docstring" warning on (defexpect foo ...) because I don't get that warning on (deftest foo ...) -- am I misunderstanding how "alike" the :lint-as makes things?

nate22:04:03

was hoping to be able to configure clj-kondo to still help me with my unused let bindings, perhaps a :only-let modifier then

nate22:04:04

ok, thank you

borkdude22:04:20

@seancorfield That could be an issue in the missing docstring linter.

borkdude22:04:16

Feel free to post an issue about it and I'll take a look at it later.

borkdude22:04:22

Off to bed now

seancorfield22:04:32

Oh, so it doesn't respect :lint-as relationships at all... fair enough.

borkdude22:04:47

yeah, lint as is more or less "analyze it with the syntax of this other thing", but it's a bit ambigious if we should treat everything in the linting as that other thing maybe

borkdude22:04:26

I guess it makes sense in the context of the missing docstring linter to treat it as a test and skip the warning

seancorfield22:04:53

When I get time, I'll see if there are other "special cases" where this sort of thing might crop up. Perhaps some sort of generic "symbol should be treated like one of these (set of symbols)" machinery can be added that would make this sort of thing easier in future...

seancorfield14:04:26

That is cheating! And it also means that any regular function with :test Metadata will not get checked for a doc string.

borkdude14:04:13

right, that may not be optimal

borkdude14:04:41

I hadn't thought of the case that some people use :test metadata on their regular functions, but some do

borkdude15:04:12

I'll put the issue in progress again

seancorfield15:04:13

Using with-test or simply adding :test metadata is more common than I thought -- it has cropped up in several discussions here around testing and REPL-driven development recently 😸

borkdude15:04:48

it's still trivial to fix, I'll make sure to do it before the next release

borkdude16:04:55

Pushed another one

seancorfield17:04:44

Nice! Thank you!