Skip to content
vic

vic/nonono

NoNoNo is an Scala3 compiler plugin that lets you prevent unsafe function calls.

vic/nonono.json
{
"defaultBranch": "main",
"description": "NoNoNo is an Scala3 compiler plugin that lets you prevent unsafe function calls.",
"fullName": "vic/nonono",
"homepage": "",
"language": "Scala",
"name": "nonono",
"pushedAt": "2022-03-14T23:49:59Z",
"stargazersCount": 0,
"updatedAt": "2022-03-14T08:36:14Z",
"url": "https://github.com/vic/nonono"
}

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")
Screen Shot 2022-03-12 at 10 43 58

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]!(nonono-plugin/tests/src/nonono/PluginTest.scala)