clj-kondo / clj-kondo-bb

Invoke clj-kondo from babashka scripts!
Eclipse Public License 1.0
7 stars 0 forks source link
babashka clj-kondo clojure

clj-kondo-bb

Invoke clj-kondo from babashka scripts!

Install

Add this dependency to bb.edn or deps.edn (for bb libraries):

{:deps {io.github.clj-kondo/clj-kondo-bb {:git/tag "v2023.01.20" :git/sha "adfc7df"}}}

You can invoke clj-kondo as a babashka one-liner like this:

bb -Sdeps '{:deps {io.github.clj-kondo/clj-kondo-bb ...}}' -x clj-kondo.core/exec --lint src

You can add this library along with JVM clj-kondo without causing conflicts.

Usage

In a babaska script:

(require '[clj-kondo.core :as clj-kondo])

(let [{:keys [summary] :as results} (clj-kondo/run! {:lint ["src"]})]
  (clj-kondo/print! results)
  (when (or (pos? (:warning summary))
            (pos? (:error summary)))
    (throw (ex-info "Lint errors" {:babashka/exit 1}))))

License

Copyright © 2019 - 2023 Michiel Borkent

Distributed under the EPL License, same as Clojure. See LICENSE.