This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-05-18
Channels
- # announcements (2)
- # babashka (35)
- # beginners (59)
- # calva (17)
- # cider (3)
- # clerk (7)
- # clj-kondo (21)
- # cljfx (9)
- # cljs-dev (76)
- # clojure (98)
- # clojure-austin (3)
- # clojure-brasil (1)
- # clojure-europe (11)
- # clojure-gamedev (4)
- # clojurescript (14)
- # consulting (7)
- # cursive (6)
- # datascript (4)
- # datomic (12)
- # emacs (18)
- # events (2)
- # graalvm (9)
- # humbleui (3)
- # hyperfiddle (18)
- # jobs (4)
- # missionary (12)
- # nextjournal (2)
- # nrepl (7)
- # off-topic (31)
- # practicalli (2)
- # rdf (6)
- # releases (2)
- # scittle (10)
- # xtdb (9)
Hi, is there a way to add hooks for vars with some form metadata? E.g. let's say I want to analyze a string so it cannot contain whitespaces
(def ^:my-meta aaa
"this-is-good") ;; Valid string
(def ^:my-meta bbb
"this-is bad") ;; Invalid string, clj-kondo warns
, then we could do something like
{:hooks {:analyze-meta-var {:my-meta hooks.foo/weird-meta}}}
.
Ofc, this could be more general than vars if wanted (anywhere where a form metadata is found?).I know that I could create some bogus function as a marker wrap the string with it, but wanted to rely on metadata instead, if possible
This use case hasn't come up before as far as I can remember. Perhaps you can use https://github.com/borkdude/grasp for now to write a manual check
Ok, thanks!
Michiel, so a “query” written in grasp could be easily ported to clj-kondo later? Or are you saying that there is a way to use grasp with clj-kondo?
Got it, thanks!
Opened an issue at https://github.com/clj-kondo/clj-kondo/issues/2088 for this (with a wip branch and a video, no PR yet, will open a PR only if you want)
With :uninitialized-var
being set to default :level :warning
has made my github action using delaguardo clojure-lint-action fail on 31 counts of uninitialized-var
. Is there any way around this?
yes, either fix the uninitialized vars or disable the linter. I recommend fixing them though since uninitialized vars default to a truthy value while you might think they default to nil (in JVM Clojure) and this can lead to unexpected bugs
All uninitialized-vars in this project are :^dynamic and only used with binding. They are on purpose not initialized so they cannot be used with any pre entered value
About the :type-mismatch
linter, is there a way to specify an argument as a map with strict keys? (i.e. a map containing only the required and/or the optional keys, but not containing extra keys)