From f030e098a8a8438413f564c50703609c18e71ac1 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 2 Oct 2020 17:18:39 +0200 Subject: [PATCH] Fix code quality and compilation test --- .../sdk/session/search/SearchMessagesTest.kt | 4 ++-- .../search/response/SearchResponseRoomEvents.kt | 13 ++++++++++--- tools/check/forbidden_strings_in_code.txt | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/session/search/SearchMessagesTest.kt b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/session/search/SearchMessagesTest.kt index 1d4eb758ed..8ae8ef1b44 100644 --- a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/session/search/SearchMessagesTest.kt +++ b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/session/search/SearchMessagesTest.kt @@ -90,7 +90,7 @@ class SearchMessagesTest : InstrumentedTest { assertTrue( data.results ?.all { - (it.content?.get("body") as? String)?.startsWith(MESSAGE).orFalse() + (it.event.content?.get("body") as? String)?.startsWith(MESSAGE).orFalse() }.orFalse() ) lock.countDown() @@ -154,7 +154,7 @@ class SearchMessagesTest : InstrumentedTest { assertTrue( data.results ?.all { - (it.content?.get("body") as? String)?.startsWith(MESSAGE).orFalse() + (it.event.content?.get("body") as? String)?.startsWith(MESSAGE).orFalse() }.orFalse() ) lock.countDown() diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/search/response/SearchResponseRoomEvents.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/search/response/SearchResponseRoomEvents.kt index 1078b9a9f9..2aac427232 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/search/response/SearchResponseRoomEvents.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/search/response/SearchResponseRoomEvents.kt @@ -22,15 +22,22 @@ import com.squareup.moshi.JsonClass @JsonClass(generateAdapter = true) internal data class SearchResponseRoomEvents( - // List of results in the requested order. + /** + * List of results in the requested order. + */ @Json(name = "results") val results: List? = null, @Json(name = "count") val count: Int? = null, - // List of words which should be highlighted, useful for stemming which may change the query terms. + /** + * List of words which should be highlighted, useful for stemming which may change the query terms. + */ @Json(name = "highlights") val highlights: List? = null, - // Token that can be used to get the next batch of results, by passing as the next_batch parameter to the next call. If this field is absent, there are no more results. + /** + * Token that can be used to get the next batch of results, by passing as the next_batch parameter to the next call. + * If this field is absent, there are no more results. + */ @Json(name = "next_batch") val nextBatch: String? = null ) diff --git a/tools/check/forbidden_strings_in_code.txt b/tools/check/forbidden_strings_in_code.txt index 1d3aaa9f69..9c00dca278 100644 --- a/tools/check/forbidden_strings_in_code.txt +++ b/tools/check/forbidden_strings_in_code.txt @@ -164,7 +164,7 @@ Formatter\.formatShortFileSize===1 # android\.text\.TextUtils ### This is not a rule, but a warning: the number of "enum class" has changed. For Json classes, it is mandatory that they have `@JsonClass(generateAdapter = false)`. If it is ok, change the value in file forbidden_strings_in_code.txt -enum class===80 +enum class===81 ### Do not import temporary legacy classes import org.matrix.android.sdk.internal.legacy.riot===3