An Scala3 compiler plugin that lets you prevent unsafe function calls.
TODO: release jars. TODO: usage with sbt TODO: usage with mill
scalac -Xplugin:nonono.jar Something.scala
Suppose you want to prevent developers using Option.get
on your codebase.
The following NoNoNo definition prevents such cases:
NoNoNo[Option[Any]](_.get)("Prefer using getOrElse")
TODO: currently, the plugin expects NoNoNo definitions on the same compilation unit. Make it possible for the plugin to take an option with a scala file to read definitions from.
You can customize the type parameter to match for example, only Option[String]
.
See more examples in tests