From 0d5e07282c8d4010a6ef8e99d586d084435f77a4 Mon Sep 17 00:00:00 2001 From: "Frank S. Thomas" Date: Wed, 6 Jan 2016 18:47:32 +0100 Subject: [PATCH] Fix Scalastyle This contains a workaround for https://github.com/scalastyle/scalastyle-sbt-plugin/issues/47 --- build.sbt | 4 ++++ .../scala/eu/timepit/refined/scalacheck/numeric.scala | 4 ++-- .../src/main/scala/eu/timepit/refined/api/Validate.scala | 1 - core/shared/src/main/scala/eu/timepit/refined/auto.scala | 2 +- .../src/main/scala/eu/timepit/refined/boolean.scala | 4 ++-- .../src/main/scala/eu/timepit/refined/collection.scala | 2 +- .../src/main/scala/eu/timepit/refined/generic.scala | 7 +++---- .../scala/eu/timepit/refined/internal/Resources.scala | 1 - .../main/scala/eu/timepit/refined/macros/InferMacro.scala | 1 - .../main/scala/eu/timepit/refined/macros/MacroUtils.scala | 1 - .../scala/eu/timepit/refined/macros/RefineMacro.scala | 1 - .../src/main/scala/eu/timepit/refined/numeric.scala | 8 ++++---- .../src/main/scala/eu/timepit/refined/package.scala | 2 +- .../shared/src/main/scala/eu/timepit/refined/string.scala | 2 +- 14 files changed, 19 insertions(+), 21 deletions(-) diff --git a/build.sbt b/build.sbt index 8665c4a8e..ab9da6004 100644 --- a/build.sbt +++ b/build.sbt @@ -291,6 +291,10 @@ lazy val myDoctestSettings = lazy val styleSettings = scalariformSettings ++ Seq( + // workaround for https://github.com/scalastyle/scalastyle-sbt-plugin/issues/47 + scalastyleSources in Compile := + (unmanagedSourceDirectories in Compile).value, + sourceDirectories in (Compile, SbtScalariform.ScalariformKeys.format) := (sourceDirectories in Compile).value, sourceDirectories in (Test, SbtScalariform.ScalariformKeys.format) := diff --git a/contrib/scalacheck/shared/src/main/scala/eu/timepit/refined/scalacheck/numeric.scala b/contrib/scalacheck/shared/src/main/scala/eu/timepit/refined/scalacheck/numeric.scala index c63ddc9af..e892fc122 100644 --- a/contrib/scalacheck/shared/src/main/scala/eu/timepit/refined/scalacheck/numeric.scala +++ b/contrib/scalacheck/shared/src/main/scala/eu/timepit/refined/scalacheck/numeric.scala @@ -3,10 +3,10 @@ package scalacheck import eu.timepit.refined.api.{ RefType, Validate } import eu.timepit.refined.numeric._ -import org.scalacheck.Gen.Choose import org.scalacheck.{ Arbitrary, Gen } -import shapeless.ops.nat.ToInt +import org.scalacheck.Gen.Choose import shapeless.{ Nat, Witness } +import shapeless.ops.nat.ToInt object numeric { diff --git a/core/shared/src/main/scala/eu/timepit/refined/api/Validate.scala b/core/shared/src/main/scala/eu/timepit/refined/api/Validate.scala index 519ac64ea..7d121b61a 100644 --- a/core/shared/src/main/scala/eu/timepit/refined/api/Validate.scala +++ b/core/shared/src/main/scala/eu/timepit/refined/api/Validate.scala @@ -2,7 +2,6 @@ package eu.timepit.refined package api import eu.timepit.refined.internal.Resources - import scala.util.Try /** diff --git a/core/shared/src/main/scala/eu/timepit/refined/auto.scala b/core/shared/src/main/scala/eu/timepit/refined/auto.scala index e66bf4f1d..5db6e9291 100644 --- a/core/shared/src/main/scala/eu/timepit/refined/auto.scala +++ b/core/shared/src/main/scala/eu/timepit/refined/auto.scala @@ -1,7 +1,7 @@ package eu.timepit.refined +import eu.timepit.refined.api.{ Refined, RefType, Validate } import eu.timepit.refined.api.Inference.==> -import eu.timepit.refined.api.{ RefType, Refined, Validate } import eu.timepit.refined.macros.{ InferMacro, RefineMacro } import shapeless.tag.@@ diff --git a/core/shared/src/main/scala/eu/timepit/refined/boolean.scala b/core/shared/src/main/scala/eu/timepit/refined/boolean.scala index 0226f7619..9672d9132 100644 --- a/core/shared/src/main/scala/eu/timepit/refined/boolean.scala +++ b/core/shared/src/main/scala/eu/timepit/refined/boolean.scala @@ -1,11 +1,11 @@ package eu.timepit.refined -import eu.timepit.refined.api.Inference.==> import eu.timepit.refined.api._ +import eu.timepit.refined.api.Inference.==> import eu.timepit.refined.boolean._ import eu.timepit.refined.internal.Resources -import shapeless.ops.hlist.ToList import shapeless.{ ::, HList, HNil } +import shapeless.ops.hlist.ToList object boolean extends BooleanValidate with BooleanInference0 { diff --git a/core/shared/src/main/scala/eu/timepit/refined/collection.scala b/core/shared/src/main/scala/eu/timepit/refined/collection.scala index 2e7f9916b..341720183 100644 --- a/core/shared/src/main/scala/eu/timepit/refined/collection.scala +++ b/core/shared/src/main/scala/eu/timepit/refined/collection.scala @@ -1,7 +1,7 @@ package eu.timepit.refined -import eu.timepit.refined.api.Inference.==> import eu.timepit.refined.api.{ Inference, Result, Validate } +import eu.timepit.refined.api.Inference.==> import eu.timepit.refined.boolean.Not import eu.timepit.refined.collection._ import eu.timepit.refined.generic.Equal diff --git a/core/shared/src/main/scala/eu/timepit/refined/generic.scala b/core/shared/src/main/scala/eu/timepit/refined/generic.scala index 455b557d9..bc337b86f 100644 --- a/core/shared/src/main/scala/eu/timepit/refined/generic.scala +++ b/core/shared/src/main/scala/eu/timepit/refined/generic.scala @@ -1,17 +1,16 @@ package eu.timepit.refined -import eu.timepit.refined.api.Inference.==> import eu.timepit.refined.api.{ Inference, Validate } +import eu.timepit.refined.api.Inference.==> import eu.timepit.refined.generic._ +import scala.reflect.runtime.currentMirror +import scala.tools.reflect.ToolBox import shapeless._ import shapeless.ops.coproduct.ToHList import shapeless.ops.hlist.ToList import shapeless.ops.nat.ToInt import shapeless.ops.record.Keys -import scala.reflect.runtime.currentMirror -import scala.tools.reflect.ToolBox - object generic extends GenericValidate with GenericInference { /** Predicate that checks if a value is equal to `U`. */ diff --git a/core/shared/src/main/scala/eu/timepit/refined/internal/Resources.scala b/core/shared/src/main/scala/eu/timepit/refined/internal/Resources.scala index ece505286..01942d5a6 100644 --- a/core/shared/src/main/scala/eu/timepit/refined/internal/Resources.scala +++ b/core/shared/src/main/scala/eu/timepit/refined/internal/Resources.scala @@ -2,7 +2,6 @@ package eu.timepit.refined package internal import eu.timepit.refined.api.Result - import scala.util.{ Failure, Success, Try } object Resources { diff --git a/core/shared/src/main/scala/eu/timepit/refined/macros/InferMacro.scala b/core/shared/src/main/scala/eu/timepit/refined/macros/InferMacro.scala index b9e651cd6..4e996531f 100644 --- a/core/shared/src/main/scala/eu/timepit/refined/macros/InferMacro.scala +++ b/core/shared/src/main/scala/eu/timepit/refined/macros/InferMacro.scala @@ -5,7 +5,6 @@ import eu.timepit.refined.api.Inference.==> import eu.timepit.refined.api.RefType import eu.timepit.refined.internal.Resources import macrocompat.bundle - import scala.reflect.macros.blackbox @bundle diff --git a/core/shared/src/main/scala/eu/timepit/refined/macros/MacroUtils.scala b/core/shared/src/main/scala/eu/timepit/refined/macros/MacroUtils.scala index 2debd8e2e..b9786ac08 100644 --- a/core/shared/src/main/scala/eu/timepit/refined/macros/MacroUtils.scala +++ b/core/shared/src/main/scala/eu/timepit/refined/macros/MacroUtils.scala @@ -2,7 +2,6 @@ package eu.timepit.refined package macros import macrocompat.bundle - import scala.reflect.macros.blackbox import scala.util.{ Success, Try } diff --git a/core/shared/src/main/scala/eu/timepit/refined/macros/RefineMacro.scala b/core/shared/src/main/scala/eu/timepit/refined/macros/RefineMacro.scala index 7df49d557..81f049265 100644 --- a/core/shared/src/main/scala/eu/timepit/refined/macros/RefineMacro.scala +++ b/core/shared/src/main/scala/eu/timepit/refined/macros/RefineMacro.scala @@ -4,7 +4,6 @@ package macros import eu.timepit.refined.api.{ RefType, Validate } import eu.timepit.refined.internal.Resources import macrocompat.bundle - import scala.reflect.macros.blackbox @bundle diff --git a/core/shared/src/main/scala/eu/timepit/refined/numeric.scala b/core/shared/src/main/scala/eu/timepit/refined/numeric.scala index d558e12b1..40af83a82 100644 --- a/core/shared/src/main/scala/eu/timepit/refined/numeric.scala +++ b/core/shared/src/main/scala/eu/timepit/refined/numeric.scala @@ -1,12 +1,12 @@ package eu.timepit.refined -import eu.timepit.refined.api.Inference.==> import eu.timepit.refined.api.{ Inference, Validate } -import eu.timepit.refined.boolean._ +import eu.timepit.refined.api.Inference.==> +import eu.timepit.refined.boolean.{ And, Not } import eu.timepit.refined.numeric._ -import shapeless.nat._ -import shapeless.ops.nat.ToInt import shapeless.{ Nat, Witness } +import shapeless.nat._0 +import shapeless.ops.nat.ToInt /** * Module for numeric predicates. Predicates that take type parameters diff --git a/core/shared/src/main/scala/eu/timepit/refined/package.scala b/core/shared/src/main/scala/eu/timepit/refined/package.scala index ccd91996a..b81940016 100644 --- a/core/shared/src/main/scala/eu/timepit/refined/package.scala +++ b/core/shared/src/main/scala/eu/timepit/refined/package.scala @@ -1,6 +1,6 @@ package eu.timepit -import eu.timepit.refined.api.{ RefType, Refined } +import eu.timepit.refined.api.{ Refined, RefType } import eu.timepit.refined.internal._ import shapeless.tag.@@ diff --git a/core/shared/src/main/scala/eu/timepit/refined/string.scala b/core/shared/src/main/scala/eu/timepit/refined/string.scala index dde577369..8ed63a31c 100644 --- a/core/shared/src/main/scala/eu/timepit/refined/string.scala +++ b/core/shared/src/main/scala/eu/timepit/refined/string.scala @@ -1,7 +1,7 @@ package eu.timepit.refined -import eu.timepit.refined.api.Inference.==> import eu.timepit.refined.api.{ Inference, Validate } +import eu.timepit.refined.api.Inference.==> import eu.timepit.refined.string._ import shapeless.Witness