This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-04
Channels
- # aleph (23)
- # announcements (1)
- # babashka (21)
- # beginners (70)
- # biff (3)
- # cider (8)
- # clj-kondo (45)
- # clj-yaml (9)
- # clojure (69)
- # clojure-europe (82)
- # clojure-nl (1)
- # clojure-norway (2)
- # clojurescript (34)
- # conjure (19)
- # core-typed (6)
- # cursive (2)
- # events (5)
- # fulcro (55)
- # honeysql (1)
- # integrant (18)
- # jobs (1)
- # lsp (124)
- # malli (10)
- # meander (1)
- # off-topic (26)
- # polylith (8)
- # reagent (7)
- # releases (1)
- # remote-jobs (1)
- # sci (2)
- # shadow-cljs (19)
- # squint (5)
- # vim (17)
- # xtdb (31)
Probably a total non-issue and i'm just being pedantic, but i notice that some linter messages start with a capital letter, and some don't 🙂
Yes, we moved from non-capital to capital and this is now the preferred style, but changing the old ones might break people's builds
I've got data like
{:name-end-col 17,
:name-end-row 24,
:name-row 24,
:name a,
:filename
"...",
:alias d,
:from amperity.web.workflows.workflow.resolutions.plugin,
:col nil,
:name-col 14,
:from-var credentials-page-link-component,
:arity 3,
:row nil,
:to helix.dom}
I came across this when running analysis on a bunch of libraries. It is a fairly common thing in the wild.
What clj-kondo could maybe do is remember the col / row of the parent and report that as a fallback
Actually, I thought I did something to fix that in https://github.com/clj-kondo/clj-kondo/issues/1812
But this isn't released yet. Perhaps @U4YGF4NGM can try with the master version. I hope to finish this release tomorrow
just tried what's in master f0935686f0c4e5690b0965189a7bb11f85b5510d
and i still get nil
for :row
and :col
for the same number of vars
Ah, I'm afk right now so can't browse the rest of the kondo source but it looks like the tests I added were only for :var-definitions. I guess usages has a similar problem that was not fixed there.
Yeah, it's just many hooks out there currently have this problem. I guess it depends on the use case. If there can be some fallback added that provides better results without fixing every hook that omits meta, it would be nice.
I can take a shot at a fix in a week or two if no one gets around to it by then.
this change seems to fix most of the issues for helix code https://github.com/lilactown/helix/commit/09a72365004ee788b8d3f74d7cb2fd4144a17f00
@UPWHQK562 By introducing the fix, I could also revert your change in PR 1813. Can you check if that makes sense? https://github.com/clj-kondo/clj-kondo/compare/fallback-location-for-hooks?w=1 @U4YGF4NGM Could you test with this branch / SHA of clj-kondo?
@U04V15CAJ traveling right now so can't do the most thorough review but it looks good. I wonder if you can also simplify the :name-row etc. fields so the logic a few lines below in reg-var! can be consistent.
The gist of it is you're moving the fallback logic to a more generic location and giving it the explicit name :fallback-loc?
I looked at your other (or (:name-row ...) ...)
stuff @UPWHQK562 but this was still necessary
Alright, it would have been nice to make it consistent but this is still a nice improvement. Thanks for working on this, @U04V15CAJ 🙏
ok @U4YGF4NGM and @UPWHQK562
I merged the final solution to master now. I already had a similar solution for :macroexpand
hooks but I now applied the same solution to :analyze-hook
for nodes that don't have a location
https://github.com/clj-kondo/clj-kondo/commit/17423d1b90498c4667663bd256056fd38bffc46c
Please test
@U04V15CAJ Nice, that looks like a much more elegant overall solution. Looking forward to testing this out shortly.
is setting {:cljc {:features [:clj]}}
still the proper way to lint a bb/clojure namespace?