Upgrade to Pro — share decks privately, control downloads, hide ads and more …

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

More Decks by Michiel Borkent

Other Decks in Programming


  1. 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. 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. REPL state $ clj-kondo --lint src | grep "unresolved symbol

    c" src/dre/analytics/authors.clj:585:41: info: unresolved symbol c
  4. .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)