Slide 1

Slide 1 text

Michiel Borkent @borkdude

Slide 2

Slide 2 text

Word origins

Slide 3

Slide 3 text

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

Slide 4

Slide 4 text

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!

Slide 5

Slide 5 text

Invalid code is still data

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

Arity errors

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

REPL state

Slide 12

Slide 12 text

REPL state $ clj-kondo --lint src | grep "unresolved symbol c" src/dre/analytics/authors.clj:585:41: info: unresolved symbol c

Slide 13

Slide 13 text

Unused let and fn bindings

Slide 14

Slide 14 text

Unresolved symbols

Slide 15

Slide 15 text

Redundant let + do

Slide 16

Slide 16 text

Missing test assertion

Slide 17

Slide 17 text

Style: don't refer :all

Slide 18

Slide 18 text

Ns form cleanup

Slide 19

Slide 19 text

Ns form cleanup

Slide 20

Slide 20 text

Type checking

Slide 21

Slide 21 text

Editor support

Slide 22

Slide 22 text

.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)

Slide 23

Slide 23 text

Config from manifold.deferred Clj-kondo doesn't know how to lint this macro

Slide 24

Slide 24 text

Config

Slide 25

Slide 25 text

Analysis export

Slide 26

Slide 26 text

Who uses clj-kondo? Github #438 Add your company to the list:

Slide 27

Slide 27 text

Thank you https://github.com/borkdude/clj-kondo