This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-09-25
Channels
- # announcements (5)
- # babashka (2)
- # beginners (36)
- # bristol-clojurians (3)
- # calva (26)
- # cider (11)
- # clj-kondo (26)
- # cljfx (5)
- # cljsrn (7)
- # clojure (149)
- # clojure-berlin (13)
- # clojure-czech (1)
- # clojure-dev (6)
- # clojure-europe (50)
- # clojure-france (2)
- # clojure-italy (9)
- # clojure-nl (4)
- # clojure-uk (48)
- # clojured (1)
- # clojuredesign-podcast (4)
- # clojurescript (27)
- # core-async (3)
- # cursive (5)
- # data-science (1)
- # datalog (1)
- # datomic (32)
- # emacs (8)
- # events (1)
- # fulcro (19)
- # graalvm (2)
- # graphql (7)
- # jobs (1)
- # malli (5)
- # meander (36)
- # nrepl (2)
- # parinfer (2)
- # pedestal (14)
- # reagent (4)
- # reitit (2)
- # reveal (7)
- # specter (4)
- # tools-deps (6)
- # uncomplicate (1)
- # vrac (2)
- # xtdb (12)
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?
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)))})
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
Hey @U04V15CAJ - not to dig up ancient history but I wanted to check if the idea is still to keep indentation out of scope for clj-kondo. If so I'm thinking of using babashka + rewrite-clj to check for compliance with https://tonsky.me/blog/clojurefmt/ since it seems like an easy one to start with 🙂. My interest in this feature is mostly that while my editor does what I want it to, I want to be able to have a style guide for a project and not put myself in the position of bugging others to change little things in PRs or whatever (clj-kondo has been great for this already!).
Does this relate with the comment in #CPABC1H61 about formatting and style/indent etc?
since lsp has formatting abilities and clj-kondo doesn't it might be good to join that conversation there
Oh no, total coincidence, hadn't seen it
But yeah makes perfect sense, will investigate doing this with cljfmt
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
https://github.com/mtgred/netrunner/blob/master/src/clj/game/core/events.clj#L253
others
is referenced on line 265
lol I'll see what I can do. this repo is a mess