clj-kondo

2025-01-03T14:36:31.255449Z

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

jgomez 2025-01-03T14:50:41.752559Z

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
borkdude 2025-01-03T15:11:31.729529Z

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
borkdude 2025-01-03T15:11:38.014229Z

๐Ÿงต

2025-01-03T16:43:13.747859Z

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.

henrik 2025-01-03T17:17:20.088859Z

Rationalize all, then compare?

cjohansen 2025-01-04T07:35:10.883729Z

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 ๐Ÿ™ˆ