Fork me on GitHub
#clj-kondo
<
2020-02-21
>
imre10:02:50

I'm not sure if this has ever been discussed, has anyone figured out how to share the clj-kondo config effectively between projects? My current team has serveral projects that share a lot of macros etc that need the same config over and over again. It would be great to be able to use a shared config but keep the ability to add project-specific overrides when needed.

馃憤 4
imre10:02:40

perhaps a combination of a git submodule and a custom file that is then passed in as a command line arg to override things?

borkdude10:02:04

@imre In this issue I have suggested writing a script (perhaps using babashka) for merging configs https://github.com/borkdude/clj-kondo/issues/736

borkdude10:02:46

@imre In clj-kondo itself I've been using an #include reader tag, but this is undocumented, just something I've been playing around with: https://github.com/borkdude/clj-kondo/blob/615543df9cd5477f1c5e9ad08629997f402a2889/.clj-kondo/config.edn#L18

borkdude10:02:22

I'm not sure in what extent it will work for your purposes, but the scripting option will work for sure

imre10:02:36

that's an aero thing, right?

borkdude10:02:52

something I've implemented myself using data readers

imre10:02:44

you haven't implemented a #merge reader by any chance, have you? 馃槃

borkdude10:02:57

hmno, but I guess we could...

imre10:02:24

it might need a bit of brainstorming first, I suppose

borkdude10:02:43

I guess so yes

imre10:02:55

thank you very much for the pointers, I'll have a read through these

imre10:02:38

shared config + include/merge sounds like a declarative enough approach to cover both editor integrations and command line

imre10:02:52

for our case

mynomoto12:02:42

Hi, I thought that clj-kondo reported on undefined vars from other namespaces. Did I imagine things?

borkdude12:02:45

@mynomoto it does report invalid arities from other namespaces, but it doesn't warn if they don't exist. there is an issue for this though

mynomoto12:02:09

Ok, thanks. I guess I'm relying more on clj-kondo than I should 馃槄

borkdude22:02:49

$ clj-kondo --config '{:lint-as {mount/defstate clojure.core/def}}' --lint - <<< '(ns foo (:require mount x)) (mount/defstate conn :start (x/create-connection x/config))'
linting took 9ms, errors: 0, warnings: 0

borkdude22:02:31

this is just by luck, when clj-kondo would have more strict syntax checking for clojure.core/def this would likely give problems

borkdude22:02:44

yeah. this one also works:

$ clj-kondo --config '{:lint-as {mount/defstate clj-kondo.lint-as/def-catch-all}}' --lint - <<< '(ns foo (:require mount x)) (mount/defstate conn :start (x/create-connection x/config))'
linting took 12ms, errors: 0, warnings: 0

borkdude22:02:16

this is a thing designed to catch all def-like things that cannot be mapped unto something else

borkdude22:02:52

at the cost of not getting some lint warnings inside that call

borkdude22:02:42

np, silly mistakes happen. that's why I made this tool in the first place 馃檪

borkdude22:02:34

great to hear 馃檪