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

Use stricter scalacOptions #111

Merged
merged 1 commit into from
Nov 9, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 24 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ThisBuild / organization := "com.rallyhealth"
ThisBuild / organizationName := "Rally Health"
ThisBuild / homepage := Some(url("https://github.com/jeffmay/vapors"))
ThisBuild / scmInfo := Some(
ScmInfo(url("https://github.com/jeffmay/vapors"), "scm:git:git@github.com:jeffmay/vapors.git")
ScmInfo(url("https://github.com/jeffmay/vapors"), "scm:git:git@github.com:jeffmay/vapors.git"),
)
ThisBuild / versionScheme := Some("early-semver")
ThisBuild / scalaVersion := Dependencies.Scala_2_13
Expand All @@ -18,10 +18,32 @@ ThisBuild / scalacOptions ++= Seq(
"-language:higherKinds",
"-language:implicitConversions",
"-language:experimental.macros",
"-Xfatal-warnings",
"-opt-warnings:at-inline-failed-summary",
"-unchecked",
"-Xlint:doc-detached",
"-Xlint:eta-sam",
"-Xlint:eta-zero",
"-Xlint:deprecation",
"-Xlint:nonlocal-return",
"-Xlint:nullary-unit",
"-Xlint:package-object-classes",
"-Xlint:private-shadow",
"-Xlint:implicit-not-found",
"-Xlint:type-parameter-shadow",
"-Xlint:valpattern",
"-Xlog-implicits",
"-Werror",
"-Wself-implicit",
"-Wunused:privates",
"-Wunused:locals",
"-Wvalue-discard",
"-Ymacro-annotations",
)
ThisBuild / Compile / scalacOptions --= Seq(
"-Wunused:privates",
"-Wunused:locals",
"-Wvalue-discard",
)

// reload sbt when the build files change
Global / onChangedBuildSource := ReloadOnSourceChanges
Expand Down
2 changes: 1 addition & 1 deletion core-v1/src/main/scala/data/ExtractValue.scala
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ object ExtractValue {
def from[T](implicit extractor: ExtractValue[T, V]): ExtractValue[T, V] = extractor
}

implicit def conforms[A, B](implicit ev: A <:< B): ExtractValue[A, B] = ev.apply
implicit def conforms[A, B](implicit ev: A <:< B): ExtractValue[A, B] = ev(_)

implicit def extracted[W[_] : Extract, V]: ExtractValue[W[V], V] = Extract[W].extract(_)
}
6 changes: 3 additions & 3 deletions core-v1/src/main/scala/data/Justified.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ package com.rallyhealth.vapors.v1

package data

import algebra.{EqualComparable, SizeComparable, SizeComparison}
import dsl.{WrapConst, WrapContained, WrapFact, WrapQuantifier, WrapRegexMatches, WrapSelected}
import algebra.{EqualComparable, SizeComparable}
import dsl._
import lens.{DataPath, VariantLens}
import logic.Logic
import math._
import time.CountTime

import cats.data.{NonEmptySeq, NonEmptySet}
import cats.implicits._
import cats.{Applicative, Eq, Eval, Foldable, Functor, Order, Semigroupal, Traverse, TraverseFilter}
import cats.{Applicative, Eq, Eval, Foldable, Order, Semigroupal, Traverse}

import scala.annotation.nowarn
import scala.collection.Factory
Expand Down
1 change: 1 addition & 0 deletions core-v1/src/main/scala/dsl/BuildExprDsl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ trait BuildExprDsl
"""You should use the using().thenReturn(...) DSL method instead.

You should prefer put your declaration of dependency on definitions close to where you actually use them.""",
"1.0.0-M1",
)
final def usingDefinitions[I, O](
definitions: Expr.Definition[I, OP]*,
Expand Down
2 changes: 0 additions & 2 deletions core-v1/src/main/scala/dsl/ExprHListDslImplicits.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ package dsl
import cats.{Align, Functor, FunctorFilter}
import shapeless.{::, HList, HNil}

import scala.collection.Factory

/**
* A marker trait for determining which set of implicits to inherit.
*
Expand Down
2 changes: 0 additions & 2 deletions core-v1/src/main/scala/dsl/WrappedBuildExprDsl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import cats.{FlatMap, Foldable, Functor, Id, Order, Reducible, Traverse}
import izumi.reflect.Tag
import shapeless.{Generic, HList, Nat, Typeable}

import scala.util.matching.Regex

trait WrappedBuildExprDsl extends BuildExprDsl {
self: DslTypes with WrappedExprHListDslImplicits with OutputTypeImplicits =>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import logic.{Conjunction, Disjunction, Negation}
import cats.arrow.Arrow
import cats.data.NonEmptyVector
import cats.{Applicative, Eval, FlatMap, Foldable, Functor, Monad, SemigroupK, Traverse}
import shapeless.{HList, HMap, TypeCase, Typeable}
import shapeless.{HList, HMap}

import scala.annotation.tailrec

Expand Down
5 changes: 1 addition & 4 deletions core-v1/src/main/scala/engine/SimpleEngine.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ import lens.CollectInto
import logic.{Conjunction, Disjunction, Negation}

import cats.{Applicative, Eval, FlatMap, Foldable, Functor, SemigroupK, Traverse}
import shapeless.{HList, TypeCase, Typeable}

import scala.collection.MapView
import scala.collection.immutable.IntMap
import shapeless.HList

/**
* A vapors [[Expr]] interpreter that just builds a simple function without providing any post-processing.
Expand Down
20 changes: 11 additions & 9 deletions core-v1/src/main/scala/lens/JavaBeanCompat.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@ object JavaBeanCompat {
private final val GETTER_PREFIXES = Set("get")

def unbeanify(name: String): String = {
for (prefix <- GETTER_PREFIXES) {
if (name.startsWith(prefix) && name.length > prefix.length) {
val firstChar = name.charAt(prefix.length)
if (firstChar.isUpper) {
val restOfName = name.substring(prefix.length + 1)
return s"${firstChar.toLower}$restOfName"
val unbeanified = GETTER_PREFIXES.collectFirst(Function.unlift { prefix =>
Option
.when(name.startsWith(prefix) && name.length > prefix.length) {
val firstChar = name.charAt(prefix.length)
Option.when(firstChar.isUpper) {
val restOfName = name.substring(prefix.length + 1)
s"${firstChar.toLower}$restOfName"
}
}
}
}
name
.flatten
})
unbeanified.getOrElse(name)
}
}
2 changes: 1 addition & 1 deletion core-v1/src/main/scala/lens/ValidDataPathKey.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ object ValidDataPathKey {
ToInt[N].apply().toString
}

implicit val string: ValidDataPathKey[String] = identity[String]
implicit val string: ValidDataPathKey[String] = identity(_)

implicit val int: ValidDataPathKey[Int] = _.toString

Expand Down