Skip to content

Commit

Permalink
Merge pull request #1867 from scala-steward/update/scalafmt-core-3.0.0
Browse files Browse the repository at this point in the history
Update scalafmt-core to 3.0.0
  • Loading branch information
jluhrs authored Aug 19, 2021
2 parents 224ff29 + fbf61c7 commit e79f3be
Show file tree
Hide file tree
Showing 86 changed files with 582 additions and 523 deletions.
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "2.7.5"
version = "3.0.0"
style = default

maxColumn = 100
Expand Down
80 changes: 40 additions & 40 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ lazy val seqexec_web_server = project
buildInfoUsePackageAsPath := true,
buildInfoKeys ++= Seq[BuildInfoKey](name, version, buildInfoBuildNumber),
buildInfoOptions += BuildInfoOption.BuildTime,
buildInfoObject := "OcsBuildInfo",
buildInfoPackage := "seqexec.web.server"
buildInfoObject := "OcsBuildInfo",
buildInfoPackage := "seqexec.web.server"
)
.dependsOn(seqexec_server)
.dependsOn(seqexec_model.jvm % "compile->compile;test->test")
Expand All @@ -176,26 +176,26 @@ lazy val seqexec_web_client = project
// Configurations for webpack
fastOptJS / webpackBundlingMode := BundlingMode.LibraryOnly(),
fullOptJS / webpackBundlingMode := BundlingMode.Application,
webpackResources := (baseDirectory.value / "src" / "webpack") * "*.js",
webpackDevServerPort := 9090,
webpack / version := "4.44.1",
webpackResources := (baseDirectory.value / "src" / "webpack") * "*.js",
webpackDevServerPort := 9090,
webpack / version := "4.44.1",
startWebpackDevServer / version := "3.11.0",
// Use a different Webpack configuration file for production and create a single bundle without source maps
fullOptJS / webpackConfigFile := Some(
fullOptJS / webpackConfigFile := Some(
baseDirectory.value / "src" / "webpack" / "prod.webpack.config.js"
),
fastOptJS / webpackConfigFile := Some(
fastOptJS / webpackConfigFile := Some(
baseDirectory.value / "src" / "webpack" / "dev.webpack.config.js"
),
Test / webpackConfigFile := Some(
Test / webpackConfigFile := Some(
baseDirectory.value / "src" / "webpack" / "test.webpack.config.js"
),
webpackEmitSourceMaps := false,
Test / parallelExecution := false,
installJsdom / version := "16.4.0",
Test / requireJsDomEnv := true,
webpackEmitSourceMaps := false,
Test / parallelExecution := false,
installJsdom / version := "16.4.0",
Test / requireJsDomEnv := true,
// Use yarn as it is faster than npm
useYarn := true,
useYarn := true,
// JS dependencies via npm
Compile / npmDependencies ++= Seq(
"fomantic-ui-less" -> LibraryVersions.fomanticUI,
Expand Down Expand Up @@ -245,8 +245,8 @@ lazy val seqexec_web_client = project
.settings(
buildInfoUsePackageAsPath := true,
buildInfoKeys ++= Seq[BuildInfoKey](name, version),
buildInfoObject := "OcsBuildInfo",
buildInfoPackage := "seqexec.web.client"
buildInfoObject := "OcsBuildInfo",
buildInfoPackage := "seqexec.web.client"
)
.dependsOn(seqexec_model.js % "compile->compile;test->test")

Expand Down Expand Up @@ -281,8 +281,8 @@ lazy val seqexec_server = project
.settings(
buildInfoUsePackageAsPath := true,
buildInfoKeys ++= Seq[BuildInfoKey](name, version),
buildInfoObject := "OcsBuildInfo",
buildInfoPackage := "seqexec.server"
buildInfoObject := "OcsBuildInfo",
buildInfoPackage := "seqexec.server"
)
.dependsOn(seqexec_engine % "compile->compile;test->test",
giapi,
Expand Down Expand Up @@ -373,20 +373,20 @@ lazy val acm = project
*/
lazy val seqexecCommonSettings = Seq(
// Main class for launching
Compile / mainClass := Some("seqexec.web.server.http4s.WebServerLauncher"),
Compile / mainClass := Some("seqexec.web.server.http4s.WebServerLauncher"),
// This is important to keep the file generation order correctly
Universal / parallelExecution := false,
Universal / parallelExecution := false,
// Depend on webpack and add the assets created by webpack
Compile / packageBin / mappings ++= (webpack in (seqexec_web_client, Compile, fullOptJS)).value
.map(f => f.data -> f.data.getName()),
// Name of the launch script
executableScriptName := "seqexec-server",
executableScriptName := "seqexec-server",
// No javadocs
mappings in (Compile, packageDoc) := Seq(),
// Don't create launchers for Windows
makeBatScripts := Seq.empty,
makeBatScripts := Seq.empty,
// Specify a different name for the config file
bashScriptConfigLocation := Some("${app_home}/../conf/launcher.args"),
bashScriptConfigLocation := Some("${app_home}/../conf/launcher.args"),
bashScriptExtraDefines += """addJava "-Dlogback.configurationFile=${app_home}/../conf/logback.xml"""",
bashScriptExtraDefines += """addJava "-javaagent:${app_home}/jmx_prometheus_javaagent-0.3.1.jar=6060:${app_home}/prometheus.yaml"""",
// Copy logback.xml to let users customize it on site
Expand Down Expand Up @@ -425,13 +425,13 @@ lazy val seqexecCommonSettings = Seq(
*/
lazy val seqexecLinux = Seq(
// User/Group for execution
Linux / daemonUser := "software",
Linux / daemonGroup := "software",
Linux / daemonUser := "software",
Linux / daemonGroup := "software",
Universal / maintainer := "Software Group <[email protected]>",
// This lets us build RPMs from snapshot versions
Linux / name := "Seqexec Server",
Linux / version := {
(ThisBuild / version ).value.replace("-SNAPSHOT", "").replace("-", "_").replace(" ", "")
Linux / name := "Seqexec Server",
Linux / version := {
(ThisBuild / version).value.replace("-SNAPSHOT", "").replace("-", "_").replace(" ", "")
}
)

Expand All @@ -445,7 +445,7 @@ lazy val app_seqexec_server = preventPublication(project.in(file("app/seqexec-se
.enablePlugins(GitBranchPrompt)
.settings(seqexecCommonSettings: _*)
.settings(
description := "Seqexec server for local testing",
description := "Seqexec server for local testing",
// Put the jar files in the lib dir
Universal / mappings += {
val jar = (Compile / packageBin).value
Expand Down Expand Up @@ -488,9 +488,9 @@ lazy val app_seqexec_server_gs_test =
.settings(seqexecLinux: _*)
.settings(deployedAppMappings: _*)
.settings(
description := "Seqexec GS test deployment",
applicationConfName := "seqexec",
applicationConfSite := DeploymentSite.GS,
description := "Seqexec GS test deployment",
applicationConfName := "seqexec",
applicationConfSite := DeploymentSite.GS,
Universal / mappings := {
// filter out sjs jar files. otherwise it could generate some conflicts
val universalMappings = (mappings in (app_seqexec_server, Universal)).value
Expand All @@ -517,9 +517,9 @@ lazy val app_seqexec_server_gn_test =
.settings(seqexecLinux: _*)
.settings(deployedAppMappings: _*)
.settings(
description := "Seqexec GN test deployment",
applicationConfName := "seqexec",
applicationConfSite := DeploymentSite.GN,
description := "Seqexec GN test deployment",
applicationConfName := "seqexec",
applicationConfSite := DeploymentSite.GN,
Universal / mappings := {
// filter out sjs jar files. otherwise it could generate some conflicts
val universalMappings = (mappings in (app_seqexec_server, Universal)).value
Expand All @@ -545,9 +545,9 @@ lazy val app_seqexec_server_gs = preventPublication(project.in(file("app/seqexec
.settings(seqexecLinux: _*)
.settings(deployedAppMappings: _*)
.settings(
description := "Seqexec Gemini South server production",
applicationConfName := "seqexec",
applicationConfSite := DeploymentSite.GS,
description := "Seqexec Gemini South server production",
applicationConfName := "seqexec",
applicationConfSite := DeploymentSite.GS,
Universal / mappings := {
// filter out sjs jar files. otherwise it could generate some conflicts
val universalMappings = (mappings in (app_seqexec_server, Universal)).value
Expand All @@ -573,9 +573,9 @@ lazy val app_seqexec_server_gn = preventPublication(project.in(file("app/seqexec
.settings(seqexecLinux: _*)
.settings(deployedAppMappings: _*)
.settings(
description := "Seqexec Gemini North server production",
applicationConfName := "seqexec",
applicationConfSite := DeploymentSite.GN,
description := "Seqexec Gemini North server production",
applicationConfName := "seqexec",
applicationConfSite := DeploymentSite.GN,
Universal / mappings := {
// filter out sjs jar files. otherwise it could generate some conflicts
val universalMappings = (mappings in (app_seqexec_server, Universal)).value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@ import org.scalatest.funsuite.AnyFunSuite
/**
* Tests of the observe state machine
*
* We want to verify that the Apply state and Observe state FSM properly do
* state transitions as the EPICS channels change.
* To speed up the process the CAJContext is mocked as we don't really
* care about the state of the channels. Instead we want to only observe
* the state transitions
* We want to verify that the Apply state and Observe state FSM properly do state transitions as the
* EPICS channels change. To speed up the process the CAJContext is mocked as we don't really care
* about the state of the channels. Instead we want to only observe the state transitions
*/
final class ObserveStateSpec
extends AnyFunSuite
Expand Down Expand Up @@ -1149,15 +1147,15 @@ trait GenericInstMocks extends ChannelsFactory {
val epicsReader = mock[EpicsReader]
val epicsWriter = mock[EpicsWriter]

(epicsWriter.getEnumChannel[CadDirective] _).expects(s"${apply}.DIR", *).returns(dirChannel)
(epicsReader.getIntegerChannel _).expects(s"${apply}.VAL").returns(intChannelS)
(epicsReader.getStringChannel _).expects(s"${apply}.MESS").returns(strChannel)
(epicsReader.getIntegerChannel _).expects(s"${applyCar}.CLID").returns(intChannelS)
(epicsReader.getEnumChannel[CarState] _).expects(s"${applyCar}.VAL", *).returns(carChannel)
(epicsReader.getStringChannel _).expects(s"${applyCar}.OMSS").returns(strChannel)
(epicsReader.getIntegerChannel _).expects(s"${observeCar}.CLID").returns(intChannel)
(epicsReader.getEnumChannel[CarState] _).expects(s"${observeCar}.VAL", *).returns(carChannel)
(epicsReader.getStringChannel _).expects(s"${observeCar}.OMSS").returns(strChannel)
(epicsWriter.getEnumChannel[CadDirective] _).expects(s"$apply.DIR", *).returns(dirChannel)
(epicsReader.getIntegerChannel _).expects(s"$apply.VAL").returns(intChannelS)
(epicsReader.getStringChannel _).expects(s"$apply.MESS").returns(strChannel)
(epicsReader.getIntegerChannel _).expects(s"$applyCar.CLID").returns(intChannelS)
(epicsReader.getEnumChannel[CarState] _).expects(s"$applyCar.VAL", *).returns(carChannel)
(epicsReader.getStringChannel _).expects(s"$applyCar.OMSS").returns(strChannel)
(epicsReader.getIntegerChannel _).expects(s"$observeCar.CLID").returns(intChannel)
(epicsReader.getEnumChannel[CarState] _).expects(s"$observeCar.VAL", *).returns(carChannel)
(epicsReader.getStringChannel _).expects(s"$observeCar.OMSS").returns(strChannel)
(epicsReader, epicsWriter)
}
}
Expand Down
29 changes: 15 additions & 14 deletions modules/engine/src/main/scala/seqexec/engine/Engine.scala
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ class Engine[F[_]: MonadError[*[_], Throwable]: Logger, S, U](stateL: Engine.Sta
}

/**
* startFrom starts a sequence from an arbitrary step. It does it by marking all previous steps to be skipped and then
* modifying the state sequence as if it was run.
* If the requested step is already run or marked to be skipped, the sequence will start from the next runnable step
* startFrom starts a sequence from an arbitrary step. It does it by marking all previous steps to
* be skipped and then modifying the state sequence as if it was run. If the requested step is
* already run or marked to be skipped, the sequence will start from the next runnable step
*/
def startFrom(id: Observation.Id, step: StepId): HandleType[Unit] =
getS(id).flatMap {
Expand Down Expand Up @@ -133,16 +133,18 @@ class Engine[F[_]: MonadError[*[_], Throwable]: Logger, S, U](stateL: Engine.Sta

/**
* Refresh the steps executions of an existing sequence. Does not add nor remove steps.
* @param id sequence identifier
* @param steps List of new steps definitions
* @param id
* sequence identifier
* @param steps
* List of new steps definitions
* @return
*/
def update(id: Observation.Id, steps: List[Step[F]]): Endo[S] =
stateL.sequenceStateIndex(id).modify(_.update(steps.map(_.executions)))

/**
* Adds the current `Execution` to the completed `Queue`, makes the next
* pending `Execution` the current one, and initiates the actual execution.
* Adds the current `Execution` to the completed `Queue`, makes the next pending `Execution` the
* current one, and initiates the actual execution.
*
* If there are no more pending `Execution`s, it emits the `Finished` event.
*/
Expand Down Expand Up @@ -179,8 +181,8 @@ class Engine[F[_]: MonadError[*[_], Throwable]: Logger, S, U](stateL: Engine.Sta
)

/**
* Executes all actions in the `Current` `Execution` in parallel. When all are done it emits the `Executed` event.
* It also updates the `State` as needed.
* Executes all actions in the `Current` `Execution` in parallel. When all are done it emits the
* `Executed` event. It also updates the `State` as needed.
*/
// Send the expected event when the `Action` is executed
// It doesn't catch run time exceptions. If desired, the Action has to do it itself.
Expand Down Expand Up @@ -248,8 +250,8 @@ class Engine[F[_]: MonadError[*[_], Throwable]: Logger, S, U](stateL: Engine.Sta
}.getOrElse(unit))

/**
* Given the index of the completed `Action` in the current `Execution`, it
* marks the `Action` as completed and returns the new updated `State`.
* Given the index of the completed `Action` in the current `Execution`, it marks the `Action` as
* completed and returns the new updated `State`.
*
* When the index doesn't exist it does nothing.
*/
Expand Down Expand Up @@ -306,9 +308,8 @@ class Engine[F[_]: MonadError[*[_], Throwable]: Logger, S, U](stateL: Engine.Sta
}.getOrElse(unit))

/**
* For now it only changes the `Status` to `Paused` and returns the new
* `State`. In the future this function should handle the failed
* action.
* For now it only changes the `Status` to `Paused` and returns the new `State`. In the future
* this function should handle the failed action.
*/
private def fail(id: Observation.Id)(i: Int, e: Result.Error): HandleType[Unit] =
modifyS(id)(_.mark(i)(e)) *>
Expand Down
2 changes: 1 addition & 1 deletion modules/engine/src/main/scala/seqexec/engine/Event.scala
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ object Event {
r: Result.Partial[R]
): Event[F, Nothing, Nothing] =
EventSystem[F](PartialResult(id, stepId, i, r))
def paused[F[_]](id: Observation.Id, i: Int, c: Result.Paused[F]): Event[F, Nothing, Nothing] =
def paused[F[_]](id: Observation.Id, i: Int, c: Result.Paused[F]): Event[F, Nothing, Nothing] =
EventSystem[F](Paused[F](id, i, c))
def breakpointReached[F[_]](id: Observation.Id): Event[F, Nothing, Nothing] =
EventSystem[F](BreakpointReached(id))
Expand Down
7 changes: 3 additions & 4 deletions modules/engine/src/main/scala/seqexec/engine/Execution.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import mouse.boolean._
import seqexec.engine.Action.ActionState

/**
* This structure holds the current `Execution` under execution. It carries
* information about which `Action`s have been completed.
* This structure holds the current `Execution` under execution. It carries information about which
* `Action`s have been completed.
*/
final case class Execution[F[_]](execution: List[Action[F]]) {

Expand Down Expand Up @@ -60,8 +60,7 @@ object Execution {
def empty[F[_]]: Execution[F] = Execution[F](Nil)

/**
* Make an `Execution` `Current` only if all the `Action`s in the execution
* are pending.
* Make an `Execution` `Current` only if all the `Action`s in the execution are pending.
*/
def currentify[F[_]](as: ParallelActions[F]): Option[Execution[F]] =
as.forall(_.state.runState.isIdle).option(Execution(as.toList))
Expand Down
11 changes: 4 additions & 7 deletions modules/engine/src/main/scala/seqexec/engine/Handle.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,11 @@ import cats.syntax.all._
import fs2.Stream

/**
* Type constructor where all Seqexec side effect are managed.
* Handle is a State machine inside a F, which can produce Streams as output. It is combined with the
* input stream to run seqexec engine.
* Type constructor where all Seqexec side effect are managed. Handle is a State machine inside a F,
* which can produce Streams as output. It is combined with the input stream to run seqexec engine.
*
* Its type parameters are:
* A: Type of the output (usually Unit)
* V: Type of the events
* D: Type of the state machine state.
* Its type parameters are: A: Type of the output (usually Unit) V: Type of the events D: Type of
* the state machine state.
*/
final case class Handle[F[_], D, V, A](run: StateT[F, D, (A, Option[Stream[F, V]])])

Expand Down
Loading

0 comments on commit e79f3be

Please sign in to comment.