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 // .scalafix.conf
rules = [ rules = [
RemoveUnused RemoveUnused
"github:ohze/scalafix-rules/ConstructorProcedureSyntax"
] ]
RemoveUnused.imports = true RemoveUnused.imports = true
RemoveUnused.privates = false RemoveUnused.privates = false

View file

@ -28,37 +28,32 @@ final case class CapturedLogEvent(level: Level, message: String, cause: Option[T
message: String, message: String,
errorCause: Optional[Throwable], errorCause: Optional[Throwable],
marker: Optional[Marker], marker: Optional[Marker],
mdc: java.util.Map[String, Any]) { mdc: java.util.Map[String, Any]) =
this(level, message, errorCause.asScala, marker.asScala) this(level, message, errorCause.asScala, marker.asScala)
}
/** /**
* Constructor for Java API * Constructor for Java API
*/ */
def this(level: Level, message: String) { def this(level: Level, message: String) =
this(level, message, Option.empty, Option.empty) this(level, message, Option.empty, Option.empty)
}
/** /**
* Constructor for Java API * 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]) this(level, message, Some(errorCause), Option.empty[Marker])
}
/** /**
* Constructor for Java API * 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)) this(level, message, Option.empty[Throwable], Some(marker))
}
/** /**
* Constructor for Java API * 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)) this(level, message, Some(errorCause), Some(marker))
}
def getErrorCause: Optional[Throwable] = cause.asJava 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 akka.event.ActorEventBusSpec._
import EventBusSpec.TestActorWrapperActor import EventBusSpec.TestActorWrapperActor
def this() { def this() =
this(ConfigFactory.parseString("akka.actor.debug.event-stream = on").withFallback(AkkaSpec.testConf)) this(ConfigFactory.parseString("akka.actor.debug.event-stream = on").withFallback(AkkaSpec.testConf))
}
type BusType = MyActorEventBus type BusType = MyActorEventBus
def createNewEventBus(): BusType = new MyActorEventBus(system) def createNewEventBus(): BusType = new MyActorEventBus(system)

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -371,9 +371,8 @@ object Framing {
extends GraphStage[FlowShape[ByteString, ByteString]] { extends GraphStage[FlowShape[ByteString, ByteString]] {
//for the sake of binary compatibility //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) this(lengthFieldLength, lengthFieldOffset, maximumFrameLength, byteOrder, None)
}
private val minimumChunkSize = lengthFieldOffset + lengthFieldLength private val minimumChunkSize = lengthFieldOffset + lengthFieldLength
private val intDecoder = byteOrder match { 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 { 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 override def isDebugEnabled: Boolean = true