All Projects → danielnixon → playwarts

danielnixon / playwarts

Licence: Apache-2.0 license
WartRemover warts for Play Framework.

Programming Languages

scala
5932 projects

Projects that are alternatives of or similar to playwarts

Sbt Ignore Play Generated
Configure linters and coverage tools to ignore Play's generated source files.
Stars: ✭ 10 (-56.52%)
Mutual labels:  play-framework, sbt-plugin
Api First Hand
API-First bootstrapping tool for building RESTful web services from a Swagger/OpenAPI spec
Stars: ✭ 138 (+500%)
Mutual labels:  play-framework, sbt-plugin
sbt-sass
A fork of the sbt-sass repository which seems to be abandoned.
Stars: ✭ 32 (+39.13%)
Mutual labels:  play-framework, sbt-plugin
play2-scala-pdf
A PDF module for Play Framework 2 (Scala)
Stars: ✭ 25 (+8.7%)
Mutual labels:  play-framework
vault
A typed, persistent store for values of arbitrary types
Stars: ✭ 55 (+139.13%)
Mutual labels:  type-safety
sbt-travisci
An sbt plugin to integrate with Travis CI
Stars: ✭ 44 (+91.3%)
Mutual labels:  sbt-plugin
typed flags
Type-safe and human-readable set of bool flags
Stars: ✭ 23 (+0%)
Mutual labels:  type-safety
kanji
A strongly typed GraphQL API framework
Stars: ✭ 12 (-47.83%)
Mutual labels:  type-safety
sbt-play-npm
Integrate a Npm application with Play framework
Stars: ✭ 10 (-56.52%)
Mutual labels:  sbt-plugin
address-index-api
Address Index is an application which resolves addresses
Stars: ✭ 26 (+13.04%)
Mutual labels:  play-framework
play-silhouette-reactivemongo-seed
Seed Application for PlayFramework, Silhouette and ReactiveMongo
Stars: ✭ 22 (-4.35%)
Mutual labels:  play-framework
sbt-swagger-2
sbt plugin for generating Swagger JSON schemas during build
Stars: ✭ 13 (-43.48%)
Mutual labels:  sbt-plugin
sbt-project-switcher
A sbt plugin to switch project in a snappy way⚡️
Stars: ✭ 36 (+56.52%)
Mutual labels:  sbt-plugin
play-ebean
Play Ebean module
Stars: ✭ 29 (+26.09%)
Mutual labels:  play-framework
sbt-guardrail
Principled code generation from OpenAPI specifications
Stars: ✭ 24 (+4.35%)
Mutual labels:  sbt-plugin
regbits
C++ templates for type-safe bit manipulation
Stars: ✭ 53 (+130.43%)
Mutual labels:  type-safety
sbt-bazel
Easily convert SBT projects to Bazel workspaces
Stars: ✭ 55 (+139.13%)
Mutual labels:  sbt-plugin
benchdb
A database and query tool for JMH benchmark results
Stars: ✭ 58 (+152.17%)
Mutual labels:  sbt-plugin
tsafe
🔩 The missing TypeScript utils
Stars: ✭ 285 (+1139.13%)
Mutual labels:  type-safety
playframework
Gradle Play Support
Stars: ✭ 41 (+78.26%)
Mutual labels:  play-framework

PlayWarts

Build Status Dependency Status Codacy Badge Maven Central

WartRemover warts for Play Framework.

Versions

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

Usage

  1. Setup WartRemover.

  2. Add the following to your plugins.sbt:

    addSbtPlugin("org.danielnixon" % "sbt-playwarts" % "1.2.0")
  3. 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)

Warts

Play Framework

CookiesPartial

play.api.mvc.Cookies has an apply method that can throw. Use Cookies#get instead.

FlashPartial

play.api.mvc.Flash has an apply method that can throw. Use Flash#get instead.

FormPartial

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.

HeadersPartial

play.api.mvc.Headers has an apply method that can throw. Use Headers#get instead.

InjectedController

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.

JavaApi

The Java API in the play package is disabled. Use the Scala API under play.api instead.

JsLookupResultPartial

play.api.libs.json.JsLookupResult has a get method which can throw. Use JsLookupResult#getOrElse instead.

JsReadablePartial

play.api.libs.json.JsReadable has an as method which can throw. Use JsReadable#asOpt instead.

LangObject

The play.api.i18n.Lang object is disabled. Use play.api.i18n.Langs instead.

SessionPartial

play.api.mvc.Session has an apply method that can throw. Use Session#get instead.

TypedMapPartial

play.api.libs.typedmap.TypedMap has an apply method that can throw. Use TypedMap#get instead.

WSResponsePartial

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
}

See also

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].