Skip to content

fix: Remove WartRemover as it was not working properly on Scala 2.13 #147

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

Merged
merged 1 commit into from
Feb 11, 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
26 changes: 7 additions & 19 deletions .scalafix.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
rules = [
SortImports
Disable
DisableSyntax
LeakingImplicitClassVal
Expand All @@ -8,13 +7,7 @@ rules = [
NoValInForComprehension
ProcedureSyntax
RemoveUnused
]

# the same order as IntelliJ does it, we don't want Scalafix and IDEA fight each other
SortImports.blocks = [
"java."
"*"
"scala."
SortImports
]

Disable.symbols = [
Expand Down Expand Up @@ -168,14 +161,9 @@ DisableSyntax {
noXml = true
}

ExplicitResultTypes {
fatalWarnings = true

# these apply to non-implicits
memberKind = [Def, Val]
memberVisibility = [Public, Protected]

# turn to the max...
skipSimpleDefinitions = false
skipLocalImplicits = false
}
# IntelliJ IDEA's order in order not to fight each other
SortImports.blocks = [
"java."
"*"
"scala."
]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Scala Server Toolkit

![Build Status](https://github.com/avast/scala-server-toolkit/workflows/Build/badge.svg)
[![Maven Central](https://img.shields.io/maven-central/v/com.avast/sst-bundle-zio-http4s-blaze_2.12)](https://repo1.maven.org/maven2/com/avast/sst-bundle-zio-http4s-blaze_2.12/)
[![Maven Central](https://img.shields.io/maven-central/v/com.avast/sst-bundle-zio-http4s-blaze_2.13)](https://repo1.maven.org/maven2/com/avast/sst-bundle-zio-http4s-blaze_2.12/)
[![Scala Steward badge](https://img.shields.io/badge/Scala_Steward-helping-brightgreen.svg?style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAQCAMAAAARSr4IAAAAVFBMVEUAAACHjojlOy5NWlrKzcYRKjGFjIbp293YycuLa3pYY2LSqql4f3pCUFTgSjNodYRmcXUsPD/NTTbjRS+2jomhgnzNc223cGvZS0HaSD0XLjbaSjElhIr+AAAAAXRSTlMAQObYZgAAAHlJREFUCNdNyosOwyAIhWHAQS1Vt7a77/3fcxxdmv0xwmckutAR1nkm4ggbyEcg/wWmlGLDAA3oL50xi6fk5ffZ3E2E3QfZDCcCN2YtbEWZt+Drc6u6rlqv7Uk0LdKqqr5rk2UCRXOk0vmQKGfc94nOJyQjouF9H/wCc9gECEYfONoAAAAASUVORK5CYII=)](https://scala-steward.org)
[![Mergify badge](https://img.shields.io/endpoint.svg?url=https://gh.mergify.io/badges/avast/scala-server-toolkit)](https://mergify.io)

Expand Down
5 changes: 4 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,10 @@ lazy val monixCatnapPureConfig = project
.in(file("monix-catnap-pureconfig"))
.dependsOn(monixCatnap)
.settings(BuildSettings.common)
.settings(run / fork := true, name := "sst-monix-catnap-pureconfig", libraryDependencies += Dependencies.pureConfig)
.settings(
name := "sst-monix-catnap-pureconfig",
libraryDependencies += Dependencies.pureConfig
)

lazy val pureConfig = project
.in(file("pureconfig"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import org.flywaydb.core.Flyway
object FlywayModule {

/** Makes [[org.flywaydb.core.Flyway]] from the given [[javax.sql.DataSource]] and config. */
@SuppressWarnings(Array("org.wartremover.warts.NonUnitStatements"))
def make[F[_]: Sync](dataSource: DataSource, config: FlywayConfig): F[Flyway] = {
Sync[F].delay {
val builder = Flyway
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ object GrpcServerModule {
* @param executionContext executor to be used for the server
* @param interceptors that are run for all the services
*/
@SuppressWarnings(Array("org.wartremover.warts.NonUnitStatements"))
def make[F[_]: Sync](config: GrpcServerConfig,
services: Seq[ServerServiceDefinition],
executionContext: ExecutionContext,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import org.http4s.client.Client
import org.http4s.client.blaze.BlazeClientBuilder

import scala.concurrent.ExecutionContext
import scala.language.higherKinds

object Http4sBlazeClientModule {

/** Makes [[org.http4s.client.Client]] (Blaze) initialized with the given config.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import org.http4s.server.blaze.BlazeServerBuilder

import scala.concurrent.ExecutionContext
import scala.concurrent.duration.Duration
import scala.language.higherKinds

object Http4sBlazeServerModule {

/** Makes [[org.http4s.server.Server]] (Blaze) initialized with the given config and [[org.http4s.HttpApp]].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import io.micrometer.core.instrument.MeterRegistry
import org.http4s.HttpRoutes
import org.http4s.server.middleware.Metrics

import scala.language.higherKinds

class MicrometerHttp4sServerMetricsModule[F[_]: Sync](val serverMetrics: HttpRoutes[F] => HttpRoutes[F], val routeMetrics: RouteMetrics[F])

object MicrometerHttp4sServerMetricsModule {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import cats.syntax.functor._
import io.micrometer.core.instrument.MeterRegistry
import org.http4s.Response

import scala.language.higherKinds

/** Provides the usual metrics for single HTTP route. */
class RouteMetrics[F[_]: Sync](meterRegistry: MeterRegistry, clock: Clock[F]) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import cats.syntax.all._
import org.http4s.syntax.kleisli._
import org.http4s.{HttpApp, HttpRoutes}

import scala.language.higherKinds

object Http4sRouting {

/** Makes [[org.http4s.HttpApp]] from [[org.http4s.HttpRoutes]] */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import org.http4s.util.CaseInsensitiveString
import org.http4s.{Header, HttpRoutes, Request, Response}
import org.slf4j.LoggerFactory

import scala.language.higherKinds

/** Provides correlation ID functionality. Either generates new correlation ID for a request or takes the one sent in HTTP header
* and puts it to [[org.http4s.Request]] attributes. It is also filled into HTTP response header.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import cats.effect.{Blocker, Resource, Sync}
import com.avast.sst.jvm.execution.ConfigurableThreadFactory.Config

import scala.concurrent.{ExecutionContext, ExecutionContextExecutorService}
import scala.language.higherKinds

/** Provides necessary executors - the default one for execution of your business logic and callbacks and special one designated for
* blocking operations. Also allows you to create more executors if you need them.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import java.io.{OutputStream, Reader}
import cats.effect.Sync

import scala.io.StdIn
import scala.language.higherKinds
import scala.{Console => SConsole}

/** Pure console allowing to read and print lines. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.avast.sst.jvm.system.console

import cats.effect.Sync

import scala.language.higherKinds
import scala.{Console => SConsole}

/** Provides console - standard in/out/err. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package com.avast.sst.jvm.system.random

import cats.effect.Sync

import scala.language.higherKinds

/** Pure pseudo-random number generator based on the JVM implementation. */
trait Random[F[_]] {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import java.security.SecureRandom

import cats.effect.Sync

import scala.language.higherKinds

/** Provides random number generators. */
object RandomModule {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@ import io.micrometer.core.instrument.config.NamingConvention
import io.micrometer.core.instrument.util.HierarchicalNameMapper
import io.micrometer.jmx.{JmxConfig, JmxMeterRegistry}

import scala.language.higherKinds

object MicrometerJmxModule {

/** Makes configured [[io.micrometer.jmx.JmxMeterRegistry]]. */
@SuppressWarnings(Array("org.wartremover.warts.NonUnitStatements"))
def make[F[_]: Sync](config: MicrometerJmxConfig,
clock: Clock = Clock.SYSTEM,
nameMapper: HierarchicalNameMapper = HierarchicalNameMapper.DEFAULT): Resource[F, JmxMeterRegistry] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ private[jmx] class TypeScopeNameObjectNameFactory(separator: String = ".") exten
parsedName.getOrElse(defaultFactory.createName(`type`, domain, name))
}

@SuppressWarnings(Array("org.wartremover.warts.NonUnitStatements"))
private def parseName(domain: String, name: String) = Either.catchNonFatal {
val parts = name.split(quotedSeparator, partNames.length)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import io.micrometer.core.instrument.Clock
import io.micrometer.core.instrument.util.HierarchicalNameMapper
import io.micrometer.statsd.{StatsdConfig, StatsdFlavor, StatsdMeterRegistry, StatsdProtocol}

import scala.language.higherKinds

object MicrometerStatsDModule {

/** Makes configured [[io.micrometer.statsd.StatsdMeterRegistry]]. */
Expand Down
33 changes: 6 additions & 27 deletions project/BuildSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import sbt.Keys._
import sbt.{Def, _}
import sbtunidoc.ScalaUnidocPlugin.autoImport._
import scalafix.sbt.ScalafixPlugin.autoImport._
import wartremover.Wart
import wartremover.WartRemover.autoImport._

object BuildSettings {

Expand All @@ -17,41 +15,22 @@ object BuildSettings {
libraryDependencies ++= Seq(
compilerPlugin(Dependencies.kindProjector),
compilerPlugin(Dependencies.silencer),
compilerPlugin(scalafixSemanticdb), // for Scalafix
compilerPlugin(scalafixSemanticdb), // necessary for Scalafix
Dependencies.silencerLib,
Dependencies.catsEffect,
Dependencies.logbackClassic % Test,
Dependencies.scalaTest % Test
),
Compile / compile / wartremoverErrors ++= Warts.all filterNot Set(
Wart.Null, // checked by Scalafix
Wart.Nothing, // keep, false positives all around
Wart.Overloading,
Wart.Any, // keep, false positives all around
Wart.Equals, // checked by Scalafix
Wart.ToString, // checked by Scalafix
Wart.Product, // checked by Scalafix
Wart.Serializable, // checked by Scalafix
Wart.DefaultArguments // for constructors for PureConfig
),
ThisBuild / scalafixDependencies ++= Seq(
Dependencies.scalazzi,
Dependencies.sortImports
Dependencies.scalafixScaluzzi,
Dependencies.scalafixSortImports
),
scalacOptions ++= Seq(
"-Yrangepos", // for Scalafix. required by SemanticDB compiler plugin
"-Ywarn-unused", // for Scalafix. not present in sbt-tpolecat for 2.13
"-Yrangepos", // necessary for Scalafix (required by SemanticDB compiler plugin)
"-Ywarn-unused", // necessary for Scalafix RemoveUnused rule (not present in sbt-tpolecat for 2.13)
"-P:silencer:checkUnused"
),
Compile / doc / sources := Seq.empty,
Compile / packageDoc / publishArtifact := false,
Test / publishArtifact := false,
Test / test / wartremoverErrors := (Compile / compile / wartremoverErrors).value filterNot Set(
Wart.MutableDataStructures,
Wart.OptionPartial,
Wart.AsInstanceOf,
Wart.EitherProjectionPartial
)
Test / publishArtifact := false
)

lazy val microsite: Seq[Def.Setting[_]] = Seq(
Expand Down
8 changes: 4 additions & 4 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ object Dependencies {
val http4sDsl = "org.http4s" %% "http4s-dsl" % Versions.http4s
val http4sServer = "org.http4s" %% "http4s-server" % Versions.http4s
val jsr305 = "com.google.code.findbugs" % "jsr305" % "3.0.2"
val kindProjector = "org.typelevel" %% "kind-projector" % "0.10.3"
val kindProjector = "org.typelevel" % "kind-projector" % "0.11.0" cross CrossVersion.full
val logbackClassic = "ch.qos.logback" % "logback-classic" % "1.2.3"
val micrometerCore = "io.micrometer" % "micrometer-core" % Versions.micrometerCore
val micrometerJmx = "io.micrometer" % "micrometer-registry-jmx" % Versions.micrometerJmx
val micrometerStatsD = "io.micrometer" % "micrometer-registry-statsd" % Versions.micrometerStatsD
val monixEval = "io.monix" %% "monix-eval" % Versions.monix
val monixCatnap = "io.monix" %% "monix-catnap" % Versions.monix
val monixEval = "io.monix" %% "monix-eval" % Versions.monix
val postgresql = "org.postgresql" % "postgresql" % "42.2.10"
val pureConfig = "com.github.pureconfig" %% "pureconfig" % "0.12.2"
val scalafixScaluzzi = "com.github.vovapolu" %% "scaluzzi" % "0.1.3"
val scalafixSortImports = "com.nequissimus" %% "sort-imports" % "0.3.2"
val scalaTest = "org.scalatest" %% "scalatest" % "3.1.0"
val scalazzi = "com.github.vovapolu" %% "scaluzzi" % "0.1.3"
val sortImports = "com.nequissimus" %% "sort-imports" % "0.3.2"
val silencer = "com.github.ghik" % "silencer-plugin" % Versions.silencer cross CrossVersion.full
val silencerLib = "com.github.ghik" % "silencer-lib" % Versions.silencer cross CrossVersion.full
val slf4jApi = "org.slf4j" % "slf4j-api" % "1.7.30"
Expand Down
1 change: 0 additions & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.10")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.11")
addSbtPlugin("org.wartremover" % "sbt-wartremover" % "2.4.3")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.3.1")
addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.2")
addSbtPlugin("com.47deg" % "sbt-microsites" % "1.1.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import cats.syntax.either._
import pureconfig.error.{ConfigReaderFailure, ConfigReaderFailures, ConvertFailure}
import pureconfig.{ConfigReader, ConfigSource}

import scala.language.higherKinds
import scala.reflect.ClassTag

/** Provides loading of configuration into case class via PureConfig. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import com.typesafe.sslconfig.ssl.{
}
import javax.net.ssl.{KeyManagerFactory, SSLContext, TrustManagerFactory}

import scala.language.higherKinds

object SslContextModule {

/** Initializes [[javax.net.ssl.SSLContext]] from the provided config.
Expand Down