eastwood

All things realted to eastwood - the Clojure linter
2019-11-29T10:24:56.037100Z

I'm having troubles writing the right disable-warning rule

2019-11-29T10:25:22.037600Z

I have something like

(is (thrown-with-msg? Exception #"Something"
                      (seq (lazy-function))))

2019-11-29T10:25:53.038300Z

which raises this kind of warning unused-ret-vals-in-try: Lazy function call return value is discarded inside body of try

2019-11-29T10:26:17.038900Z

I tried to use the :file or the :symbol-matches or a few other things but nothing seems to work

borkdude 2019-11-29T10:27:43.039200Z

seq still doesn't realize the entire body

borkdude 2019-11-29T10:27:49.039400Z

so the warning may be justified

2019-11-29T10:30:06.040200Z

well it doesn't matter, it just needs to evaluate "enough" to throw the exception

2019-11-29T10:30:09.040400Z

which it does

borkdude 2019-11-29T10:31:20.041700Z

ok, I don't know enough about eastwood to help you, but if you write doall, does the warning go away? 🙂

2019-11-29T10:31:33.042Z

no it doesn't

2019-11-29T10:31:36.042300Z

that's how it was originally

2019-11-29T10:31:54.043300Z

and well in theory I can disable linters, but I always struggle to get it right

2019-11-29T10:34:44.044200Z

uhm just adding a helper function that does the doall (lazy-function works

2019-11-29T10:35:00.044700Z

seems a bit silly but ok as long as it works

2019-11-29T19:19:54.045100Z

what about dorun? doall still implies something should consume the result

2019-11-29T19:20:14.045600Z

while dorun means specifically that you want full evaluation and the values don't matter