clj-kondo / clj-kondo-bb

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

Consider making clj-kondo version dynamic #1

Open vincentjames501 opened 1 year ago

vincentjames501 commented 1 year ago

I think it would be cool if we could make this line dynamic:

https://github.com/clj-kondo/clj-kondo-bb/blob/main/src/clj_kondo/core.bb#LL5C50-L5C50

Example:

(def clj-kondo-version (or (System/getenv "CLJ_KONDO_VERSION") "2022.11.02"))

(pods/load-pod 'clj-kondo/clj-kondo clj-kondo-version)

Our team is looking for an easy way to pin clj-kondo versioning for both local development, ci and ides. This could help with local dev and CI a bit. (Using the lein plugin is a bit too slow for local dev compared to awesome babashka ;) )

Example desired invocation:

CLJ_KONDO_VERSION="2022.11.02" bb -Sdeps '{:deps {io.github.clj-kondo/clj-kondo-bb {:git/sha "665dc00b47ea83b996486b87dcd4e26d701bae6d"}}}' -x clj-kondo.core/exec --lint src

It'd be nice to partner with clojure-lsp as well to see if there could be a way to pin the clj-kondo version when desired there too!

Any other thoughts/ideas?

borkdude commented 1 year ago

Yes, PR welcome for this.

About LSP: if you run it as a JVM process you can use any clj-kondo version with it that you prefer.

I'm using this ~/dev/clojure-lsp-dev script where I'm always using my local clj-kondo dev version:

#!/usr/bin/env bash

clj -Sdeps '{:aliases
              {:lsp
                {:replace-paths []
                 :replace-deps
                  {org.clojure/clojure {:mvn/version "1.11.1"}
                   clj-kondo/clj-kondo {:local/root "/Users/borkdude/dev/clj-kondo"}
                   clojure-lsp/clojure-lsp {:local/root "/Users/borkdude/dev/clojure-lsp/cli"}
                   cider/cider-nrepl {:mvn/version "0.28.6"}}}}}' \
                       -M:lsp -m clojure-lsp.main "$@"

Pinning the clj-kondo version with the lsp binary might not be so easy.