This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-29
Channels
- # babashka (64)
- # beginners (60)
- # calva (10)
- # circleci (3)
- # clj-kondo (62)
- # cljdoc (6)
- # clojars (2)
- # clojure (152)
- # clojure-europe (19)
- # clojure-nl (3)
- # clojure-uk (18)
- # clojurescript (50)
- # clojureverse-ops (12)
- # core-async (21)
- # cursive (6)
- # data-science (1)
- # datomic (17)
- # events (14)
- # fulcro (64)
- # graalvm (20)
- # graphql (5)
- # honeysql (14)
- # jackdaw (3)
- # jobs (1)
- # jobs-discuss (22)
- # kaocha (2)
- # lsp (9)
- # luminus (8)
- # malli (30)
- # meander (31)
- # other-languages (1)
- # polylith (8)
- # re-frame (15)
- # shadow-cljs (85)
- # specter (2)
- # sql (11)
- # tools-deps (56)
- # vim (39)
- # vscode (7)
- # xtdb (16)
trying to use :analyze-call
hooks to implement some custom linting, but am unable to exclude callsites using the #_{:clj-kondo/ignore [:some-linter]}
form
e.g. I'm trying to error on calls to satisfies?
with this code:
(defn satisfies-hook
[{:keys [node] :as input}]
(let [m (meta node)]
(api/reg-finding! {:message "use of satisfies? is not allowed!"
:type :rpl-satisfies?
:row (:row m)
:col (:col m)
})
node))
but this code still causes linting to fail:
(defn platform-executable?
[o]
#_{:clj-kondo/ignore [:rpl-satisfies?]}
(satisfies? PlatformExecutable o))
any suggestions on how to do this?
@nathanmarz You need to add :rpl-satisfies?
into your linter config as well, {:linters {:rpl-satisfies? {:level :error}}}
, have you done this?
you also need to include :end-row
and :end-col
, else the ignore annotation doesn't know what the span is where the ignore is valid
@nathanmarz let me know if that fixes it for you
oh, about the return value: you don't have to return anything, if you're not transforming. just return nil will do
are there any known issues with running kondo via lein?
running via CLI works great, but the lein runner is unreliable for me
it sometimes has errors like <path>:11:1: error: Attempting to call unbound fn: #'hooks.core/custom-hook
these are the commands I'm using:
lein with-profile kondo clj-kondo --lint 'distributed/src/clj:core/src/clj:distributed/test/clj:core/test/clj' --parallel --config-dir .clj-kondo-jenkins --fail-level error
clj-kondo --lint 'distributed/src/clj:core/src/clj:distributed/test/clj:core/test/clj' --parallel --config-dir .clj-kondo-jenkins --fail-level error
profile is :kondo {:dependencies [[clj-kondo "2021.07.28"]]}
and alias "clj-kondo" ["run" "-m" "clj-kondo.main"]
the hook are in .clj-kondo-jenkins/hooks/core.clj
also, the errors with lein are random
sometimes it has those errors, sometimes it doesn't
sometimes it says this: WARNING: error while trying to read hook for...
it appears to be reliable without --parallel
, no errors 6x in a row
already cleared the CLI, let me try to recreate that error
yeah, I think I know what's going on, the require inside of the interpreter isn't thread safe :)
WARNING: error while trying to read hook for rpl.helpers/returning: Could not resolve symbol: hooks.core/returning-fn
satisfies? is a relatively common function, if you lint multiple dirs at the same time, the concurrent require might cause trouble somewhere
@nathanmarz you know what, let me push a quick fix and you can use that deployed artifact in your CI
thanks
@nathanmarz try [clj-kondo "2021.07.29-20210729.150232-2"]
also made an issue for SCI (https://github.com/borkdude/sci/issues/592)
@borkdude lein with --parallel
looks to be reliable now
Hi all, I have the following specter
path
(def POST-ORDER-VALS
(sp/recursive-path []
p
(sp/cond-path map?
(sp/continue-then-stay [sp/MAP-VALS p])
sequential?
(sp/continue-then-stay [sp/ALL p])
set?
(sp/continue-then-stay [sp/ALL p])
sp/STAY)))
And clj-kondo
rightly says that p
is an "unresolved symbol"
p
can change, it really depends on who implements the path...is there a way to tell :exclude
to ignore recursive-path
when linting?
Here is what I have now in my config - but it does now work...
{:linters
{:unresolved-symbol
{:exclude [thrown-with-data? recursive-path]}}}
@richiardiandrea you can do {:exclude [(com.rpl.specter/recursive-path)]}
to ignore unresolved symbols inside of a call to that function
oh ok great, I actually tried (recursive-path)
but I guess I needed the fully qualified symbol there - let me try
works like a charm
it's a co-incidence that @nathanmarz was just here and just after that someone asks a question about specter :)
perhaps specter can provide better support by providing some hooks or macroexpansions as part of the library (if that makes sense for the above case, not sure)
yeah lol I have just seen it up there 😉
Thanks both to you and Nathan for these great tools