Linting fixes

This commit is contained in:
arkon
2020-04-25 14:24:45 -04:00
parent 4da760d614
commit 3f63b320c4
272 changed files with 4167 additions and 3602 deletions
@@ -9,11 +9,11 @@ import kotlinx.coroutines.Job
import kotlinx.coroutines.launch
fun launchUI(block: suspend CoroutineScope.() -> Unit): Job =
GlobalScope.launch(Dispatchers.Main, CoroutineStart.DEFAULT, block)
GlobalScope.launch(Dispatchers.Main, CoroutineStart.DEFAULT, block)
fun launchIO(block: suspend CoroutineScope.() -> Unit): Job =
GlobalScope.launch(Dispatchers.IO, CoroutineStart.DEFAULT, block)
GlobalScope.launch(Dispatchers.IO, CoroutineStart.DEFAULT, block)
@OptIn(ExperimentalCoroutinesApi::class)
fun launchNow(block: suspend CoroutineScope.() -> Unit): Job =
GlobalScope.launch(Dispatchers.Main, CoroutineStart.UNDISPATCHED, block)
GlobalScope.launch(Dispatchers.Main, CoroutineStart.UNDISPATCHED, block)
@@ -36,8 +36,9 @@ fun Long.toDateKey(): Date {
* @return Calendar instance at supplied epoch time. Null if epoch was 0.
*/
fun Long.toCalendar(): Calendar? {
if (this == 0L)
if (this == 0L) {
return null
}
val cal = Calendar.getInstance()
cal.timeInMillis = this
return cal
@@ -4,8 +4,10 @@ import java.security.MessageDigest
object Hash {
private val chars = charArrayOf('0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'a', 'b', 'c', 'd', 'e', 'f')
private val chars = charArrayOf(
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'a', 'b', 'c', 'd', 'e', 'f'
)
private val MD5 get() = MessageDigest.getInstance("MD5")
@@ -7,10 +7,11 @@ import kotlin.math.floor
* If [replacement] is longer than [count] an exception will be thrown when `length > count`.
*/
fun String.chop(count: Int, replacement: String = "..."): String {
return if (length > count)
return if (length > count) {
take(count - replacement.length) + replacement
else
} else {
this
}
}
/**
@@ -18,8 +19,9 @@ fun String.chop(count: Int, replacement: String = "..."): String {
* If [replacement] is longer than [count] an exception will be thrown when `length > count`.
*/
fun String.truncateCenter(count: Int, replacement: String = "..."): String {
if (length <= count)
if (length <= count) {
return this
}
val pieceLength: Int = floor((count - replacement.length).div(2.0)).toInt()