-
Notifications
You must be signed in to change notification settings - Fork 94
Open
Labels
Description
sample build.sbt
:
lazy val literalThing = (project in file("literalThing")).settings(
libraryDependencies ++= Seq(
"com.comcast" %% "ip4s-core" % "3.6.0"
)
)
literalThing/src/main/scala/Main.scala
:
import com.comcast.ip4s.*
object Main {
def main(args: Array[String]): Unit = {
println(port"8080")
}
}
produces the following when running literalThing/scapegoat
:
[project directory]\shared\src\main\scala-3\Literals.scala: [scapegoat] [OptionGet] Use of Option.get
[error] Using Option.get defeats the purpose of using Option in the first place. Use the following instead: Option.getOrElse, Option.fold, pattern matching or don't take the value out of the container and map over it to transform it.
[error]
[error] [scapegoat] Analysis complete: 1 errors 0 warns 0 infos
I'm guessing what's happening is that since the port interpolator is defined as inline, Scapegoat reports on it even though it's not actually part of the project's sources.