Skip to content

Commit

Permalink
Merge pull request #181 from davesmith00000/patch-1
Browse files Browse the repository at this point in the history
Update README to include import and Set examples
  • Loading branch information
DavidGregory084 authored Sep 21, 2023
2 parents a98bcf7 + b05916c commit 2afdee6
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,28 @@ Once you are using this plugin we recommend that you don't manipulate the `scala

Instead you should modify the `tpolecatScalacOptions` key or the options key for the relevant mode, for example `tpolecatDevModeOptions` for the development mode.

### Excluding specific warnings

To exclude an individual warning, say to ignore unused imports during testing, you can add the following to your configuration:

```scala
import org.typelevel.scalacoptions.ScalacOptions

Test / tpolecatExcludeOptions += ScalacOptions.warnUnusedImports
```

If you would like to exclude more than one warning, you can add a `Set` of scalac options, like so:

```scala
import org.typelevel.scalacoptions.ScalacOptions

Test / tpolecatExcludeOptions ++= Set(
ScalacOptions.warnValueDiscard,
ScalacOptions.warnUnusedImports,
ScalacOptions.warnUnusedLocals
)
```

### ScalaTest warnings

One of the options configured by **sbt-tpolecat** (`-Wnonunit-statement`) is designed to warn users about discarded values in their code.
Expand All @@ -33,6 +55,8 @@ Unfortunately, this means that in synchronous test suites, every assertion disca
If you find yourself in this situation, you can disable the `-Wnonunit-discard` option in your test suite like so:

```scala
import org.typelevel.scalacoptions.ScalacOptions

Test / tpolecatExcludeOptions += ScalacOptions.warnNonUnitStatement
```

Expand Down

0 comments on commit 2afdee6

Please sign in to comment.