This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-09-06
Channels
- # announcements (12)
- # asami (3)
- # babashka (59)
- # beginners (20)
- # biff (1)
- # calva (87)
- # cherry (8)
- # clj-kondo (41)
- # clj-together (4)
- # cljdoc (5)
- # cljfx (4)
- # cljs-dev (2)
- # cljsrn (6)
- # clojure (63)
- # clojure-europe (22)
- # clojure-nl (1)
- # clojure-norway (35)
- # clojure-uk (4)
- # clojurescript (5)
- # conjure (2)
- # datalevin (4)
- # datascript (8)
- # datomic (16)
- # events (1)
- # figwheel-main (1)
- # fulcro (9)
- # hyperfiddle (4)
- # introduce-yourself (1)
- # jobs (3)
- # kaocha (10)
- # lambdaisland (2)
- # lumo (7)
- # nbb (1)
- # off-topic (29)
- # pathom (15)
- # re-frame (80)
- # releases (1)
- # remote-jobs (4)
- # shadow-cljs (13)
- # spacemacs (9)
- # sql (25)
- # squint (32)
- # tools-deps (6)
- # uncomplicate (6)
- # xtdb (15)
Hi all, enjoying clj-kondo !
Is there a line-length linter that I'm too foolish to find?
@peterwestmacott Thank you! clj-kondo does not lint whitespace or length of lines (currently)
Maybe it’s good to stay away from this debate, line length tends to be a very political and emotion filled subject… 🙂
Okay! - is that deliberate choice, or just it's not seemed important enough yet?
I haven't heard many people ask about this, but if you want, you can check if there's already an existing issue or create a new one and then we can see if people have interest
I hope I did that right: https://github.com/clj-kondo/clj-kondo/issues/1794
Yes! In the original template there is a snippet like "if you like this feature, upvote it with a thumbs up". You could leave that in
I think the implementation for this would be pretty easy: walk over the whole file input and emit a lint warning when a line is longer
I know nothing about the internals of clj-kondo, but it certainly sounds like a simple thing to check for.
so basically, every file being linted passes through here:
https://github.com/clj-kondo/clj-kondo/blob/27a12984042afc7dc3d11327f4573a73f51176e3/src/clj_kondo/impl/analyzer.clj#L2725
the input
argument is the file contents as string
When a line is longer than a certain value, you call (findings/reg-finding! ...)
and that's basically it
Are you saying this because it is interesting, or because you hope I will submit a PR? (it might work)
(or for some third reason I've not considered)
I had a go at one: https://github.com/clj-kondo/clj-kondo/pull/1802 I hope I've done it right.
@peterwestmacott Awesome!
Thanks!
@peterwestmacott Have you considered cases like this?
I don't know. :thinking_face:
Again I don't know. I imagine they complain, because the line is too long.
Are you suggesting that this particular line length might be legitimate?
To my mind it is too long and shouldn't be allowed, but I can see that pragmatically that could be annoying.
It seems to point at a fundamental issue with URL length
I could imagine a 'softer' version of the linter that only looked for whitespace beyond the desired line length. That way if your line was too long, but you could argue that you 'didn't have a chance to break it' it would let you off.
Afk rn or I'd check on lein bikeshed to see how it behaves, but I'd put money on it complaining.
@U051BLM8F: What does rubocop do in cases of long urls that can't be broken?
One could say "use a URL shortener" or "link to your issuer tracker and put the super long URL in there"