This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-18
Channels
- # announcements (6)
- # aws (1)
- # babashka (47)
- # beginners (50)
- # calva (65)
- # cider (4)
- # clj-commons (17)
- # clj-kondo (44)
- # clojure (150)
- # clojure-europe (41)
- # clojure-nl (4)
- # clojure-spec (1)
- # clojure-sweden (4)
- # clojure-uk (6)
- # clojurescript (15)
- # clr (1)
- # conjure (1)
- # core-async (7)
- # cursive (5)
- # datomic (12)
- # events (2)
- # fulcro (17)
- # graphql (12)
- # introduce-yourself (1)
- # jackdaw (5)
- # jobs (2)
- # lsp (52)
- # malli (5)
- # meander (3)
- # minecraft (2)
- # missionary (2)
- # off-topic (10)
- # other-languages (9)
- # reitit (9)
- # remote-jobs (1)
- # ring (8)
- # rum (7)
- # shadow-cljs (9)
- # sql (2)
- # tools-deps (20)
- # xtdb (12)
I’m parsing the output of clj-kondo to make a dashboard. One thing I’ve noticed is the message for unused binding and unresolved var are close but slightly different, missing a :
:
warning: Unresolved var: Metric
warning: unused binding query
It would make it easier to parse if this was consistent and was Unused binding: query
I thinkor another way is if there was an argument that would have clj-kondo --lint --print-lint src
and the output would be
src/metabase/util/urls.clj:22:20: warning: unresolved-var: Unresolved var: public-settings/site-url
and unresolved-var
the linter is included in the output. Would make some dashboarding a bit easier to categorize how many errors of each type there are.We could make linter messages more consistent. Feel free to make a separate issue for that
i was able to work around it. I'll wait until we chat more in depth. was just trying to get a dashboard up with some metrics around all of our warnings
Hello, I get this error error: update-in with single key
with this function for the second arity %2
:
(defn update-vals [m v f]
(reduce #(update-in % [%2] f) m v))
Yes I understand that, but in my case I use only this function with multiple keys so I want to avoid any condition here. Thanks.
If others are reading: this not an error by default, but a warning, just to be clear. the linter is also optional (off by default).
The way you write it above, update-in is always called with a single key, the %2
argument is the key, not multiple keys, no matter what the value of %2
is.
You can ignore any error with #_:clj-kondo/ignore
but it doesn't make sense to ignore this, clj-kondo is correct in this case.
Yes understand, thanks @U04V15CAJ So to pass the CI tests for my current project, I have no choice to update my function and use condition against the argument to use either update or update-in, right?
> You can ignore any error with #_:clj-kondo/ignore
but it doesn't make sense to ignore this, clj-kondo is correct in this case.
Agree. I don't want to do that and affect all devs of the project just for this function 🙂
Alright! 👍 Thanks to you and clj-kondo!
so yes, you should update your function, but no, you don't have to introduce conditions against the arguments
Yes perfect, I end up with this function:
(defn update-vals [m v f]
(reduce #(update %1 %2 f) m v))
And thanks to clj-kondo, now it's clean.Can we ignore this error only for this case? Without changing Kondo config file?
What happens if you change % to %1?
Thanks for the suggestion. Same error.
cool, sorry it didn’t help
Hallo Michiel. Is this ticket buried? https://github.com/clj-kondo/clj-kondo/issues/801
Michiel, what about this (not mine) ticked? Is it OK that it is automatically closed? https://github.com/clj-kondo/clj-kondo/issues/1179
I'm thinking about making an automated test that would check if no namespaces outside of a particular package use namespaces inside that package.
I'm looking at clj-kondo's :namespace-usage
for this.
Does it make sense to you?
What about the performance?
Note: I haven't used clj-kondo programatically yet, only (sporadically) as a command line tool and in Emacs
@jumar Yes, you can do this using the analysis data. Performance: just lint your own sources, should not take too long (depending on the size of your project of course...). If you lint all dependencies then it will take longer.
@U04V15CAJ
This takes about 4 seconds on my project (30K lines of Clojure code, 300 files)
;; this can take about 4 seconds
(time (def analysis (clj-kondo/run! {:lint ["src"]
:config {:output {:analysis true}}})))
Would you say that's expected running time?