Clj-kondo and `defmulti`

I have some multi-methods defined that take several parameters, only a part of which are used by the dispatch function.

I have a definition like the following:

(defmulti foobar
  "Takes a `foo` and a `bar`, and combines them using `baz` and `quuz`"
  (fn[foo bar baz quuz]
    (,,, (do-some-stuff foo bar))))

I’m getting a warning about unused bindings for baz and quuz, but since the documentation of multimethods goes in the defmulti, it is handy to have the parameters’ names there, rather than just underscores.


Is there any configuration option for clj-kondo to ignore this type of instance?

You can start the names with underscores: _baz and _quux, or use a #_:clj-kondo/ignore annotation.

Thanks, Michiel!

Another workaround, which involves no “noise” other than the healthy hum of Clojure metadata, is to declare multimethod arglists explicitly:

(defmulti fig 
  {:arglists '([a b c])}
  (fn [a _ _]

This technique quells the warning, in Calva at least. And it enables clojure.repl/doc (and presumably those nice HTML documentation generators) to see the arglist.


This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.