Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update scalafmt-core to 2.5.1 #146

Merged
merged 1 commit into from
May 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
version = 2.4.2

version = 2.5.1
style = defaultWithAlign
maxColumn = 100

Expand All @@ -21,4 +20,4 @@ docstrings = JavaDoc
rewrite {
rules = [SortImports, RedundantBraces]
redundantBraces.maxLines = 1
}
}
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
addCommandAlias(
"ci-test",
"git submodule update --init --recursive; scalafmtCheck; scalafmtSbtCheck; docs/tut; +testOnly * -- -minSuccessfulTests 100000"
"git submodule update --init --recursive; scalafmtCheckAll; scalafmtSbtCheck; docs/tut; +testOnly * -- -minSuccessfulTests 100000"
)
addCommandAlias("ci-docs", "project-docs/mdoc; headerCreateAll")
addCommandAlias("ci-microsite", "docs/publishMicrosite")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import org.scalacheck.Arbitrary.arbitrary

object Combinators {

def genPickFromMapWithSuccessAndFailure[A, B](
implicit arbA: Arbitrary[A],
def genPickFromMapWithSuccessAndFailure[A, B](implicit
arbA: Arbitrary[A],
arbB: Arbitrary[B]
): Gen[(Map[A, B], List[A], List[A])] =
for {
Expand All @@ -34,8 +34,8 @@ object Combinators {
invalidPicks = anotherList.filterNot(i => keys.contains(i))
} yield (map, validPicks.toList, invalidPicks)

def genPickFromMapWithSuccess[A, B](
implicit arbA: Arbitrary[A],
def genPickFromMapWithSuccess[A, B](implicit
arbA: Arbitrary[A],
arbB: Arbitrary[B]
): Gen[(Map[A, B], List[A])] =
genPickFromMapWithSuccessAndFailure[A, B].map { case (m, s, _) => (m, s) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ trait Granularity[A] {
}

object Granularity {
implicit def identity[A]: Granularity[A] = new Granularity[A] {
val normalize = (a: A) => a
val description = "None"
}
implicit def identity[A]: Granularity[A] =
new Granularity[A] {
val normalize = (a: A) => a
val description = "None"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ trait GenJdk8 {
minute <- Gen.choose(0, 59)
second <- Gen.choose(0, 59)
nanoOfSecond <- Gen.choose(0, 999999999)
zoneId <- maybeZone
.map(Gen.const)
.getOrElse(Gen.oneOf(ZoneId.getAvailableZoneIds.asScala.toList).map(ZoneId.of))
zoneId <-
maybeZone
.map(Gen.const)
.getOrElse(Gen.oneOf(ZoneId.getAvailableZoneIds.asScala.toList).map(ZoneId.of))
} yield ZonedDateTime
.of(year, month, dayOfMonth, hour, minute, second, nanoOfSecond, zoneId)

Expand All @@ -58,27 +59,27 @@ object ArbitraryJdk8 extends GenJdk8 {

private[this] val utcZoneId: ZoneId = ZoneId.of("UTC")

implicit def arbZonedDateTimeJdk8(
implicit granularity: Granularity[ZonedDateTime]
implicit def arbZonedDateTimeJdk8(implicit
granularity: Granularity[ZonedDateTime]
): Arbitrary[ZonedDateTime] =
Arbitrary(genZonedDateTime)

implicit def arbLocalDateTimeJdk8(
implicit granularity: Granularity[ZonedDateTime]
implicit def arbLocalDateTimeJdk8(implicit
granularity: Granularity[ZonedDateTime]
): Arbitrary[LocalDateTime] =
Arbitrary(
genZonedDateTimeWithZone(Some(utcZoneId)).map(granularity.normalize).map(_.toLocalDateTime)
)

implicit def arbLocalDateJdk8(
implicit granularity: Granularity[ZonedDateTime]
implicit def arbLocalDateJdk8(implicit
granularity: Granularity[ZonedDateTime]
): Arbitrary[LocalDate] =
Arbitrary(
genZonedDateTimeWithZone(Some(utcZoneId)).map(granularity.normalize).map(_.toLocalDate)
)

implicit def arbInstantJdk8(
implicit granularity: Granularity[ZonedDateTime]
implicit def arbInstantJdk8(implicit
granularity: Granularity[ZonedDateTime]
): Arbitrary[Instant] =
Arbitrary(genZonedDateTimeWithZone(Some(utcZoneId)).map(granularity.normalize).map(_.toInstant))
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,30 +60,32 @@ object GenJdk8Properties extends Properties("Java 8 Generators") {

def zeroNanos(dt: ZonedDateTime) = dt.get(NANO_OF_SECOND) == 0
def zeroSeconds(dt: ZonedDateTime) = zeroNanos(dt) && dt.get(SECOND_OF_MINUTE) == 0
def zeroMinutes(dt: ZonedDateTime) = zeroSeconds(dt) && {
// The previous second should be in the previous hour.
// There are cases where half an hour has been taken out of a day,
// such as +58963572-10-01T02:30+11:00[Australia/Lord_Howe]
// One second before is 01:59:59!
val prevSecond = dt.plusSeconds(-1)
val prevHour = dt.plusHours(-1)

prevSecond.get(HOUR_OF_DAY) == prevHour.get(HOUR_OF_DAY)
}
def zeroHours(dt: ZonedDateTime) = zeroMinutes(dt) && {
// Very very rarely, some days start at 1am, rather than 12am
// In this case, check that the minute before is in the day before.
dt.get(HOUR_OF_DAY) match {
case 0 => true
case 1 =>
val prevMinute = dt.plusMinutes(-1)
val prevDay = dt.plusDays(-1)

(prevMinute.get(DAY_OF_YEAR) == prevDay.get(DAY_OF_YEAR)) && (prevMinute
.get(YEAR) == prevDay.get(YEAR))
case _ => false
def zeroMinutes(dt: ZonedDateTime) =
zeroSeconds(dt) && {
// The previous second should be in the previous hour.
// There are cases where half an hour has been taken out of a day,
// such as +58963572-10-01T02:30+11:00[Australia/Lord_Howe]
// One second before is 01:59:59!
val prevSecond = dt.plusSeconds(-1)
val prevHour = dt.plusHours(-1)

prevSecond.get(HOUR_OF_DAY) == prevHour.get(HOUR_OF_DAY)
}
def zeroHours(dt: ZonedDateTime) =
zeroMinutes(dt) && {
// Very very rarely, some days start at 1am, rather than 12am
// In this case, check that the minute before is in the day before.
dt.get(HOUR_OF_DAY) match {
case 0 => true
case 1 =>
val prevMinute = dt.plusMinutes(-1)
val prevDay = dt.plusDays(-1)

(prevMinute.get(DAY_OF_YEAR) == prevDay.get(DAY_OF_YEAR)) && (prevMinute
.get(YEAR) == prevDay.get(YEAR))
case _ => false
}
}
}
def firstDay(dt: ZonedDateTime) = zeroHours(dt) && dt.get(DAY_OF_YEAR) == 1

List(
Expand Down
2 changes: 1 addition & 1 deletion project/ProjectPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ object ProjectPlugin extends AutoPlugin {
lazy val commonDeps = Seq(
libraryDependencies ++= Seq(
"org.scalacheck" %% "scalacheck" % V.scalacheck,
"joda-time" % "joda-time" % V.jodaTime
"joda-time" % "joda-time" % V.jodaTime
)
)
}
Expand Down
22 changes: 11 additions & 11 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
resolvers += Resolver.sonatypeRepo("releases")
addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.3")
addSbtPlugin("com.47deg" % "sbt-microsites" % "1.2.0")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.3.3")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.1.3")
addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.3")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.4.0")
addSbtPlugin("com.alejandrohdezma" %% "sbt-github" % "0.6.0")
addSbtPlugin("com.alejandrohdezma" % "sbt-github-header" % "0.6.0")
addSbtPlugin("com.alejandrohdezma" % "sbt-github-mdoc" % "0.6.0")
addSbtPlugin("com.alejandrohdezma" % "sbt-mdoc-toc" % "0.2")
addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.3")
addSbtPlugin("com.47deg" % "sbt-microsites" % "1.2.0")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.3.3")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.1.3")
addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.3")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.4.0")
addSbtPlugin("com.alejandrohdezma" %% "sbt-github" % "0.6.0")
addSbtPlugin("com.alejandrohdezma" % "sbt-github-header" % "0.6.0")
addSbtPlugin("com.alejandrohdezma" % "sbt-github-mdoc" % "0.6.0")
addSbtPlugin("com.alejandrohdezma" % "sbt-mdoc-toc" % "0.2")