Skip to content

Commit

Permalink
Add -Xlint:unused flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Chapuis authored and jchapuis committed Apr 17, 2023
1 parent 1ace15f commit 66bd15e
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 43 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Dependencies._
import sbtversionpolicy.Compatibility.None

val commonSettings = Seq(
scalacOptions ++= Seq("-Xfatal-warnings"),
scalacOptions ++= Seq("-Xfatal-warnings", "-Xlint:unused"),
addCompilerPlugin("org.typelevel" % "kind-projector" % "0.13.2" cross CrossVersion.full),
wartremoverExcluded += sourceManaged.value,
Compile / compile / wartremoverErrors ++= Warts
Expand Down
3 changes: 1 addition & 2 deletions core/src/main/scala/endless/core/interpret/EntityT.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ package endless.core.interpret

import cats.conversions.all._
import cats.data.{Chain, NonEmptyChain}
import cats.effect.kernel.{Clock, Unique}
import cats.effect.kernel.Clock
import cats.syntax.applicative._
import cats.syntax.either._
import cats.syntax.flatMap._
import cats.syntax.functor._
import cats.tagless.FunctorK
import cats.{Applicative, Functor, Monad, ~>}
import endless.core.data.{EventsFolder, Folded}
import endless.core.entity.Entity
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package endless.core.interpret

import cats.data.Chain
import cats.effect.{Clock, Concurrent, GenSpawn, GenTemporal, IO, MonadCancel, Sync, Temporal}
import cats.effect.{Clock, GenSpawn, GenTemporal, IO, MonadCancel, Sync}
import cats.effect.laws.AsyncTests
import cats.laws.discipline.arbitrary._
import cats.laws.discipline.{MiniInt, MonadTests}
import cats.laws.discipline.eq._
import cats.syntax.all._
import cats.derived.auto.eq._
import cats.derived.auto.order._
Expand Down
3 changes: 0 additions & 3 deletions example/src/main/scala/endless/example/ExampleApp.scala
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
package endless.example

import akka.actor.typed.ActorSystem
import akka.cluster.sharding.typed.scaladsl.ClusterSharding
import akka.util.Timeout
import cats.Monad
import cats.effect._
import cats.syntax.applicative._
import cats.syntax.either._
import cats.syntax.flatMap._
import cats.syntax.functor._
import cats.syntax.show._
import endless.core.entity.EntityNameProvider
import endless.core.interpret.EffectorT
import endless.core.protocol.EntityIDCodec
import endless.example.adapter.VehicleStateAdapter
import endless.example.algebra._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package endless.example.logic

import cats.effect.Ref
import cats.effect.kernel.Sync
import cats.syntax.flatMap._
import cats.syntax.functor._
import cats.{Applicative, Monad}
import endless.core.entity.Effector
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package endless.protobuf
import cats.{Functor, Id}
import cats.Id
import cats.syntax.functor._
import endless.core.protocol.{Decoder, IncomingCommand, OutgoingCommand}
import endless.protobuf.test.proto.dummy.{DummyCommand, DummyReply}
import org.scalacheck.Prop.forAll
import cats.syntax.functor._

class ProtobufCommandProtocolSuite extends munit.ScalaCheckSuite {
test("protobuf command protocol") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ private[akka] class EntityPassivator[F[_]: Sync](upcomingPassivation: Ref[F, Opt
case PassivationState.Unchanged => Applicative[F].unit
}

private def enablePassivation(after: FiniteDuration = Duration.Zero) =
private def enablePassivation(after: FiniteDuration) =
if (after === Duration.Zero) passivate else schedulePassivation(after)

private def schedulePassivation(after: FiniteDuration) =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package endless.runtime.akka

import akka.actor.typed.ActorSystem
import akka.cluster.sharding.typed.scaladsl.{ClusterSharding, EntityTypeKey}
import akka.util.Timeout
import cats.effect.kernel.Async
Expand All @@ -18,8 +17,6 @@ import org.typelevel.log4cats.Logger
* Retrieves the entity ref and asks the command, then decodes the reply and lifts it into `F`
* @param sharding
* Akka cluster sharding extension
* @param actorSystem
* actor system
* @param askTimeout
* Akka ask timeout
* @param idEncoder
Expand All @@ -33,7 +30,6 @@ import org.typelevel.log4cats.Logger
*/
private[akka] final class ShardingCommandRouter[F[_]: Logger, ID](implicit
sharding: ClusterSharding,
actorSystem: ActorSystem[_],
askTimeout: Timeout,
idEncoder: EntityIDEncoder[ID],
nameProvider: EntityNameProvider[ID],
Expand Down Expand Up @@ -65,7 +61,6 @@ private[akka] final class ShardingCommandRouter[F[_]: Logger, ID](implicit
object ShardingCommandRouter {
implicit def apply[F[_]: Logger, ID](implicit
sharding: ClusterSharding,
actorSystem: ActorSystem[_],
askTimeout: Timeout,
idEncoder: EntityIDEncoder[ID],
nameProvider: EntityNameProvider[ID],
Expand Down
16 changes: 5 additions & 11 deletions runtime/src/main/scala/endless/runtime/akka/deploy/Deployer.scala
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
package endless.runtime.akka.deploy

import akka.actor.typed.{ActorRef, ActorSystem, Behavior}
import akka.actor.typed.{ActorRef, Behavior}
import akka.cluster.sharding.typed.ShardingEnvelope
import akka.cluster.sharding.typed.scaladsl.{ClusterSharding, EntityContext}
import akka.cluster.sharding.typed.scaladsl.EntityContext
import akka.persistence.typed.scaladsl.EventSourcedBehavior
import akka.util.Timeout
import cats.effect.kernel.{Async, Resource}
import cats.syntax.applicative._
import cats.syntax.flatMap._
import cats.syntax.functor._
import cats.tagless.FunctorK
import endless.core.entity._
import endless.core.event.EventApplier
import endless.core.interpret.EffectorT._
import endless.core.interpret._
import endless.core.protocol.{CommandProtocol, CommandRouter, EntityIDCodec}
import endless.runtime.akka.ShardingCommandRouter
import endless.core.protocol.{CommandProtocol, EntityIDCodec}
import endless.runtime.akka.data._
import endless.runtime.akka.deploy.Deployer.EffectorParameters
import endless.runtime.akka.deploy.internal.EventSourcedShardedEntityDeployer
Expand Down Expand Up @@ -173,13 +170,10 @@ trait Deployer {
customizeBehavior: (
EntityContext[Command],
EventSourcedBehavior[Command, E, Option[S]]
) => Behavior[Command] =
(_: EntityContext[Command], behavior: EventSourcedBehavior[Command, E, Option[S]]) =>
behavior,
) => Behavior[Command],
customizeEntity: akka.cluster.sharding.typed.scaladsl.Entity[Command, ShardingEnvelope[
Command
]] => akka.cluster.sharding.typed.scaladsl.Entity[Command, ShardingEnvelope[Command]] =
identity
]] => akka.cluster.sharding.typed.scaladsl.Entity[Command, ShardingEnvelope[Command]]
)(implicit
akkaCluster: AkkaCluster,
nameProvider: EntityNameProvider[ID],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package endless.runtime.akka.deploy

import akka.actor.typed.{ActorRef, ActorSystem, Behavior}
import akka.actor.typed.{ActorRef, Behavior}
import akka.cluster.sharding.typed.ShardingEnvelope
import akka.cluster.sharding.typed.scaladsl.{ClusterSharding, EntityContext}
import akka.cluster.sharding.typed.scaladsl.EntityContext
import akka.persistence.typed.state.scaladsl.DurableStateBehavior
import akka.util.Timeout
import cats.effect.kernel.{Async, Resource}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package endless.runtime.akka.deploy.internal

import akka.actor.typed.scaladsl.{ActorContext, Behaviors}
import akka.actor.typed.{ActorRef, ActorSystem, Behavior}
import akka.cluster.sharding.typed.ShardingEnvelope
import akka.cluster.sharding.typed.scaladsl.{ClusterSharding, EntityContext, EntityTypeKey}
import akka.actor.typed.Behavior
import akka.actor.typed.scaladsl.ActorContext
import akka.cluster.sharding.typed.scaladsl.EntityContext
import akka.persistence.typed.PersistenceId
import akka.persistence.typed.state.scaladsl.{DurableStateBehavior, Effect}
import akka.persistence.typed.state.{RecoveryCompleted, RecoveryFailed}
import akka.util.Timeout
import cats.effect.kernel.{Async, Resource}
import cats.effect.kernel.Async
import cats.effect.std.Dispatcher
import cats.syntax.applicative._
import cats.syntax.flatMap._
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package endless.runtime.akka.deploy.internal

import akka.actor.typed.Behavior
import akka.actor.typed.scaladsl.ActorContext
import akka.actor.typed.{ActorSystem, Behavior}
import akka.cluster.sharding.typed.ShardingEnvelope
import akka.cluster.sharding.typed.scaladsl.{ClusterSharding, EntityContext}
import akka.cluster.sharding.typed.scaladsl.EntityContext
import akka.persistence.typed.scaladsl.{Effect, EventSourcedBehavior}
import akka.persistence.typed.{PersistenceId, RecoveryCompleted, RecoveryFailed}
import akka.util.Timeout
import cats.effect.kernel.Async
import cats.effect.std.Dispatcher
import cats.syntax.applicative._
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package endless.runtime.akka.deploy.internal

import akka.actor.typed.scaladsl.{ActorContext, Behaviors}
import akka.actor.typed.{ActorRef, ActorSystem, Behavior}
import akka.actor.typed.{ActorRef, Behavior}
import akka.cluster.sharding.typed.ShardingEnvelope
import akka.cluster.sharding.typed.scaladsl.{ClusterSharding, EntityContext, EntityTypeKey}
import akka.util.Timeout
Expand Down Expand Up @@ -34,7 +34,6 @@ trait ShardedRepositoryDeployer[F[_], RepositoryAlg[_[_]], Alg[_[_]], ID] {
commandProtocol: CommandProtocol[Alg],
functorK: FunctorK[Alg]
): Resource[F, (RepositoryAlg[F], ActorRef[ShardingEnvelope[Command]])] = {
implicit val system: ActorSystem[_] = akkaCluster.system
implicit val clusterSharding: ClusterSharding = akkaCluster.sharding
implicit val commandRouter: CommandRouter[F, ID] = ShardingCommandRouter.apply
val repositoryT = RepositoryT.apply[F, ID, Alg]
Expand Down

0 comments on commit 66bd15e

Please sign in to comment.