Skip to content

Commit

Permalink
scalafmt 2.3.2
Browse files Browse the repository at this point in the history
Also fixed minor formatting changes that happen with this
newer version.
  • Loading branch information
brharrington committed Jan 20, 2020
1 parent fb86bed commit e1f3c98
Show file tree
Hide file tree
Showing 26 changed files with 39 additions and 22 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.0.0-RC5
version = 2.3.2

style = defaultWithAlign

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import com.typesafe.scalalogging.StrictLogging
* actors to start up can be specified using the `atlas.akka.actors` property.
*/
@Singleton
class ActorService @Inject()(system: ActorSystem, config: Config, classFactory: ClassFactory)
class ActorService @Inject() (system: ActorSystem, config: Config, classFactory: ClassFactory)
extends AbstractService
with StrictLogging {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import scala.concurrent.duration.Duration
* Instance of the actor system.
*/
@Singleton
class WebServer @Inject()(
class WebServer @Inject() (
config: Config,
classFactory: ClassFactory,
registry: Registry,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import com.netflix.atlas.core.util.Streams
* Helper functions for working with fonts.
*/
object Fonts {

private def loadTrueTypeFont(resource: String): Font = {
Streams.scope(getClass.getClassLoader.getResourceAsStream(resource)) { in =>
Font.createFont(Font.TRUETYPE_FONT, in).deriveFont(12.0f)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,11 @@ class GraphAssertions(goldenDir: String, targetDir: String, assert: (Any, Any) =
if (!Fonts.shouldRunTests) return

if (bless) blessImage(i1, f)
val i2 = try getImage(f)
catch {
case e: FileNotFoundException => PngImage.error(e.getMessage, 400, 300)
}
val i2 =
try getImage(f)
catch {
case e: FileNotFoundException => PngImage.error(e.getMessage, 400, 300)
}
val diff = PngImage.diff(i1.data, i2.data)
writeImage(i1, targetDir, f)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class ItemId private (private val data: Array[Byte], private val hc: Int)
}

object ItemId {

private val hexValueForByte = (0 until 256).toArray.map { i =>
Strings.zeroPad(i, 2)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ object Strings {
*/
private val IsoDate = """^(\d{4}-\d{2}-\d{2}(?:[-+Z].*)?)$""".r
private val IsoDateTime = """^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?Z?)$""".r

private val IsoOffsetDateTime =
"""^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?[-+].*)$""".r

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package com.netflix.atlas.core.validation

/** Verifies that all of the tag rules match. */
case class CompositeTagRule(tagRules: List[TagRule]) extends TagRule {

override def validate(k: String, v: String): ValidationResult = {
validate(tagRules, k, v)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import com.typesafe.config.Config
* ```
*/
case class MaxUserTagsRule(limit: Int) extends Rule {

override def validate(tags: SmallHashMap[String, String]): ValidationResult = {
var count = 0
val iter = tags.entriesIterator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import com.typesafe.config.Config
* This config would only allow "nf.app" and "nf.cluster" with a prefix of "nf.".
*/
case class ReservedKeyRule(prefix: String, allowedKeys: Set[String]) extends TagRule {

override def validate(k: String, v: String): ValidationResult = {
if (k.startsWith(prefix) && !allowedKeys.contains(k))
failure(s"invalid key for reserved prefix '$prefix': $k")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ object AggrDatapoint {
* set.
*/
private class GroupByAggregator extends Aggregator {

private val aggregators =
scala.collection.mutable.AnyRefMap.empty[Map[String, String], SimpleAggregator]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,20 +131,20 @@ private[stream] object EurekaSource extends StrictLogging {
case class App(name: String, instance: List[Instance]) {
require(instance != null, "instance cannot be null")
}

//the json field name "instances" conflicts with method name, need to explicitly map it with annotation
case class EddaResponse(uri: String, @JsonProperty("instances") eddaInstances: List[EddaInstance])
extends GroupResponse {
require(eddaInstances != null, "eddaInstances cannot be null")

def instances: List[Instance] =
eddaInstances.map(
eddaInstance =>
Instance(
eddaInstance.instanceId,
"UP",
DataCenterInfo("Amazon", Map("local-ipv4" -> eddaInstance.privateIpAddress)),
PortInfo()
)
eddaInstances.map(eddaInstance =>
Instance(
eddaInstance.instanceId,
"UP",
DataCenterInfo("Amazon", Map("local-ipv4" -> eddaInstance.privateIpAddress)),
PortInfo()
)
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ class GrapherSuite extends AnyFunSuite with BeforeAndAfterAll {
}

object GrapherSuite {

case class GraphResponse(
start: Long,
step: Long,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package com.netflix.atlas.eval.model
import org.scalatest.funsuite.AnyFunSuite

class TimeSeriesMessageSuite extends AnyFunSuite {

private val baseMessage = TimeSeriesMessage(
id = "12345",
query = "name,sps,:eq,(,cluster,),:by",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import scala.util.Success
class EvaluatorSuite extends AnyFunSuite with BeforeAndAfter {

private val targetDir = Paths.get(SrcPath.forProject("atlas-eval"), "target", "EvaluatorSuite")

private val resourcesDir =
Paths.get(SrcPath.forProject("atlas-eval"), "src", "test", "resources")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class LwcToAggrDatapointSuite extends AnyFunSuite {
private val step = 10000

private val sumMetric = s"""{"id":"sum","expression":"name,cpu,:eq,:sum","frequency":$step}"""

private val countMetric =
s"""{"id":"count","expression":"name,cpu,:eq,:count","frequency":$step}"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import com.netflix.atlas.json.JsonSupport
import com.netflix.spectator.api.Registry
import com.typesafe.scalalogging.StrictLogging

case class ExpressionApi @Inject()(
case class ExpressionApi @Inject() (
sm: StreamSubscriptionManager,
registry: Registry,
implicit val actorRefFactory: ActorRefFactory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import javax.inject.Inject
* used to allow clients that will stream data time to connect before marking the instance
* as UP so that clients publishing data will send to the instance.
*/
class StartupDelayService @Inject()(registry: Registry, config: Config)
class StartupDelayService @Inject() (registry: Registry, config: Config)
extends AbstractService
with StrictLogging {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import scala.concurrent.duration._
import scala.util.Failure
import scala.util.Success

class StreamApi @Inject()(
class StreamApi @Inject() (
config: Config,
registry: Registry,
sm: StreamSubscriptionManager,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import scala.util.Failure
import scala.util.Success
import scala.util.control.NonFatal

class SubscribeApi @Inject()(
class SubscribeApi @Inject() (
config: Config,
registry: Registry,
sm: StreamSubscriptionManager,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,10 @@ class ExpressionApiSuite extends AnyFunSuite with ScalatestRouteTest {

private val skanCount =
"""{"expression":"nf.cluster,skan,:eq,:count","frequency":60000,"id":"6278fa6047c07316d7e265a1004882ab9e1007af"}"""

private val skanSum =
"""{"expression":"nf.cluster,skan,:eq,:sum","frequency":60000,"id":"36e0a2c61b48e062bba5361d059afd313c82c674"}"""

private val brhMax =
"""{"expression":"nf.app,brh,:eq,:max","frequency":60000,"id":"16f1b0930c0eeae0225374ea88c01e161e589aff"}"""
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import com.typesafe.config.ConfigFactory
import org.scalatest.funsuite.AnyFunSuite

class ExpressionSplitterSuite extends AnyFunSuite {

private val query1 =
"nf.cluster,skan-test,:eq,name,memUsed,:eq,:and,:avg,(,nf.node,),:by,4500000000,:gt,30,:rolling-count,15,:ge,$nf.node,:legend"
private val frequency1 = 60000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ final class AkkaModule extends AbstractModule {
object AkkaModule extends StrictLogging {

@Singleton
private class ActorSystemProvider @Inject()(config: Config)
private class ActorSystemProvider @Inject() (config: Config)
extends Provider[ActorSystem]
with AutoCloseable {

Expand All @@ -76,7 +76,7 @@ object AkkaModule extends StrictLogging {
}

@Singleton
private class MaterializerProvider @Inject()(system: ActorSystem, registry: Registry)
private class MaterializerProvider @Inject() (system: ActorSystem, registry: Registry)
extends Provider[Materializer]
with AutoCloseable {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ class CloudWatchPoller(

// Cache of the last values received for a given metric
private val cacheTTL = config.getDuration("atlas.cloudwatch.cache-ttl")

private val metricCache = Caffeine
.newBuilder()
.expireAfterWrite(cacheTTL.toMillis, TimeUnit.MILLISECONDS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class MetricDataSuite extends AnyFunSuite {

private val definition =
MetricDefinition("test", "alias", Conversions.fromName("sum"), false, Map.empty)

private val category =
MetricCategory("namespace", 60, 1, 5, None, List("dimension"), List(definition), Query.True)
private val metadata = MetricMetadata(category, definition, Nil)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import com.typesafe.config.Config
* Created by brharrington on 7/20/16.
*/
@Singleton
class DatabaseProvider @Inject()(config: Config, classFactory: ClassFactory)
class DatabaseProvider @Inject() (config: Config, classFactory: ClassFactory)
extends Provider[Database] {

private val db = {
Expand Down

0 comments on commit e1f3c98

Please sign in to comment.