eslint has a way to pass --fix which will auto fix errors that don't require programmer intervention. Is there a way to do this with clj-kondo?
no, clj-kondo won't touch your code
there are various tool that can, but they are mostly tied to editors, e.g. clj-refactor, clojure-lsp, etc
this is a tool that cut out unused vars: https://github.com/borkdude/carve
how would I configure linters when I'm using this library https://github.com/plumatic/plumbing . I want to use the :lint-as option instead of excluding it like this:
{:linters
{:unresolved-symbol
{:exclude [(plumbing.core/fnk)]}}}
@kevin26428 I think this works:
(ns foo
{:clj-kondo/config '{:lint-as {plumbing.core/fnk clojure.core/fn}}}
(:require [plumbing.core :refer (fnk sum)]))
(def stats-graph
"A graph specifying the same computation as 'stats'"
{:n (fnk [xs] (count xs))
:m (fnk [xs n] (/ (sum identity xs) n))
:m2 (fnk [xs n] (/ (sum #(* % %) xs) n))
:v (fnk [m m2] (- m2 (* m m)))})
so {:lint-as {plumbing.core/fnk clojure.core/fn}}
Thanks!
I didn't see any mention of white space or indentation space checks in clj-kondo, is this configurable?
clj-kondo ignores all whitespace - I think there might be other tools concerned with formatting / indentation
I think it could do that, but personally I haven't really found this an issue worthwhile to work on, since formatting in the editors I use is pretty much automatic
i have a macro called wait-for
that does a lot (too much probably). i have it listed in the :invalid-arity {:skip-args
vector. because of this, i have an "unused binding" warning. if I remove the wait-for
from the :skip-args
vector, the "unused binding" warning goes away (as it should, because the binding is used inside the wait-for
call)
any ideas why this might be happening?
@nbtheduke Do you have a repro for me to look at?
@nbtheduke E.g.:
(ns foo)
(defmacro wait-for [& _body])
(defn foo [x]
(wait-for (inc x 1 2 3)))
$ clj-kondo --lint /tmp/foo.clj --config '{:linters {:invalid-arity {:skip-args [foo/wait-for]}}}'
linting took 11ms, errors: 0, warnings: 0
I don't see x
being unused
https://github.com/mtgred/netrunner/blob/master/src/clj/game/core/events.clj#L253
others
is referenced on line 265
Can you boil this down to a small repro?
lol I'll see what I can do. this repo is a mess
how do i exclude/handle things like tags #db/fn