typelevel-scalafix
typelevel-scalafix copied to clipboard
Scalafix rules for Typelevel projects
Accidentally using `.as` or `.void` after a `.map` is currently an undetectable category of bug, and it's a common and easy mistake to make (the former `map` should probably be...
Inspired by https://github.com/typelevel/otel4s/pull/14#discussion_r898650055. This seems hard and I'm not sure if it's actually possible without making some (arguably reasonable) assumptions like nobody wants a `List[Unit]` :)
I suggest adding a linter that will warn for any discarded value, regardless of its type. This would both catch unused effectful code that's not concrete `IO` - it would...
Edit: although I guess there is an issue of lazyness here 🤔
Code that demands an implicit `cats.effect.Spawn[F]` (or a descendant) and also `cats.Parallel[F]` could be rewritten to demand only the `Spawn[F]` with an `import cats.effect.instances.spawn._`.
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...
This is a cool rule by @mrdziuban. It's not _directly_ about Cats' types, but a good fit nonetheless 😁 https://github.com/mrdziuban/disable-to-string h/t @wsargent
`Either.unit` is a Cats syntax and is cached, so saves the allocation.
Version 0.1.5 ```scala import cats.effect.Resource val foo: Resource[A, B] = ??? val x = foo.map(_ => ()) ``` The rule `TypelevelAs.as` will complain and suggest to rewrite the `map` line...