From 3cbeeebb4ac166fefc08cc24a844301811605a36 Mon Sep 17 00:00:00 2001 From: Jakob Odersky Date: Mon, 2 Jul 2018 17:03:48 -0700 Subject: Formatting --- scalastyle-config.xml | 107 +++++++++++++++++++++ .../scala/xyz/driver/core/CoreJsonFormats.scala | 9 +- shared/src/main/scala/xyz/driver/core/core.scala | 12 ++- .../xyz/driver/core/rest/ContextHeaders.scala | 6 +- .../main/scala/xyz/driver/core/rest/sorting.scala | 2 +- 5 files changed, 124 insertions(+), 12 deletions(-) create mode 100644 scalastyle-config.xml diff --git a/scalastyle-config.xml b/scalastyle-config.xml new file mode 100644 index 0000000..348d7f9 --- /dev/null +++ b/scalastyle-config.xml @@ -0,0 +1,107 @@ + + Scalastyle standard configuration + + + + + + + + + package + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/shared/src/main/scala/xyz/driver/core/CoreJsonFormats.scala b/shared/src/main/scala/xyz/driver/core/CoreJsonFormats.scala index 68e741c..fd44162 100644 --- a/shared/src/main/scala/xyz/driver/core/CoreJsonFormats.scala +++ b/shared/src/main/scala/xyz/driver/core/CoreJsonFormats.scala @@ -189,7 +189,7 @@ trait CoreJsonFormats extends DerivedJsonProtocol { override def write(value: T): JsValue = { map.find(_._2 == value).map(_._1) match { case Some(name) => JsString(name) - case _ => serializationError(s"Value $value is not found in the mapping $map") + case _ => serializationError(s"Value $value is not found in the mapping $map") } } @@ -205,7 +205,7 @@ trait CoreJsonFormats extends DerivedJsonProtocol { def read(json: JsValue): T = json match { case JsNumber(value) => create(value) - case _ => deserializationError(s"Expected number as ${typeOf[T].getClass.getName}, but got " + json.toString) + case _ => deserializationError(s"Expected number as ${typeOf[T].getClass.getName}, but got " + json.toString) } } @@ -288,7 +288,8 @@ trait CoreJsonFormats extends DerivedJsonProtocol { } } - implicit def nonEmptyNameFormat[T](implicit nonEmptyStringFormat: JsonFormat[Refined[String, NonEmpty]]): RootJsonFormat[NonEmptyName[T]] = + implicit def nonEmptyNameFormat[T]( + implicit nonEmptyStringFormat: JsonFormat[Refined[String, NonEmpty]]): RootJsonFormat[NonEmptyName[T]] = new RootJsonFormat[NonEmptyName[T]] { def write(name: NonEmptyName[T]) = JsString(name.value.value) @@ -318,4 +319,4 @@ trait CoreJsonFormats extends DerivedJsonProtocol { private[core] object CoreJsonFormats { def unrecognizedValue(value: String, possibleValues: Seq[Any]): Nothing = deserializationError(s"Unexpected value $value. Expected one of: ${possibleValues.mkString("[", ", ", "]")}") -} \ No newline at end of file +} diff --git a/shared/src/main/scala/xyz/driver/core/core.scala b/shared/src/main/scala/xyz/driver/core/core.scala index ea05829..d7bba00 100644 --- a/shared/src/main/scala/xyz/driver/core/core.scala +++ b/shared/src/main/scala/xyz/driver/core/core.scala @@ -118,15 +118,19 @@ package core { implicit def nonEmptyNameOrdering[T]: Ordering[NonEmptyName[T]] = Ordering.by(_.value.value) } - @deprecated("Base64 formats are rarely used in core and will be removed. Please implement the wrapper type in " + - "services, or open an issue if you think it should stay in core.", "driver-core 1.11.5") + @deprecated( + "Base64 formats are rarely used in core and will be removed. Please implement the wrapper type in " + + "services, or open an issue if you think it should stay in core.", + "driver-core 1.11.5") final case class Revision[T](id: String) object Revision { implicit def revisionEqual[T]: Equal[Revision[T]] = Equal.equal[Revision[T]](_.id == _.id) } - @deprecated("Base64 formats are rarely used in core and will be removed. Please implement the wrapper type in " + - "services, or open an issue if you think it should stay in core.", "driver-core 1.11.5") + @deprecated( + "Base64 formats are rarely used in core and will be removed. Please implement the wrapper type in " + + "services, or open an issue if you think it should stay in core.", + "driver-core 1.11.5") final case class Base64(value: String) } diff --git a/shared/src/main/scala/xyz/driver/core/rest/ContextHeaders.scala b/shared/src/main/scala/xyz/driver/core/rest/ContextHeaders.scala index 7efe84c..5e9ae3e 100644 --- a/shared/src/main/scala/xyz/driver/core/rest/ContextHeaders.scala +++ b/shared/src/main/scala/xyz/driver/core/rest/ContextHeaders.scala @@ -10,6 +10,6 @@ object ContextHeaders { val OriginatingIpHeader: String = "X-Forwarded-For" val ResourceCount: String = "X-Resource-Count" val PageCount: String = "X-Page-Count" - val TraceHeaderName = "Tracing-Trace-Id" - val SpanHeaderName = "Tracing-Span-Id" - } \ No newline at end of file + val TraceHeaderName = "Tracing-Trace-Id" + val SpanHeaderName = "Tracing-Span-Id" +} diff --git a/shared/src/main/scala/xyz/driver/core/rest/sorting.scala b/shared/src/main/scala/xyz/driver/core/rest/sorting.scala index ccdf150..5b68d2a 100644 --- a/shared/src/main/scala/xyz/driver/core/rest/sorting.scala +++ b/shared/src/main/scala/xyz/driver/core/rest/sorting.scala @@ -32,4 +32,4 @@ object ListResponse { Meta(itemsCount, pagination.pageNumber, pagination.pageSize) } -} \ No newline at end of file +} -- cgit v1.2.3