This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-08-24
Channels
- # babashka (9)
- # beginners (17)
- # biff (1)
- # calva (3)
- # cider (29)
- # clj-kondo (31)
- # clojure (59)
- # clojure-austin (12)
- # clojure-brasil (12)
- # clojure-europe (35)
- # clojure-nl (1)
- # clojure-norway (72)
- # clojure-uk (1)
- # clojurescript (15)
- # clr (4)
- # conjure (1)
- # cursive (2)
- # datahike (2)
- # emacs (3)
- # hyperfiddle (114)
- # introduce-yourself (1)
- # kaocha (3)
- # malli (7)
- # off-topic (19)
- # pathom (2)
- # polylith (5)
- # portal (5)
- # reitit (5)
- # shadow-cljs (2)
- # slack-help (4)
- # tools-deps (42)
- # xtdb (6)
Unexpected error. Please report an issue.
java.lang.IllegalArgumentException: no conversion to symbol
Is there a way I can get more info on where clj-kondo failed during parsing (to help produce a minimal repro)?I found https://github.com/clj-kondo/clj-kondo/issues/1670
But I don't think it's the same, since I'm testing with 2023.07.13
Thanks @U04V15CAJ for quickly pointing me to the probable cause!
❓ Our coding guidelines allows calling private functions (with #'
) from tests, but disallow it otherwise. Our solution so far has been to run clj-kondo twice: one for “src”, and again for test: clj-kondo --config '{:linters {:private-call {:level :off}}}' --lint test
. I’m wondering if there’s any appetite for a config option (and whether it’s even possible) to make the :private-call
linter take a path ignore files?
I’m thinking something like {:linters {:private-call {:ignore-paths ["test"]}}
in config.
I’m also open to being told it’s a terrible idea 🙂
This is what the :config-in-ns
option is for, no need to implement this for each linter specifically
That is contrary to my experience, where the private-call linter does report for #'foo
. I just tried it again. However, :ns-groups
and :config-in-ns
looks like they have my back — if I can only get the syntax right 🙂
$ clj-kondo --lint - <<< "(ns foo) (defn- foo []) foo (ns dude (:require [foo])) (#'foo/foo)"
linting took 12ms, errors: 0, warnings: 0
vs.
$ clj-kondo --lint - <<< "(ns foo) (defn- foo []) foo (ns dude (:require [foo])) (foo/foo)"
<stdin>:1:56: error: #'foo/foo is private
How curious! I can reproduce that, but that is not the behaviour I’m seeing in our projects.
me experiments more
Aha, I think I have been tricked by the error clj-kondo prints. This is error: #'foo/now is private
— but the actual code is:
(bond/with-stub! [[foo/now (constantly #inst "2017-03-30T20:52:03.690-00:00")]
(`bond` is a stubbing library.)Nevertheless, ns-groups
and config-in-ns
seems like it should work for me here.
if bond/with-stub! is supported via a hook, you can maybe update the hook to suppress the private-call warning
I’m not sure what “supported via a hook” means, I’m afraid, though that sounds interesting. The source is here: https://github.com/circleci/bond/blob/main/src/bond/james.clj#L96-L105
… though I’ve now managed to get the :config-in-ns
option to work, which is a massive improvement on what we have
> I’m afraid, though that sounds interesting Fear not :) What I mean is, did you do anything to configure this macro to not cause any lint warnings?
You can also configure it like:
{:config-in-call {foo.bar/bond {:linters {:private-call {:level :off}}}}}
Mmm! That’s perhaps even better here. Nice and narrow.