Skip to content

Commit

Permalink
Reformat files according to new scalafmt version
Browse files Browse the repository at this point in the history
  • Loading branch information
jcazevedo committed Oct 6, 2020
1 parent 2a911c1 commit fe1d17e
Show file tree
Hide file tree
Showing 83 changed files with 343 additions and 686 deletions.
3 changes: 1 addition & 2 deletions core/src/main/scala-2.12-/pureconfig/FactoryCompat.scala
Expand Up @@ -3,8 +3,7 @@ package pureconfig
import scala.collection.generic.CanBuildFrom
import scala.collection.mutable

/**
* A compatibility layer for creating `CanBuildFrom`-like generic methods that work both on Scala 2.13 and pre-2.13
/** A compatibility layer for creating `CanBuildFrom`-like generic methods that work both on Scala 2.13 and pre-2.13
* versions.
*
* @tparam A the type of elements that get added to the builder
Expand Down
3 changes: 1 addition & 2 deletions core/src/main/scala-2.13/pureconfig/FactoryCompat.scala
Expand Up @@ -3,8 +3,7 @@ package pureconfig
import scala.collection.Factory
import scala.collection.mutable

/**
* A compatibility layer for creating `CanBuildFrom`-like generic methods that work both on Scala 2.13 and pre-2.13
/** A compatibility layer for creating `CanBuildFrom`-like generic methods that work both on Scala 2.13 and pre-2.13
* versions.
*
* @tparam A the type of elements that get added to the builder
Expand Down
27 changes: 9 additions & 18 deletions core/src/main/scala/pureconfig/BasicReaders.scala
Expand Up @@ -19,8 +19,7 @@ import pureconfig.error._

import scala.util.Try

/**
* Trait containing `ConfigReader` instances for primitive types.
/** Trait containing `ConfigReader` instances for primitive types.
*/
trait PrimitiveReaders {

Expand Down Expand Up @@ -62,8 +61,7 @@ trait PrimitiveReaders {
implicit val byteConfigReader = ConfigReader.fromCursor(_.asByte)
}

/**
* Trait containing `ConfigReader` instance for Java Enums.
/** Trait containing `ConfigReader` instance for Java Enums.
*/
trait JavaEnumReader {

Expand All @@ -74,8 +72,7 @@ trait JavaEnumReader {
}))
}

