Skip to content

Commit 10e5357

Browse files
tobiasKaminskyAlvaroBrey
authored andcommitted
fix findings of detekt
do no allow any issues on detekt Signed-off-by: tobiasKaminsky <[email protected]>
1 parent ee266a8 commit 10e5357

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

library/detekt.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
build:
2-
maxIssues: 8
2+
maxIssues: 0
33
weights:
44
# complexity: 2
55
# LongParameterList: 1

library/src/androidTest/java/com/nextcloud/common/NextcloudUriDelegateIT.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,28 @@ class NextcloudUriDelegateIT {
1515
}
1616

1717
@Test
18-
fun testFilesDavUri_leadingSlashInPath() {
18+
fun testFilesDavUriLeadingSlashInPath() {
1919
val expected = "$EXPECTED_FILES_DAV/path/to/file.txt"
2020
val actual = sut.getFilesDavUri("/path/to/file.txt")
2121
Assert.assertEquals("Wrong URL", expected, actual)
2222
}
2323

2424
@Test
25-
fun testFilesDavUri_noLeadingSlashInPath() {
25+
fun testFilesDavUriLoLeadingSlashInPath() {
2626
val expected = "$EXPECTED_FILES_DAV/path/to/file.txt"
2727
val actual = sut.getFilesDavUri("path/to/file.txt")
2828
Assert.assertEquals("Wrong URL", expected, actual)
2929
}
3030

3131
@Test
32-
fun testFilesDavUri_emptyPath() {
32+
fun testFilesDavUriEmptyPath() {
3333
val expected = "$EXPECTED_FILES_DAV/"
3434
val actual = sut.getFilesDavUri("")
3535
Assert.assertEquals("Wrong URL", expected, actual)
3636
}
3737

3838
@Test
39-
fun testFilesDavUri_rootPath() {
39+
fun testFilesDavUriRootPath() {
4040
val expected = "$EXPECTED_FILES_DAV/"
4141
val actual = sut.getFilesDavUri("/")
4242
Assert.assertEquals("Wrong URL", expected, actual)

library/src/androidTest/java/com/owncloud/android/lib/resources/shares/ShareXMLParserIT.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import junit.framework.Assert.assertEquals
3030
import junit.framework.Assert.assertTrue
3131
import org.junit.Test
3232

33+
@Suppress("LargeClass", "LongMethod")
3334
class ShareXMLParserIT {
3435
@Test
3536
fun testOCShareResponse() {

library/src/main/java/com/nextcloud/common/NextcloudClient.kt

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ class NextcloudClient private constructor(
124124
}
125125

126126
@Throws(IOException::class)
127+
@Suppress("NestedBlockDepth")
127128
fun followRedirection(method: OkHttpMethodBase): RedirectionPath {
128129
var redirectionsCount = 0
129130
var status = method.getStatusCode()
@@ -133,10 +134,9 @@ class NextcloudClient private constructor(
133134
status == HttpStatus.SC_MOVED_TEMPORARILY ||
134135
status == HttpStatus.SC_TEMPORARY_REDIRECT
135136
while (redirectionsCount < OwnCloudClient.MAX_REDIRECTIONS_COUNT && statusIsRedirection) {
136-
var location = method.getResponseHeader("Location")
137-
if (location == null) {
138-
location = method.getResponseHeader("location")
139-
}
137+
val location = method.getResponseHeader("Location")
138+
?: method.getResponseHeader("location")
139+
140140
if (location != null) {
141141
Log_OC.d(TAG, "Location to redirect: $location")
142142
result.addLocation(location)
@@ -145,10 +145,7 @@ class NextcloudClient private constructor(
145145
method.releaseConnection()
146146
method.uri = location
147147
var destination = method.getRequestHeader("Destination")
148-
149-
if (destination == null) {
150-
destination = method.getRequestHeader("destination")
151-
}
148+
?: method.getRequestHeader("destination")
152149

153150
if (destination != null) {
154151
val suffixIndex = location.lastIndexOf(AccountUtils.WEBDAV_PATH_9_0)
@@ -164,12 +161,14 @@ class NextcloudClient private constructor(
164161
method.addRequestHeader("Destination", destination)
165162
}
166163
}
164+
167165
status = method.execute(this)
168166
result.addStatus(status)
169167
redirectionsCount++
170168
} else {
171169
Log_OC.d(TAG, "No location to redirect!")
172170
status = HttpStatus.SC_NOT_FOUND
171+
result.addStatus(status)
173172
}
174173
}
175174
return result

library/src/main/java/com/nextcloud/common/OkHttpMethodBase.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ abstract class OkHttpMethodBase(
124124
return response?.header(name)
125125
}
126126

127-
fun getRequestHeader(name: String): String {
128-
return request?.header(name) ?: ""
127+
fun getRequestHeader(name: String): String? {
128+
return request?.header(name)
129129
}
130130

131131
/**

0 commit comments

Comments
 (0)