This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-04-05
Channels
- # announcements (15)
- # aws (7)
- # babashka (105)
- # beginners (35)
- # biff (5)
- # calva (48)
- # cider (5)
- # clj-kondo (25)
- # cljdoc (14)
- # clojure (84)
- # clojure-czech (2)
- # clojure-dev (6)
- # clojure-europe (58)
- # clojure-nl (6)
- # clojure-norway (19)
- # clojure-portugal (2)
- # clojure-uk (5)
- # clojurescript (23)
- # cloverage (5)
- # code-reviews (5)
- # conjure (28)
- # data-science (1)
- # datomic (53)
- # events (6)
- # exercism (7)
- # fulcro (16)
- # graalvm-mobile (2)
- # honeysql (29)
- # improve-getting-started (2)
- # kaocha (32)
- # lambdaisland (2)
- # lsp (29)
- # malli (3)
- # overtone (1)
- # pedestal (8)
- # polylith (3)
- # portal (6)
- # quil (2)
- # rdf (15)
- # releases (2)
- # rewrite-clj (14)
- # sci (9)
- # shadow-cljs (7)
- # specter (5)
- # sql (5)
- # xtdb (38)
I just noticed that it’s possible to show lint warnings inline on github PRs, seen for elixir below. Looks like it’s done by these https://github.com/erlef/setup-beam/blob/main/.github/elixir-matchers.json. Does a similar thing exist for clj-kondo or should we build it?
Do you mean like this one? https://github.com/marketplace/actions/clj-kondo-checks
Would it make sense or be possible to have kondo warn on use of for
in such a way that the comprehension isn’t actually used? I’m working on a legacy code base and I just fixed an evaluation bug caused effectively by
(defn do-lots-of-things
[xs]
(when (a-thing?)
(for [x xs] (do-more-things x)))
(when (b-thing?)
(do-more-stuff)))
That is, because the resulting lazy sequence from that for
comprehension isn’t used/returned, it didn’t get evaluated.@U04V15CAJ Pinging about this, had a second thought on this today and I think this would fall under the general category of “unused return values”, which probably can be quite a huge category of things on its own, plus I can imagine the implementation would probably get kinda complex as this would require flow analysis. What I’m trying to say, feel free to say “could be nice but nah” 🙂
There's already an issue for "unused return value" and something I've already worked on a bit
Not on its own, of course, in this case the issue is that it’s not in tail position so it gets discarded.
And of course that shouldn’t be a generic check either, as sometimes that’s totally fine, especially with eg. do
.
It would be this issue: https://github.com/clj-kondo/clj-kondo/issues/1258 Feel free to post there
I was referred here by someone in the general Clojure channel, and I figured Borkdude would know, if anyone did. Is there a library/program for calculating statistics on clojure/script files? I'm thinking about stats like LoC with/without comments, number of functions/macros, depth of expression trees in functions, etc. I looked at clindex, but it didn't seem to give me what I needed.
@fadrian well, the amount of fns vs macros, etc you can get from the clj-kondo analysis:
https://github.com/clj-kondo/clj-kondo/blob/master/analysis/README.md
lines of code vs comments, etc you can easily do without any other tools (if you mean ;;
comments)
expression depths you could do using a tool like tools.reader or edamame which gives you the raw s-expressions and fiddle a bit with that
clojure-lsp also has something like call-tree so it is possible to calculate such trees from clj-kondo's analysis as well
a tool like grasp can help you find certain patterns in clojure code, if that's interesting: https://github.com/borkdude/grasp
This tool uses clj-kondo's analysis extensively to show dependencies between vars: https://github.com/benedekfazekas/morpheus