/**
* Trait containing `ConfigReader` instances for classes related to file system paths and URIs.
/** Trait containing `ConfigReader` instances for classes related to file system paths and URIs.
*/
trait UriAndPathReaders {

Expand All @@ -86,17 +83,15 @@ trait UriAndPathReaders {
implicit val uriConfigReader = ConfigReader.fromString[URI](catchReadError(new URI(_)))
}

/**
* Trait containing `ConfigReader` instances for classes related to regular expressions.
/** Trait containing `ConfigReader` instances for classes related to regular expressions.
*/
trait RegexReaders {

implicit val patternReader = ConfigReader.fromString[Pattern](catchReadError(Pattern.compile))
implicit val regexReader = ConfigReader.fromString[Regex](catchReadError(new Regex(_)))
}

/**
* Trait containing `ConfigReader` instances for `java.time` classes.
/** Trait containing `ConfigReader` instances for `java.time` classes.
*/
trait JavaTimeReaders {

Expand All @@ -119,8 +114,7 @@ trait JavaTimeReaders {
ConfigReader.fromNonEmptyString[Year](catchReadError(Year.parse))
}

/**
* Trait containing `ConfigReader` instances for [[scala.concurrent.duration.Duration]] and
/** Trait containing `ConfigReader` instances for [[scala.concurrent.duration.Duration]] and
* [[scala.concurrent.duration.FiniteDuration]].
*/
trait DurationReaders {
Expand All @@ -146,8 +140,7 @@ trait DurationReaders {
}
}

/**
* Trait containing `ConfigReader` instances for Java and Scala arbitrary-precision numeric types.
/** Trait containing `ConfigReader` instances for Java and Scala arbitrary-precision numeric types.
*/
trait NumericReaders {

Expand All @@ -164,8 +157,7 @@ trait NumericReaders {
ConfigReader.fromNonEmptyString[BigDecimal](catchReadError(BigDecimal(_)))
}

/**
* Trait containing `ConfigReader` instances for Typesafe config models.
/** Trait containing `ConfigReader` instances for Typesafe config models.
*/
trait TypesafeConfigReaders {

Expand Down Expand Up @@ -197,8 +189,7 @@ trait TypesafeConfigReaders {
}
}

/**
* Trait containing `ConfigReader` instances for primitive types and simple classes in Java and Scala standard
/** Trait containing `ConfigReader` instances for primitive types and simple classes in Java and Scala standard
* libraries.
*/
trait BasicReaders
Expand Down
27 changes: 9 additions & 18 deletions core/src/main/scala/pureconfig/BasicWriters.scala
Expand Up @@ -15,8 +15,7 @@ import scala.util.matching.Regex

import com.typesafe.config._

/**
* Trait containing `ConfigWriter` instances for primitive types.
/** Trait containing `ConfigWriter` instances for primitive types.
*/
trait PrimitiveWriters {

Expand All @@ -31,16 +30,14 @@ trait PrimitiveWriters {
implicit val byteConfigWriter = ConfigWriter.forPrimitive[Byte]
}

/**
* Trait containing instance for `ConfigWriter` for Java Enum.
/** Trait containing instance for `ConfigWriter` for Java Enum.
*/
trait JavaEnumWriter {

implicit def javaEnumWriter[A <: Enum[A]]: ConfigWriter[A] = ConfigWriter.toDefaultString[A]
}

/**
* Trait containing `ConfigWriter` instances for classes related to file system paths and URIs.
/** Trait containing `ConfigWriter` instances for classes related to file system paths and URIs.
*/
trait UriAndPathWriters {

Expand All @@ -51,17 +48,15 @@ trait UriAndPathWriters {
implicit val uriConfigWriter = ConfigWriter.toDefaultString[URI]
}

/**
* Trait containing `ConfigWriter` instances for classes related to regular expressions.
/** Trait containing `ConfigWriter` instances for classes related to regular expressions.
*/
trait RegexWriters {

implicit val patternWriter = ConfigWriter.toString[Pattern](_.pattern)
implicit val regexWriter = ConfigWriter.toString[Regex](_.pattern.pattern) // Regex.regex isn't supported until 2.11
}

/**
* Trait containing `ConfigWriter` instances for `java.time` classes.
/** Trait containing `ConfigWriter` instances for `java.time` classes.
*/
trait JavaTimeWriters {

Expand All @@ -78,8 +73,7 @@ trait JavaTimeWriters {
implicit val javaDurationConfigWriter = ConfigWriter.toDefaultString[JavaDuration]
}

/**
* Trait containing `ConfigWriter` instances for [[scala.concurrent.duration.Duration]] and
/** Trait containing `ConfigWriter` instances for [[scala.concurrent.duration.Duration]] and
* [[scala.concurrent.duration.FiniteDuration]].
*/
trait DurationWriters {
Expand All @@ -88,8 +82,7 @@ trait DurationWriters {
implicit val finiteDurationConfigWriter = ConfigWriter.toString[FiniteDuration](DurationUtils.fromDuration)
}

/**
* Trait containing `ConfigWriter` instances for Java and Scala arbitrary-precision numeric types.
/** Trait containing `ConfigWriter` instances for Java and Scala arbitrary-precision numeric types.
*/
trait NumericWriters {

Expand All @@ -99,8 +92,7 @@ trait NumericWriters {
implicit val scalaBigIntWriter: ConfigWriter[BigInt] = ConfigWriter.toDefaultString[BigInt]
}

/**
* Trait containing `ConfigWriter` instances for Typesafe config models.
/** Trait containing `ConfigWriter` instances for Typesafe config models.
*/
trait TypesafeConfigWriters {

Expand All @@ -125,8 +117,7 @@ trait TypesafeConfigWriters {
}
}

/**
* Trait containing `ConfigWriter` instances for primitive types and simple classes in Java and Scala standard
/** Trait containing `ConfigWriter` instances for primitive types and simple classes in Java and Scala standard
* libraries.
*/
trait BasicWriters
Expand Down
6 changes: 2 additions & 4 deletions core/src/main/scala/pureconfig/CollectionReaders.scala
Expand Up @@ -3,17 +3,15 @@ package pureconfig
import scala.language.higherKinds
import scala.reflect.ClassTag

/**
* A marker trait signaling that a `ConfigReader` accepts missing (undefined) values.
/** A marker trait signaling that a `ConfigReader` accepts missing (undefined) values.
*
* The standard behavior of `ConfigReader`s that expect required keys in config objects is to return a `KeyNotFound`
* failure when one or more of them are missing. Mixing in this trait into the key's `ConfigReader` signals that if
* a value is missing for the key, the `ConfigReader` can be called with a cursor in the "undefined" state.
*/
trait ReadsMissingKeys { this: ConfigReader[_] => }

/**
* Trait containing `ConfigReader` instances for collection types.
/** Trait containing `ConfigReader` instances for collection types.
*/
trait CollectionReaders {

Expand Down
6 changes: 2 additions & 4 deletions core/src/main/scala/pureconfig/CollectionWriters.scala
Expand Up @@ -5,8 +5,7 @@ import scala.language.higherKinds

import com.typesafe.config._

/**
* A trait signaling that a `ConfigWriter` can write missing (undefined) values.
/** A trait signaling that a `ConfigWriter` can write missing (undefined) values.
*
* `ConfigWriter`s always produce a valid `ConfigValue` with their `to` method. This trait adds an extra `toOpt`
* method that parent writers can use in order to decide whether or not they should write a value using this writer.
Expand All @@ -15,8 +14,7 @@ trait WritesMissingKeys[A] { this: ConfigWriter[A] =>
def toOpt(a: A): Option[ConfigValue]
}

/**
* Trait containing `ConfigWriter` instances for collection types.
/** Trait containing `ConfigWriter` instances for collection types.
*/
trait CollectionWriters {

Expand Down
15 changes: 5 additions & 10 deletions core/src/main/scala/pureconfig/ConfigConvert.scala
@@ -1,8 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* @author Mario Pastorelli
/** @author Mario Pastorelli
*/
package pureconfig

Expand All @@ -11,13 +10,11 @@ import scala.util.Try

import pureconfig.error.FailureReason

/**
* Trait for objects capable of reading and writing objects of a given type from and to `ConfigValues`.
/** Trait for objects capable of reading and writing objects of a given type from and to `ConfigValues`.
*/
trait ConfigConvert[A] extends ConfigReader[A] with ConfigWriter[A] { outer =>

/**
* Transforms the values read and written by this `ConfigConvert` using two functions.
/** Transforms the values read and written by this `ConfigConvert` using two functions.
*
* @param f the function applied to values after they are read; a thrown exception will be caught and converted to a pureconfig FailureReason
* @param g the function applied to values before they are written
Expand All @@ -28,8 +25,7 @@ trait ConfigConvert[A] extends ConfigReader[A] with ConfigWriter[A] { outer =>
def xmap[B](f: A => B, g: B => A): ConfigConvert[B] =
ConfigConvert(map(f), contramap(g))

/**
* Transforms the values read and written by this `ConfigConvert` using two functions where the reader may
/** Transforms the values read and written by this `ConfigConvert` using two functions where the reader may
* specify custom failure reason.
*
* @param f the function applied to values after they are read
Expand All @@ -42,8 +38,7 @@ trait ConfigConvert[A] extends ConfigReader[A] with ConfigWriter[A] { outer =>
ConfigConvert(emap(f), contramap(g))
}

/**
* Provides methods to create [[ConfigConvert]] instances.
/** Provides methods to create [[ConfigConvert]] instances.
*/
object ConfigConvert extends ConvertHelpers {

Expand Down

0 comments on commit fe1d17e

Please sign in to comment.