An open API service indexing awesome lists of open source software.

https://github.com/vic/nonono

NoNoNo is an Scala3 compiler plugin that lets you prevent unsafe function calls.
https://github.com/vic/nonono

compiler-plugin dotty dotty-plugin scala3 scala3-plugin wartremover

Last synced: 4 months ago
JSON representation

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

Awesome Lists containing this project

README

        

# NoNoNo

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

### Setup

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

```scala
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:

```scala
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)