eastwood

lread 2022-10-06T22:41:33.689529Z

I just let eastwood loose on cljdoc, https://github.com/cljdoc/cljdoc/pull/683.

borkdude 2022-10-07T09:32:17.629899Z

Nice! Btw, there is also a :warn-on-reflection linter in clj-kondo: it doesn't check runtime reflection issues, but just warns that whenever you do Java interop and you haven't explicitly set this var :)

lread 2022-10-07T13:57:16.813459Z

Thanks, it was an interesting exploration! Some of the findings I really appreciated from eastwood were: • when I am using deprecated Java things • all the reflection warnings (although again, one could argue I should not have addressed these for cljdoc) • warnings on suspicious code, like https://github.com/cljdoc/cljdoc/commit/e3560870b2cd3453706455f4e17bf494f2fc1c2f and https://github.com/cljdoc/cljdoc/commit/e50933bed71bb1793b45c0d20a66dc50a9968a91 and https://github.com/cljdoc/cljdoc/commit/2746d1ef43d702ed582acefcd76e5714d748edc9. • and the https://github.com/cljdoc/cljdoc/commit/5788c9b3236781dfdafb710d9ecfb113bda2874c was nice too.

borkdude 2022-10-07T13:59:27.220809Z

Why is the first one suspicious? The second one can be detected by clj-kondo too: :redundant-call

borkdude 2022-10-07T14:00:16.748609Z

The earmuff warning is something we could easily add to clj-kondo too

lread 2022-10-07T14:29:07.971509Z

Ah good old :redudant-call I must not have that enabled for my kondo lint? For the first one, eastwood noticed that the when-not was based on a constant and would always evaluate to the same thing. Not necessarily something I had to address, but I appreciated the heads up. And I think I made the code clearer as a result.

borkdude 2022-10-07T14:29:51.830709Z

ah I see

lread 2022-10-07T14:34:19.061389Z

There was also https://github.com/cljdoc/cljdoc/commit/d1314df5187e79f62ddd86cb948d20012508b194 (the warning was something to do with a let binding, probably after macro-expand?), but in hindsight, I think I might have addressed it mostly to quiet the eastwood warning. Code, I think is fine before and after. So 🤷.

lread 2022-10-06T22:42:34.388499Z

Admittedly I did not need to fix reflection warnings, but they did help me find many old usages of String interop that clojure.string can now replace.

lread 2022-10-06T22:42:48.342609Z

Anyhoo thanks @vemv for all the hard work on eastwood!

vemv 2022-10-06T22:47:38.243739Z

🍺 🍺 ❤️

🍻 4
❤️ 4