Clj-kondo: a linter for Clojure code that sparks joy @ ClojuTRE 2019

Clj-kondo: a linter for Clojure code that sparks joy @ ClojuTRE 2019

Clj-kondo is a linter for Clojure code that sparks joy. It analyzes your code without evaluating it and detects arity errors, redundant expressions, unused requires, missing test assertions and more. It provides fast editor feedback because it runs instantly as a native binary, not depending on a REPL in a JVM. In this talk we will see what it can do, how it is implemented and how it compares to other Clojure linters.


Michiel Borkent

September 27, 2019


  1. 3.

    Clojure linters Linter Focus CLJS? Macroexpand? Execution Eastwood General No

    core + user JVM Kibit Idioms No No JVM Joker General Yes core Go native Cljfmt Formatting Yes n/a JVM How to ns How to ns Yes n/a Clojure JVM Clj-kondo General Yes core GraalVM native / JVM
  2. 4.

    Clj-kondo origin story • I've been a happy joker user

    since 2017 • Wanted to add a feature: (defn foo [x] (def x 1)) • Joker is written in Go, can it be done in Clojure? • Tried with Clojure on GraalVM (native = fast startup like joker) • Success with rewrite-clj which is based on tools.reader • Writing more linting features was too much fun!
  3. 6.
  4. 7.
  5. 9.
  6. 10.
  7. 12.

    REPL state $ clj-kondo --lint src | grep "unresolved symbol

    c" src/dre/analytics/authors.clj:585:41: info: unresolved symbol c
  8. 22.

    .clj-kondo • .clj-kondo/config.edn • Shared configuration, intended for version control

    • .clj-kondo/.cache • Automatically updated when changing code in editor • Contains arity and other info about linted code • Allows linter to reason about multiple namespaces • Populate with lib info: clj-kondo --lint $(clj -Spath)
  9. 24.