scalafix ConstructorProcedureSyntax

fix by:
+ enabling only ConstructorProcedureSyntax rule in .scalafix.conf
+ then:
```
% sbt -Dakka.build.scalaVersion=2.13.1
> fixall
> scalafmtAll
```
This commit is contained in:
Bùi Việt Thành 2020-04-03 00:13:12 +07:00
parent 68e30b39bc
commit 46a310e2cc
10 changed files with 15 additions and 26 deletions

View file

@ -1,6 +1,7 @@
// .scalafix.conf
rules = [
RemoveUnused
"github:ohze/scalafix-rules/ConstructorProcedureSyntax"
]
RemoveUnused.imports = true
RemoveUnused.privates = false

View file

@ -28,37 +28,32 @@ final case class CapturedLogEvent(level: Level, message: String, cause: Option[T
message: String,
errorCause: Optional[Throwable],
marker: Optional[Marker],
mdc: java.util.Map[String, Any]) {
mdc: java.util.Map[String, Any]) =
this(level, message, errorCause.asScala, marker.asScala)
}
/**
* Constructor for Java API
*/
def this(level: Level, message: String) {
def this(level: Level, message: String) =
this(level, message, Option.empty, Option.empty)
}
/**
* Constructor for Java API
*/
def this(level: Level, message: String, errorCause: Throwable) {
def this(level: Level, message: String, errorCause: Throwable) =
this(level, message, Some(errorCause), Option.empty[Marker])
}
/**
* Constructor for Java API
*/
def this(level: Level, message: String, marker: Marker) {
def this(level: Level, message: String, marker: Marker) =
this(level, message, Option.empty[Throwable], Some(marker))
}
/**
* Constructor for Java API
*/
def this(level: Level, message: String, errorCause: Throwable, marker: Marker) {
def this(level: Level, message: String, errorCause: Throwable, marker: Marker) =
this(level, message, Some(errorCause), Some(marker))
}
def getErrorCause: Optional[Throwable] = cause.asJava

View file

@ -172,9 +172,8 @@ class ActorEventBusSpec(conf: Config) extends EventBusSpec("ActorEventBus", conf
import akka.event.ActorEventBusSpec._
import EventBusSpec.TestActorWrapperActor
def this() {
def this() =
this(ConfigFactory.parseString("akka.actor.debug.event-stream = on").withFallback(AkkaSpec.testConf))
}
type BusType = MyActorEventBus
def createNewEventBus(): BusType = new MyActorEventBus(system)

View file

@ -16,8 +16,8 @@ object ReflectSpec {
class Two(@unused a: A, @unused b: B)
class MultipleOne(a: A, b: B) {
def this(a: A) { this(a, null) }
def this(b: B) { this(null, b) }
def this(a: A) = this(a, null)
def this(b: B) = this(null, b)
}
}

View file

@ -127,7 +127,7 @@ object ClusterShardingSettings {
val updatingStateTimeout: FiniteDuration,
val waitingForStateTimeout: FiniteDuration) {
def this(classic: ClassicShardingSettings.TuningParameters) {
def this(classic: ClassicShardingSettings.TuningParameters) =
this(
bufferSize = classic.bufferSize,
coordinatorFailureBackoff = classic.coordinatorFailureBackoff,
@ -147,8 +147,6 @@ object ClusterShardingSettings {
entityRecoveryConstantRateStrategyFrequency = classic.entityRecoveryConstantRateStrategyFrequency,
entityRecoveryConstantRateStrategyNumberOfEntities = classic.entityRecoveryConstantRateStrategyNumberOfEntities)
}
require(
entityRecoveryStrategy == "all" || entityRecoveryStrategy == "constant",
s"Unknown 'entity-recovery-strategy' [$entityRecoveryStrategy], valid values are 'all' or 'constant'")

View file

@ -104,7 +104,7 @@ final class DistributedPubSubSettings(
routingLogic: RoutingLogic,
gossipInterval: FiniteDuration,
removedTimeToLive: FiniteDuration,
maxDeltaElements: Int) {
maxDeltaElements: Int) =
this(
role,
routingLogic,
@ -112,7 +112,6 @@ final class DistributedPubSubSettings(
removedTimeToLive,
maxDeltaElements,
sendToDeadLettersWhenNoSubscribers = true)
}
require(
!routingLogic.isInstanceOf[ConsistentHashingRoutingLogic],

View file

@ -45,7 +45,7 @@ class LocalConcurrencySpec(_system: ActorSystem)
with ImplicitSender {
import LocalConcurrencySpec._
def this() {
def this() =
this(
ActorSystem(
"LocalConcurrencySpec",
@ -54,7 +54,6 @@ class LocalConcurrencySpec(_system: ActorSystem)
akka.remote.classic.netty.tcp.port=0
akka.remote.artery.canonical.port = 0
""")))
}
override def afterAll(): Unit = {
shutdown(system)

View file

@ -101,7 +101,7 @@ abstract class EventAdapterSpec(journalName: String, journalConfig: Config, adap
import EventAdapterSpec._
def this(journalName: String) {
def this(journalName: String) =
this(
"inmem",
PersistenceSpec.config("inmem", "InmemPersistentTaggingSpec"),
@ -150,7 +150,6 @@ abstract class EventAdapterSpec(journalName: String, journalConfig: Config, adap
| }
|}
""".stripMargin))
}
def persister(name: String, journalId: String = journalName) =
system.actorOf(Props(classOf[PersistAllIncomingActor], name, "akka.persistence.journal." + journalId))

View file

@ -371,9 +371,8 @@ object Framing {
extends GraphStage[FlowShape[ByteString, ByteString]] {
//for the sake of binary compatibility
def this(lengthFieldLength: Int, lengthFieldOffset: Int, maximumFrameLength: Int, byteOrder: ByteOrder) {
def this(lengthFieldLength: Int, lengthFieldOffset: Int, maximumFrameLength: Int, byteOrder: ByteOrder) =
this(lengthFieldLength, lengthFieldOffset, maximumFrameLength, byteOrder, None)
}
private val minimumChunkSize = lengthFieldOffset + lengthFieldLength
private val intDecoder = byteOrder match {

View file

@ -17,7 +17,7 @@ final class AkkaLoggerFactory(system: ActorSystem) extends LoggerFactory {
}
class AkkaLoggerBridge(bus: EventStream, logSource: String, logClass: Class[_]) extends NoDepsLogger {
def this(bus: EventStream, clazz: Class[_]) { this(bus, clazz.getCanonicalName, clazz) }
def this(bus: EventStream, clazz: Class[_]) = this(bus, clazz.getCanonicalName, clazz)
override def isDebugEnabled: Boolean = true