WartRemover warts for Play Framework.
| PlayWarts version | WartRemover version | Play version | Scala version | sbt version | Supported | 
|---|---|---|---|---|---|
| 1.2.0 | 2.2.1 | 2.6.7 | 2.11.12, 2.12.4 | 1.0.x, 0.13.x | |
| 1.0.0 | 2.1.1 | 2.6.0 | 2.11.11, 2.12.2 | 0.13.x | No | 
| 0.31.0 (README) | 2.0.1 | 2.5.x | 2.11.x | 0.13.x | No | 
| 0.15 (README) | 0.14 | 2.4.x | 2.11.x | 0.13.x | No | 
- 
Setup WartRemover. 
- 
Add the following to your plugins.sbt:addSbtPlugin("org.danielnixon" % "sbt-playwarts" % "1.2.0") 
- 
Add the following to your build.sbt:wartremoverWarnings ++= Seq( PlayWart.CookiesPartial, PlayWart.FlashPartial, PlayWart.FormPartial, PlayWart.HeadersPartial, PlayWart.InjectedController, PlayWart.JavaApi, PlayWart.JsLookupResultPartial, PlayWart.JsReadablePartial, PlayWart.LangObject, PlayWart.SessionPartial, PlayWart.TypedMapPartial, PlayWart.WSResponsePartial) 
play.api.mvc.Cookies has an apply method that can throw. Use Cookies#get instead.
play.api.mvc.Flash has an apply method that can throw. Use Flash#get instead.
play.api.data.Form has a get method which will throw if the form contains
errors. The program should be refactored to use play.api.data.Form#fold to
explicitly handle forms with errors and successful form submissions.
play.api.mvc.Headers has an apply method that can throw. Use Headers#get instead.
Inheriting from play.api.mvc.InjectedController is disabled because it uses JSR 330 method injection and therefore cannot work without mutability and magic (and it hinders testing). Inherit your controllers from AbstractController instead. See Migration26#Scala-Controller-changes.
The Java API in the play package is disabled. Use the Scala API under play.api instead.
play.api.libs.json.JsLookupResult has a get method which can throw. Use JsLookupResult#getOrElse instead.
play.api.libs.json.JsReadable has an as method which can throw. Use JsReadable#asOpt instead.
The play.api.i18n.Lang object is disabled. Use play.api.i18n.Langs instead.
play.api.mvc.Session has an apply method that can throw. Use Session#get instead.
play.api.libs.typedmap.TypedMap has an apply method that can throw. Use TypedMap#get instead.
The play.api.libs.ws.WSResponse trait defines json and xml methods that will throw if the response body can't be parsed as JSON or XML respectively (the default AhcWSResponse implementation of this trait throws JsonParseException and SAXException). You can wrap these unsafe methods in an implicit class that might look something like this:
implicit class WSResponseWrapper(val response: WSResponse) extends AnyVal {
  @SuppressWarnings(Array("org.danielnixon.playwarts.WSResponsePartial"))
  def jsonOpt: Option[JsValue] = catching[JsValue](classOf[JsonParseException]) opt response.json
  @SuppressWarnings(Array("org.danielnixon.playwarts.WSResponsePartial"))
  def xmlOpt: Option[Elem] = catching[Elem](classOf[SAXException]) opt response.xml
}- sbt-ignore-play-generated: Configure linters and coverage tools to ignore Play's generated source files.
- ExtraWarts: Extra WartRemover warts.
- SlickWarts: WartRemover warts for Slick.
- Scala.js Warts: WartRemover warts for Scala.js.