Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detekt rule to detect missing .bind() calls inside suspendBinding and binding #103

Open
kirillzh opened this issue May 14, 2024 · 3 comments

Comments

@kirillzh
Copy link
Contributor

kirillzh commented May 14, 2024

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.

@michaelbull
Copy link
Owner

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?

@michaelbull
Copy link
Owner

Ping @kirillzh.

@kirillzh
Copy link
Contributor Author

kirillzh commented Jun 5, 2024

I couldn't think of any other rules that might be helpful to write!

Here are some links that could be helpful here:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants