This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-02-15
Channels
- # announcements (8)
- # architecture (9)
- # autochrome-github (1)
- # babashka (48)
- # beginners (55)
- # calva (36)
- # cider (16)
- # clj-commons (1)
- # clj-kondo (38)
- # cljs-dev (44)
- # cljsrn (1)
- # clojure (164)
- # clojure-europe (35)
- # clojure-nl (2)
- # clojure-norway (10)
- # clojure-uk (23)
- # clojurescript (50)
- # conjure (24)
- # core-async (1)
- # cryogen (2)
- # cursive (38)
- # datalevin (11)
- # datascript (2)
- # datomic (13)
- # duct (1)
- # emacs (16)
- # events (12)
- # exercism (3)
- # figwheel-main (7)
- # fulcro (26)
- # honeysql (5)
- # integrant (1)
- # jobs (3)
- # kaocha (6)
- # lsp (72)
- # malli (22)
- # nextjournal (35)
- # nrepl (1)
- # off-topic (34)
- # pathom (5)
- # polylith (8)
- # portal (40)
- # re-frame (14)
- # reagent (42)
- # reitit (1)
- # releases (1)
- # remote-jobs (1)
- # reveal (9)
- # sci (2)
- # shadow-cljs (13)
- # sql (3)
- # tools-deps (33)
- # vim (25)
I am getting pretty fancy over here with api/reg-finding!
to throw specific linter warnings for my pattern-matching DSL
there are some confusing rules for (pattern (+ (? x odd?) ?y ?z))
, and the linter can sort of… teach the user what to do as they type. “x must be a non-namespaced symbol”, etc, so awesome.
kind of makes me want to revive https://github.com/nathanmarz/cascalog… I have had thoughts over the years of writing it up as a literate program, would be fun to have a linter for the datalog syntax too
@sritchie09 clj-kondo already has linting built-in for datalog as well, via the datalog-parser library
@borkdude any chance I can beg for unquote?
and friends to be exposed in the hooks API?
whoops, yes 🙂
@borkdude should I rely on the fact that hook namespaces can require each other, or is that an accidental feature?
@sritchie09 it's a feature.
I have to say, figuring out how to configure hooks has really filled in the gaps and eliminated most of the remaining false positives I used to have, great stuff! I was wondering, let’s say I have a couple dozen or so variations of a very similar macro that I would like to use the same hook for, is there any way I can avoid listing out every one of those in :analyze-call
? Is it possible to configure :analyze-call
with a function instead of a map?
@stefan.toubia currently not possible
Gotcha, thanks. In my case I have a handful of common macros generally used for testing, each project defines their own version but they all follow the same naming convention. It would be great to be able to just match the macro name, and avoid having to update the config when new macros are added. Will have to explore options for generating the config. Thanks for the advice!
@stefan.toubia This might also come in handy if you want to update the config programmatically: https://github.com/borkdude/rewrite-edn
Hey @borkdude are there any options for maintaining/enforcing alphabetical ordering in a map when using rewrite-edn?
@borkdude is it possible to use a :clj-kondo/ignore
to ignore the custom errors registered by my library?
This does not seem to be working, for reference:
#_{:clj-kondo/ignore [:sicmutils.rule/ruleset-args]}
(ruleset (+ (? x) (? y)) (fn [m] (- ('?x m) ('?y m))))
meaning, linting still gives that error:
[sritchie@wintermute ~/code/clj/sicmutils (sritchie/kondo)]$ clj-kondo --lint src
src/pattern/rule.cljc:570:2: error: ruleset requires bindings in groups of 3. Received 2 bindings.
I have it enabled in my exported config like this:
{:linters
{:sicmutils.pattern/ruleset-args {:level :error}}}
I also can’t seem to override it in the :linters
key of my project-local config.edn; and if I erase the entry from my exported config, I can’t enable it by adding
:sicmutils.pattern/ruleset-args {:level :error}
to my local config.ednNormally this should work. Not sure why it doesn't in this case. If you could make a small repro, then I'll investigate.
sounds good!
@borkdude is a repro in a sicmutils branch okay?
yeah, as long as I can reproduce it locally. the less deep I have to dig, the better it is of course
@borkdude hopefully this is an easy repro; I expect there is nothing sicmutils specific about this, but setting up a repro project is still fiddly. So hopefully this will work. let me know if it’s annoying and I can get a smaller one together
sg, thanks again
phew, this hook got a bit turbo. Might be fun reading for anyone interested: https://github.com/sicmutils/sicmutils/blob/961b5bce04a03f1b41e5a39ab427d3a649a710b0/resources/clj-kondo.exports/sicmutils/sicmutils/hooks/pattern/rule.clj pretty cool given that this basically lints a different programming language embedded in clj
@sritchie09 When you're done, please post a link here: https://github.com/clj-kondo/clj-kondo/discussions/1528
Done! https://github.com/clj-kondo/clj-kondo/discussions/1528 copied your style for descriptions of my custom linter warnings: https://github.com/sicmutils/sicmutils/blob/main/doc/linters.md