typelevel / typelevel/typelevel-scalafix
Try to warn on `Resource` leak
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 27
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Description
Since I don't know much about scalafix not sure how hard, or even impossible, this will be...
But, it would be great to warn / error if someone tries to leak a Resource using pure or delay inside use; which is a somewhat common beginner mistake.
Maybe a best effort that tries to catch common variations like ra.use(a => a.pure[F]) or ra.use(IO.apply) can be enough?
Another idea would be to warn if use returns an F[A] rather than some F[B] (meaning the same type of the Resource), since on the surface it seems that would never be a good idea; but I may be being too naive.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing how Scalafix rules inspect Resource.use, especially the pure, delay, and IO.apply examples in the issue. Clarify whether the rule should warn on common leak patterns or on matching F[A] types, then define tests that show the selected cases are detected without false positives.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100