Fork me on GitHub
Felipe Cortez17:11:13

hey! we're using cljfmt through tools.deps, which means we use an indentation.edn file containing what would be inside :indents here: is there any way to make calva read this instead of the entire :cljfmt map?


clojure-lsp has a standard of readding a .cljfmt.edn (, Since Calva uses clojure-lsp, it could do the same. c/c @U0ETXRFEW

Felipe Cortez23:11:56

hmm, isn't that for the lein-cljfmt style map instead of just the :indents?


Hum, not sure I understood, for clojure-lsp you could configure any cljfmt config on that file, including :indents

Felipe Cortez23:11:14

yeah, but the tools.deps version uses command line arguments, like

clojure -Sdeps '{:deps {cljfmt {:mvn/version "0.8.0"}}}' \
  -m cljfmt.main check \
  --indents indentation.clj
where indentation.clj contains just the contents that would be inside :indents. I'll probably just use the .cljfmt.edn format and add a babashka task to convert the map to command line args


BTW, any reason why not use clojure-lsp format instead of manually using cljfmt? (

Felipe Cortez00:11:56

oh, this is much better


We replaced at nubank every linter to use only clojure-lsp :)


for linting (clj-kondo under the hood), formatting (cljfmt under the hood) and clean-ns (clojure-lsp itself)


with that you could have a common library like codestyle and all services/libs of yours could use the same codestyle configuration

Felipe Cortez00:11:42

we run multiple jobs like

  image: "cljkondo/clj-kondo"
    - clj-kondo --lint src $([ -d test ] && echo "test")

  image: clojure:openjdk-11-tools-deps-buster
    - clojure -Sdeps '{:deps {cljfmt/cljfmt {:mvn/version "0.8.0"}}}' -M -m cljfmt.main --indents indentation.edn check
but that does seem better 😄


the issue when you run clj-kondo to lint only src and test is that it makes kondo doesn't know the whole classpath and know hooks and custom things for other macros, this issue is fixed with clojure-lsp since it scans the classpath with kondo already

Felipe Cortez00:11:42

wow, clj-kondo can look for dependencies' configs?


we just have this on our common codestyle library at nubank:

{:config-paths ["nubank/stateflow" ...]}


then clojure-lsp will already tell to kondo copy the hook and use it, understand this library macros that were configured on the library itself!

Felipe Cortez00:11:49

but never managed to commit it, I think

😅 1
Felipe Cortez00:11:15

this is awesome


yeah, I can say after we introduced codestyle common library using all those configurations in one single place, we stopped having issues like missing lint config


all services now just use this on .clj-kondo/config.edn:

{:config-paths ["nubank/codestyle"]}
which that lib has more kondo config-paths and custom kondo config for all services and libs :)


LMK if you need more details

Felipe Cortez00:11:34

and nubank/codestyle is a lib? config-paths looks for stuff in the classpath?


yes, is just a common lib that in resources has all clj-kondo exports + clojure-lsp exports


yes, in classpath


clojure-lsp has that same feature via :classpath-config-paths settings


the kondo one, search not on classpath, it search on folders :config-paths , but it turns out that you can think on classpath since clojure-lsp will send that to be linted and clj-kondo will copy that config for your service folder


when I created that on clojure-lsp I just added support for classpath only instead of all folder support like kondo has

Felipe Cortez00:11:09

very very nice

Felipe Cortez00:11:23

I'll definitely let you know when setting this up!


I’m not following about all the cool stuff here. Is there a blog write-up somewhere?


Calva doesn’t use clojure-lsp for formatting, anyway, so the question in TS still is relevant. And the answer is no, Calva only knows about one cljfmt config file. You could tell it to read indentation.edn, but then Calva wouldn’t know about your other cljfmt options. It should be quite simple to add this support though. An issue on the repo is welcome!

Felipe Cortez12:11:50

actually, it seems like defining all the cljfmt options in the leiningen format as it is today should be the way to go. I can then write a workaround or start using clojure-lsp to do my CI checks instead. what do you think?