clj-kondo 2025-01-03

Anyone here has used odoyle-rules and knows some way to tackle its macros using kondo?

I wrote a custom linter for clara rules a few years ago, not exactly the same but perhaps you can use it as inspiration to write your own, my understanding is that odoyle is somewhat simpler than clara, I had never written a linter before and it took some tweaking and repl hacking but absolutely doable.

๐Ÿ™ 1

I'm working on a linter that warns against (= float other-float) since this can cause rounding error issues, e.g. (= 0.1 (- 0.3 0.2)) ;;=> false โ€ข Should this linter be enabled by default? โ€ข What's the recommended alternative? The issue https://github.com/clj-kondo/clj-kondo/issues/2457 So far I've found two occurrences, both in cljs.pprint: https://github.com/clojure/clojurescript/blob/7f7a986be91836046f8d7b29d6ee75b71a8a3cb4/src/main/cljs/cljs/pprint.cljs#L1650 https://github.com/clojure/clojure/blob/fb22fd778a272b034684a4ee94509552b46ee8a9/src/clj/clojure/pprint/cl_format.clj#L801 Reactions in ๐Ÿงต

๐Ÿ‘ 1

๐Ÿงต

I think the sticky part is the recommended alternative. I don't know that there's an obvious, built-in way to compare floating point values. probably there can't be a single one, since depending on the domain you might want to define a relative or absolute tolerance, that sort of thing.

Rationalize all, then compare?

Whenever I need to do this I seem to have better luck comparing doubles, but I'm not really sure what kinds of tradeoffs I make when I do that ๐Ÿ™ˆ