Fork me on GitHub
#clj-kondo
<
2021-12-16
>
Jordan Robinson13:12:41

Hey all, on the project I'm currently working on there is both clj-kondo as well as kibit. I was wondering if the linters in clj-kondo are actually a superset of the checks in kibit and if we're getting any benefit from running both, as I'd rather just run clj-kondo Does anyone know if this is the case or can point me in the direction of how to figure it out?

borkdude13:12:44

I haven't used kibit that much, so I'll defer to the rest of this room

šŸ‘ 1
Jordan Robinson13:12:22

if it helps for context, kibit suggests more idiomatic forms, e.g. if you're testing for (= 0 x) it will recommend (zero? x) (as seen here: https://github.com/jonase/kibit/blob/master/kibit/src/kibit/rules/equality.clj)

wilkerlucio14:12:03

hello :) about using Kondo and Meander, how can I tell Kondo to ignore the body from the Meander functions like m/find and m/search? currently I'm doing #_ :clj-kondo/ignore on each form, is there a way to just tell Kondo to ignore the content under these functions?

borkdude14:12:43

@wilkerlucio is this for unresolved symbols?

borkdude14:12:16

if so then {:linters {:unresolved-symbol {:exclude [(meander.foo/find)]}}}

borkdude14:12:04

you could also write a hook which quotes the question-marked symbols

borkdude14:12:16

or quotes the entire argument

wilkerlucio14:12:50

nice, a cooworker of mine said he may try to tackle this via hooks šŸ™‚

wilkerlucio14:12:23

@borkdude one thing though, now I'm getting errors though warning: Unresolved var: m/app, I tried to do the same with :unresolved-var linter, but they are not going away

borkdude14:12:03

what is m/app?

wilkerlucio14:12:11

ah, got it now, its a pointer to meander, somehow wasn't finding, but I realize now the exclusion list must be about those names

wilkerlucio14:12:28

this is the config that's working for me:

:unresolved-symbol {:exclude [(meander.epsilon/find)
                                               (meander.epsilon/search)
                                               (meander.epsilon/rewrite)]}
                 :unresolved-var    {:exclude [meander.epsilon/app
                                               meander.epsilon/scan
                                               meander.epsilon/and
                                               meander.epsilon/or
                                               meander.epsilon/pred]}

wilkerlucio15:12:18

those are defined using defsyntax macro, which looks like a fn, but for some reason when I tried now to meander.epsilon/defsyntax clojure.core/defn, it doesn't fix the issue

wilkerlucio15:12:49

and now we are zero days without having a caching issue šŸ˜…

borkdude15:12:30

you need to re-lint your deps with this config

borkdude21:12:29

clj-kondoĀ 2021.12.16 A pretty big release with several new linters, options and improvements! New ā€¢ Automatically load configurations fromĀ `.clj-kondo///config.edn`. This can be disabled withĀ `:auto-load-configs false`.Ā https://github.com/clj-kondo/clj-kondo/issues/1492 ā€¢ Add linterĀ `:duplicate-case-test-constant`: detect duplicate case test constants. SeeĀ https://github.com/clj-kondo/clj-kondo/blob/master/doc/linters.md#duplicate-case-test-constant.Ā https://github.com/clj-kondo/clj-kondo/issues/587Ā (https://github.com/mknoszlig) ā€¢ Add linterĀ `:unexpected-recur`: warn onĀ `recur`Ā in unexpected (non-tail) position.Ā https://github.com/clj-kondo/clj-kondo/issues/1126 ā€¢ Add linterĀ `:used-underscored-binding`: warn on used bindings that start with underscore. Disabled by default. SeeĀ https://github.com/clj-kondo/clj-kondo/blob/master/doc/linters.md#used-underscored-bindings.Ā https://github.com/clj-kondo/clj-kondo/issues/1149Ā (https://github.com/mknoszlig) ā€¢ Add linterĀ `:docstring-blank`Ā for checking empty docstring. SeeĀ https://github.com/clj-kondo/clj-kondo/blob/master/doc/linters.md#docstring-blank.Ā https://github.com/clj-kondo/clj-kondo/issues/805Ā (https://github.com/joodie) ā€¢ Add linterĀ `:docstring-leading-trailing-whitespace`Ā for checking leading and trailing whitespace in docstring. Disabled by default. SeeĀ https://github.com/clj-kondo/clj-kondo/blob/master/doc/linters.md#docstring-leading-trailing-whitespace.Ā https://github.com/clj-kondo/clj-kondo/issues/805Ā (https://github.com/joodie) ā€¢ Add linterĀ `:docstring-no-summary`Ā for checking the absence of summary of args in docstring. Disabled by default. SeeĀ https://github.com/clj-kondo/clj-kondo/blob/master/doc/linters.md#docstring-no-summary.Ā https://github.com/clj-kondo/clj-kondo/issues/805Ā (https://github.com/joodie) ā€¢ AddĀ `:exclude-defmulti-args`Ā option forĀ `:unused-bindings`Ā linter. SeeĀ https://github.com/clj-kondo/clj-kondo/blob/master/doc/linters.md.Ā https://github.com/clj-kondo/clj-kondo/issues/1188Ā (https://github.com/mknoszlig) ā€¢ SupportĀ `:config-in-comment`Ā https://github.com/clj-kondo/clj-kondo/issues/1473. SeeĀ https://github.com/clj-kondo/clj-kondo/blob/master/doc/config.md#override-config-in-comment-forms. Enhanced ā€¢ Bump built-in cache for clojure 1.11.0-alpha3 andĀ `clojure.data.json` ā€¢ RewordĀ `:refer`Ā suggestion so you can copy paste itĀ https://github.com/clj-kondo/clj-kondo/issues/1293Ā (https://github.com/vemv) ā€¢ Add re-frame analysis outputĀ https://github.com/clj-kondo/clj-kondo/issues/1465Ā (https://github.com/benedekfazekas) ā€¢ Qualified map causes too many arguments in type checkerĀ https://github.com/clj-kondo/clj-kondo/issues/1474 ā€¢ Handle reader conditional with unknown languageĀ https://github.com/clj-kondo/clj-kondo/issues/970

šŸŽ‰ 4
mknoszlig07:12:13

i upgraded to the new version but had a little surprise when looking at a defmulti in a cljc file. :exclude-defmulti-args doesnā€™t seem to get picked up there:

> echo "(defmulti my-multi (fn [a b] b))" | clj-kondo --lang clj --lint -
linting took 12ms, errors: 0, warnings: 0

> echo "(defmulti my-multi (fn [a b] b))" | clj-kondo --lang cljc --lint -
<stdin>:1:25: warning: unused binding a
linting took 14ms, errors: 0, warnings: 1
is this just a configuration issue on my side?

borkdude07:12:59

I suspect the predicate for CLJS isn't right. Try it with a CLJS file

borkdude07:12:29

I mean the defmulti? pred

mknoszlig08:12:22

with --lang cljs i get the same warning

borkdude08:12:04

Yeah so that's the issue. PR welcome šŸ™

mknoszlig08:12:41

iā€™ll file an issue