kotlin-result
kotlin-result copied to clipboard
Detekt rule to detect missing `.bind()` calls inside `suspendBinding` and `binding`
It's very easy to forget calling .bind() on a method especially when the rest of the binding block doesn't depend on the return result of this method (eg a Result<Unit, Error> fire and forget call):
binding {
val a = getSomeValue().bind()
saveValue(a) // forgot .bind() here
doSomethingElse(a).bind()
}
It would be very helpful if we provided an out of the box Detekt rule to catch this, similar to how Arrow has it implemented here.
Seems like a good idea. I wonder if there are any other Detekt rules worth writing for the library? Is there good documentation on how you write a Detekt rule + plug it in?
Ping @kirillzh.
I couldn't think of any other rules that might be helpful to write!
Here are some links that could be helpful here:
- https://detekt.dev/docs/introduction/extensions/
- https://github.com/woltapp/arrow-detekt-rules
@michaelbull, are there no plans to implement this? Just curious why this was closed. Thanks!
@kirillzh a PR is welcome. It was closed as its a stale issue that no active discussion is happening on.
If you would like to pick up the work to implement this in a PR, I am happy to be involved and review to get it across the line.
Do you have any plans to progress the feature you are requesting?