Custom WartRemover warts from Wiringbits.
The collection intends to prevent common mistakes by developers that aren't very familiar with Scala.
For example, invoking UnsafeRunSync
from cats-effect can lead to pretty bad application's behavior, with this library, you can prevent developers from invoking this method.
A previous version is required, check v0.3.0
net.wiringbits.warts.UnsafeRunSync
: Emits a warning whenunsafeRunSync
is invoked.net.wiringbits.warts.UnsafeRunAndForget
: Emits a warning whenunsafeRunAndForget
is invoked.net.wiringbits.warts.UnsafeRunAsync
: Emits a warning whenunsafeRunAsync
is invoked.net.wiringbits.warts.UnsafeRunAsyncOutcome
: Emits a warning whenunsafeRunAsyncOutcome
is invoked.net.wiringbits.warts.UnsafeRunCancelable
: Emits a warning whenunsafeRunCancelable
is invoked.net.wiringbits.warts.UnsafeRunTimed
: Emits a warning whenunsafeRunTimed
is invoked.net.wiringbits.warts.UnsafeToFuture
: Emits a warning whenunsafeToFuture
is invoked.net.wiringbits.warts.UnsafeToFutureCancelable
: Emits a warning whenunsafeToFutureCancelable
is invoked.
- Be sure to use wartremover in your project.
- Add the dependencies you are interested in:
// choose the modules you are interested in
lazy val wiringbitsWarts = List(
"cats-effect-warts", // cats-effect 3 only
)
libraryDependencies ++= wiringbitsWarts.map { customWart =>
"net.wiringbits" %% customWart % "0.4.3" // pick the latest version
}
wartremoverClasspaths ++= {
(Compile / dependencyClasspath).value.files
.find(item => wiringbitsWarts.exists(item.name.contains))
.map(_.toURI.toString)
.toList
}
- Enable the warts:
wartremoverWarnings += Wart.custom("net.wiringbits.warts.UnsafeRunSync")
- Enable all unsafe warts:
wartremoverWarnings += Wart.custom("net.wiringbits.warts.Unsafe")
It is recommended to turn these warnings into errors when building the project in the CI.