Skip to content

Latest commit

 

History

History
32 lines (19 loc) · 937 Bytes

README.md

File metadata and controls

32 lines (19 loc) · 937 Bytes

NoNoNo

An Scala3 compiler plugin that lets you prevent unsafe function calls.

Setup

TODO: release jars. TODO: usage with sbt TODO: usage with mill

scalac -Xplugin:nonono.jar Something.scala

Configuration

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