style(detekt): Restrict the number of return statements in methods

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2024-12-13 18:23:41 +01:00
parent 0c2a29f27e
commit 8d0c6b0ce3
No known key found for this signature in database
GPG Key ID: 6CADC7E3523C308B
2 changed files with 7 additions and 8 deletions

View File

@ -117,15 +117,14 @@ class PushUtils {
private fun saveKeyToFile(key: Key, path: String): Int {
val encoded = key.encoded
try {
if (!File(path).exists()) {
if (!File(path).createNewFile()) {
return -1
return if (!File(path).exists() && !File(path).createNewFile()) {
-1
} else {
FileOutputStream(path).use { keyFileOutputStream ->
keyFileOutputStream.write(encoded)
0
}
}
FileOutputStream(path).use { keyFileOutputStream ->
keyFileOutputStream.write(encoded)
return 0
}
} catch (e: FileNotFoundException) {
Log.d(TAG, "Failed to save key to file")
} catch (e: IOException) {

View File

@ -1,7 +1,7 @@
# SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: GPL-3.0-or-later
build:
maxIssues: 83
maxIssues: 82
weights:
# complexity: 2
# LongParameterList: 1