Fork me on GitHub
#clj-kondo
<
2021-05-03
>
Ory Band17:05:39

Hi. I have some things in midje i'd like clj-kondo to stop notifying me about: • midje's tabular tests: specifically the table column headers such as ?this and ?that (the string after the question mark is generic). any idea how can i do that? https://github.com/marick/Midje/wiki/Tabular-facts • referring and calling private fns using testable-privateshttps://github.com/marick/Midje/wiki/Private-functions AND https://github.com/marick/Midje/wiki/Using-private-functions-in-prerequisites any idea what i should put in clj-kondo config.edn to solve these? thank you

Ory Band18:05:18

Yes. The thing is, these scenario are kinda unique: • i haven't found a way to solve the tabular issue. it's an unresolved symbol. i would like unresolved symbol errors, just ignore ones starting with ?xxx and only for unit test files • for private calls, i'd like to silence the warning but only for unit test files whose filenames are t_my_test_file.clj (has a t_ prefix)

borkdude18:05:50

you can use namespace local config to disable a linter in a namespace, or you can use local config like #_{:clj-kondo/ignore [:private-call]} to ignore things locally

borkdude18:05:18

the other option is to write a custom hook to make clj-kondo understand midje

borkdude18:05:07

https://github.com/clj-kondo/clj-kondo/blob/master/doc/hooks.md once you have a hook that works, you can submit it to https://github.com/clj-kondo/config so other can profit from it too

borkdude18:05:47

to suppress private call warnings you could also use #'foo/bar instead of foo/bar

Ory Band18:05:22

thanks! good ideas. is there no way to configure clj-kondo for specific namespaces starting with t- or filenames starting with t_ ?

borkdude18:05:47

not currently

Ory Band18:05:05

ok. thank you

borkdude18:05:15

you can disable it completely based on the filename though

Ory Band18:05:24

yeah but you have to provide exact "fully qualified" full file names right?

borkdude18:05:47

no, it works on a regex

Ory Band18:05:59

isnt that what i'm looking for?

borkdude18:05:22

I don't think so since you said you still want linting except for some things

Ory Band18:05:41

ah you meant disable clj-kondo completley? i thought just specific linters

borkdude18:05:18

that isn't currently possible, it's only possible in the namespace metadata for one specific namespace at a time

Ory Band18:05:25

that would do for the private call notification. but for tabular i agree i'll prolly have to write some custom linter/hook

Fredrik Wallberg20:05:03

Is there a way to register custom specs which can be referenced in the :type-mismatch linter? Example:

{:level :error
 :namespaces {foo {bar {:arities {1 {:args [:custom-spec-label-here]}}}}}}

Fredrik Wallberg20:05:47

Context: when writing annotations for multiple functions operating on the same (complex) map, it would be great to reference the map/spec by name.

borkdude20:05:37

@wallberg no, these keywords currently only refer to a set of predefined types

Fredrik Wallberg20:05:57

That explains why I didn't find it in the documentation. Thanks for the swift reply and a great tool!