From 73b198be0925cc47d4ed9051fd5aa53040e7a5d0 Mon Sep 17 00:00:00 2001 From: Jonathan Lennox Date: Tue, 26 Sep 2023 16:49:52 -0400 Subject: [PATCH] [Squash] Add max_line_length to .editorconfig, and do resulting ktlint fixes. --- .editorconfig | 3 +++ .../kotlin/org/jitsi/utils/RangedString.kt | 27 ++++++++++++++++--- .../org/jitsi/utils/queue/QueueStatistics.kt | 12 +++++++-- 3 files changed, 37 insertions(+), 5 deletions(-) diff --git a/.editorconfig b/.editorconfig index d1d66d40..4a9df607 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,4 +1,6 @@ [*.{kt,kts}] +max_line_length = 120 + # Comma-separated list of rules to disable (Since 0.34.0) # Note that rules in any ruleset other than the standard ruleset will need to be prefixed # by the ruleset identifier. @@ -10,3 +12,4 @@ ktlint_standard_trailing-comma-on-declaration-site = disabled [pom.xml] indent_style = space indent_size = 4 +max_line_length = 120 diff --git a/src/main/kotlin/org/jitsi/utils/RangedString.kt b/src/main/kotlin/org/jitsi/utils/RangedString.kt index 8a74ff01..d79e19d1 100644 --- a/src/main/kotlin/org/jitsi/utils/RangedString.kt +++ b/src/main/kotlin/org/jitsi/utils/RangedString.kt @@ -94,7 +94,14 @@ fun Iterable.joinToRangedString( postfix: CharSequence = "", rangeLimit: Int = -1, truncated: CharSequence = "..." -): String = this.iterator().joinToRangedString(separator = separator, rangeSeparator = rangeSeparator, prefix = prefix, postfix = postfix, rangeLimit = rangeLimit, truncated = truncated) +): String = this.iterator().joinToRangedString( + separator = separator, + rangeSeparator = rangeSeparator, + prefix = prefix, + postfix = postfix, + rangeLimit = rangeLimit, + truncated = truncated +) fun Sequence.joinToRangedString( separator: CharSequence = ", ", @@ -103,7 +110,14 @@ fun Sequence.joinToRangedString( postfix: CharSequence = "", rangeLimit: Int = -1, truncated: CharSequence = "..." -): String = this.iterator().joinToRangedString(separator = separator, rangeSeparator = rangeSeparator, prefix = prefix, postfix = postfix, rangeLimit = rangeLimit, truncated = truncated) +): String = this.iterator().joinToRangedString( + separator = separator, + rangeSeparator = rangeSeparator, + prefix = prefix, + postfix = postfix, + rangeLimit = rangeLimit, + truncated = truncated +) fun Array.joinToRangedString( separator: CharSequence = ", ", @@ -112,4 +126,11 @@ fun Array.joinToRangedString( postfix: CharSequence = "", rangeLimit: Int = -1, truncated: CharSequence = "..." -): String = this.iterator().joinToRangedString(separator = separator, rangeSeparator = rangeSeparator, prefix = prefix, postfix = postfix, rangeLimit = rangeLimit, truncated = truncated) +): String = this.iterator().joinToRangedString( + separator = separator, + rangeSeparator = rangeSeparator, + prefix = prefix, + postfix = postfix, + rangeLimit = rangeLimit, + truncated = truncated +) diff --git a/src/main/kotlin/org/jitsi/utils/queue/QueueStatistics.kt b/src/main/kotlin/org/jitsi/utils/queue/QueueStatistics.kt index 49d99ccf..1229632d 100644 --- a/src/main/kotlin/org/jitsi/utils/queue/QueueStatistics.kt +++ b/src/main/kotlin/org/jitsi/utils/queue/QueueStatistics.kt @@ -127,7 +127,11 @@ class QueueStatistics(queueSize: Int, val clock: Clock) { QueueStatistics(queue.capacity(), clock) } - fun getStatistics() = OrderedJsonObject().apply { queueStatsById.entries.forEach { put(it.key, it.value.stats) } } + fun getStatistics() = OrderedJsonObject().apply { + queueStatsById.entries.forEach { + put(it.key, it.value.stats) + } + } /** * Calculate the capacity statistics buckets for a given queue capacity. @@ -175,7 +179,11 @@ class QueueStatisticsObserver( /** * A map of the time when objects were put in the queue */ - private val insertionTime = if (QueueStatistics.TRACK_TIMES) Collections.synchronizedMap(IdentityHashMap()) else null + private val insertionTime = if (QueueStatistics.TRACK_TIMES) { + Collections.synchronizedMap(IdentityHashMap()) + } else { + null + } private val localStats = if (QueueStatistics.DEBUG) QueueStatistics(queue.capacity(), clock) else null private val globalStats = QueueStatistics.globalStatsFor(queue, clock)