Skip to content

Repository files navigation

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

About

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

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages