Would it be possible to write a rule which would f...
# ktlint
b
Would it be possible to write a rule which would fail if a certain method was used? We're trying to look at prevent use of
ExecutorService.submit
(and friends) in favor of our own
safeSubmit
since
submit
swallows all exceptions by default.
b
b
Awesome, thanks!
b
Well... Now that I said that... I'm not sure if ktlint supports type resolving. And you will need it.
b
Oh? I don't think I follow
🤦 Ha, just realized you linked to a detekt file
Ok, yeah...I was browsing the PSI viewer and saw no type information when I went to a line making the call, so maybe not with ktlint then
b
To know if
submit
is called over a ExecutorService or not you need to solve the type of the variable. To do that you need type solving.
Correct. Detekt provides that rule out of the box so you can use it with detekt. Or you could handle the type resolution... But that's beyond my knowledge.
b
Ok, thanks @Brais Gabin! I'll poke around.
t
yep, detekt is better solution for this problem. Ktlint is only about code style/formatting and will not cover approaches in coding
👍 1