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.
https://github.com/k13labs/clara-rules/tree/main/clj-kondo/clj-kondo.exports/clara/rules
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 ๐งต
๐งต
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 ๐