Fork me on GitHub
#clj-kondo
<
2023-11-21
>
imre17:11:47

I checked the docs and issues and don't see a linter that I could use to detect (known) lazy-sequence-producing functions. Usecase: it's idiomatic and easy to use the 2 (or more) arities of functions like map and filter , however, in a codebase that doesn't need to be lazy most of the time, I'd discourage their uses and would recommend the eager ...v versions or - even better - transducers. The :discouraged-var linter could be an option, however in most cases I'd want to discourage only specific arities. Is there a way to do this currently, and if not, would it be in line with clj-kondo's goals to add a linter like this?

borkdude18:11:03

we could add an arity option to discouraged var perhaps

imre18:11:33

That could work as long as it works for variable arities

borkdude18:11:05

can you give an example of what you mean by that?

imre18:11:55

clojure.core/map takes one, two, three or more args. I want to discourage everything but the one arity

borkdude18:11:49

right, :arities #{2,3,:varargs}

imre18:11:37

Sounds perfect! Should I open an issue?

borkdude18:11:45

yes please@

imre18:11:56

Will do, thank you!