Skip to content

Commit

Permalink
[Squash] Add max_line_length to .editorconfig, and do resulting ktlin…
Browse files Browse the repository at this point in the history
…t fixes.
  • Loading branch information
JonathanLennox committed Sep 26, 2023
1 parent f5f97bc commit 73b198b
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -10,3 +12,4 @@ ktlint_standard_trailing-comma-on-declaration-site = disabled
[pom.xml]
indent_style = space
indent_size = 4
max_line_length = 120
27 changes: 24 additions & 3 deletions src/main/kotlin/org/jitsi/utils/RangedString.kt
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,14 @@ fun Iterable<Int>.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<Int>.joinToRangedString(
separator: CharSequence = ", ",
Expand All @@ -103,7 +110,14 @@ fun Sequence<Int>.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<Int>.joinToRangedString(
separator: CharSequence = ", ",
Expand All @@ -112,4 +126,11 @@ fun Array<Int>.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
)
12 changes: 10 additions & 2 deletions src/main/kotlin/org/jitsi/utils/queue/QueueStatistics.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -175,7 +179,11 @@ class QueueStatisticsObserver<T>(
/**
* A map of the time when objects were put in the queue
*/
private val insertionTime = if (QueueStatistics.TRACK_TIMES) Collections.synchronizedMap(IdentityHashMap<Any, Instant>()) else null
private val insertionTime = if (QueueStatistics.TRACK_TIMES) {
Collections.synchronizedMap(IdentityHashMap<Any, Instant>())
} else {
null
}

private val localStats = if (QueueStatistics.DEBUG) QueueStatistics(queue.capacity(), clock) else null
private val globalStats = QueueStatistics.globalStatsFor(queue, clock)
Expand Down

0 comments on commit 73b198b

Please sign in to comment.