Fix linting warnings (#9701)

* fix: VariableNaming warnings

* fix: MatchingDeclarationName warnings

* fix: SwallowedException warnings

* fix: UseRequire warnings

* Revert "fix: MatchingDeclarationName warnings"

This reverts commit 9475af5052.
This commit is contained in:
alexban011 2023-07-26 07:30:14 +03:00 committed by GitHub
parent 3c76e2bc64
commit 5f8c675512
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 8 deletions

View File

@ -183,7 +183,7 @@ class ApiV2(private val baseUrl: String) : ApiV2Wrapper(baseUrl), Disposable {
val b: VersionResponse = r.body()
b.version == 2
}
} catch (e: IllegalArgumentException) {
} catch (_: IllegalArgumentException) {
false
} catch (e: Throwable) {
Log.error("Unexpected exception calling version endpoint for '$baseUrl': $e")
@ -204,7 +204,7 @@ class ApiV2(private val baseUrl: String) : ApiV2Wrapper(baseUrl), Disposable {
val b: ApiErrorResponse = r.body()
b.statusCode == ApiStatusCode.Unauthenticated
}
} catch (e: IllegalArgumentException) {
} catch (_: IllegalArgumentException) {
false
} catch (e: Throwable) {
Log.error("Unexpected exception calling WebSocket endpoint for '$baseUrl': $e")
@ -339,9 +339,7 @@ class ApiV2(private val baseUrl: String) : ApiV2Wrapper(baseUrl), Disposable {
* This function may also throw arbitrary exceptions for network failures.
*/
suspend fun awaitPing(size: Int = 2, timeout: Long? = null): Double? {
if (size < 2) {
throw IllegalArgumentException("Size too small to identify ping responses uniquely")
}
require(size < 2) { "Size too small to identify ping responses uniquely" }
val body = ByteArray(size)
Random().nextBytes(body)
@ -371,7 +369,7 @@ class ApiV2(private val baseUrl: String) : ApiV2Wrapper(baseUrl), Disposable {
throw exception
}
}.toDouble() / 10e6
} catch (c: ClosedReceiveChannelException) {
} catch (_: ClosedReceiveChannelException) {
return null
} finally {
synchronized(this) {
@ -448,7 +446,7 @@ class ApiV2(private val baseUrl: String) : ApiV2Wrapper(baseUrl), Disposable {
Concurrency.run {
try {
c.send((msg as WebSocketMessageWithContent).content)
} catch (closed: ClosedSendChannelException) {
} catch (_: ClosedSendChannelException) {
delay(10)
eventChannelList.remove(c)
} catch (t: Throwable) {

View File

@ -50,7 +50,7 @@ class OnlineMultiplayerServer(
if (result.isNotEmpty()) {
featureSet = try {
json().fromJson(ServerFeatureSet::class.java, result)
} catch (ex: Exception) {
} catch (_: Exception) {
// The server does not support server feature set - not an error!
ServerFeatureSet()
}