Detekt: fix ConstructorParameterNaming

UserProperties fix is also in https://github.com/matrix-org/matrix-analytics-events/pull/62
This commit is contained in:
Benoit Marty 2022-05-12 22:15:27 +02:00
parent 6f3b9c78b0
commit 03ec9946ff
13 changed files with 34 additions and 35 deletions

View File

@ -22,15 +22,15 @@ package org.matrix.android.sdk.api.logger
* val loggerTag = LoggerTag("MyTag", LoggerTag.VOIP)
* Timber.tag(loggerTag.value).v("My log message")
*/
open class LoggerTag(_value: String, parentTag: LoggerTag? = null) {
open class LoggerTag(name: String, parentTag: LoggerTag? = null) {
object SYNC : LoggerTag("SYNC")
object VOIP : LoggerTag("VOIP")
object CRYPTO : LoggerTag("CRYPTO")
val value: String = if (parentTag == null) {
_value
name
} else {
"${parentTag.value}/$_value"
"${parentTag.value}/$name"
}
}

View File

@ -27,13 +27,13 @@ import timber.log.Timber
@JsonClass(generateAdapter = true)
data class RoomGuestAccessContent(
// Required. Whether guests can join the room. One of: ["can_join", "forbidden"]
@Json(name = "guest_access") val _guestAccess: String? = null
@Json(name = "guest_access") val guestAccessStr: String? = null
) {
val guestAccess: GuestAccess? = when (_guestAccess) {
val guestAccess: GuestAccess? = when (guestAccessStr) {
"can_join" -> GuestAccess.CanJoin
"forbidden" -> GuestAccess.Forbidden
else -> {
Timber.w("Invalid value for GuestAccess: `$_guestAccess`")
Timber.w("Invalid value for GuestAccess: `$guestAccessStr`")
null
}
}

View File

@ -22,15 +22,15 @@ import timber.log.Timber
@JsonClass(generateAdapter = true)
data class RoomHistoryVisibilityContent(
@Json(name = "history_visibility") val _historyVisibility: String? = null
@Json(name = "history_visibility") val historyVisibilityStr: String? = null
) {
val historyVisibility: RoomHistoryVisibility? = when (_historyVisibility) {
val historyVisibility: RoomHistoryVisibility? = when (historyVisibilityStr) {
"world_readable" -> RoomHistoryVisibility.WORLD_READABLE
"shared" -> RoomHistoryVisibility.SHARED
"invited" -> RoomHistoryVisibility.INVITED
"joined" -> RoomHistoryVisibility.JOINED
else -> {
Timber.w("Invalid value for RoomHistoryVisibility: `$_historyVisibility`")
Timber.w("Invalid value for RoomHistoryVisibility: `$historyVisibilityStr`")
null
}
}

View File

@ -27,7 +27,7 @@ import timber.log.Timber
*/
@JsonClass(generateAdapter = true)
data class RoomJoinRulesContent(
@Json(name = "join_rule") val _joinRules: String? = null,
@Json(name = "join_rule") val joinRulesStr: String? = null,
/**
* If the allow key is an empty list (or not a list at all),
* then no users are allowed to join without an invite.
@ -35,14 +35,14 @@ data class RoomJoinRulesContent(
*/
@Json(name = "allow") val allowList: List<RoomJoinRulesAllowEntry>? = null
) {
val joinRules: RoomJoinRules? = when (_joinRules) {
val joinRules: RoomJoinRules? = when (joinRulesStr) {
"public" -> RoomJoinRules.PUBLIC
"invite" -> RoomJoinRules.INVITE
"knock" -> RoomJoinRules.KNOCK
"private" -> RoomJoinRules.PRIVATE
"restricted" -> RoomJoinRules.RESTRICTED
else -> {
Timber.w("Invalid value for RoomJoinRules: `$_joinRules`")
Timber.w("Invalid value for RoomJoinRules: `$joinRulesStr`")
null
}
}

View File

@ -47,7 +47,7 @@ class RestrictedRoomPreset(val homeServerCapabilities: HomeServerCapabilities, v
type = EventType.STATE_ROOM_JOIN_RULES,
stateKey = "",
content = RoomJoinRulesContent(
_joinRules = RoomJoinRules.RESTRICTED.value,
joinRulesStr = RoomJoinRules.RESTRICTED.value,
allowList = restrictedList
).toContent()
)

View File

@ -20,6 +20,6 @@ import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = false)
sealed class LazyRoomSyncEphemeral {
data class Parsed(val _roomSyncEphemeral: RoomSyncEphemeral) : LazyRoomSyncEphemeral()
data class Parsed(val roomSyncEphemeral: RoomSyncEphemeral) : LazyRoomSyncEphemeral()
object Stored : LazyRoomSyncEphemeral()
}

View File

@ -16,14 +16,16 @@
package org.matrix.android.sdk.internal.session.identity.model
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = true)
internal data class SignInvitationBody(
/**The Matrix user ID of the user accepting the invitation.*/
/** The Matrix user ID of the user accepting the invitation.*/
val mxid: String,
/**The token from the call to store- invite..*/
/** The token from the call to store- invite..*/
val token: String,
/** The private key, encoded as Unpadded base64. */
val private_key: String
@Json(name = "private_key")
val privateKey: String
)

View File

@ -136,7 +136,7 @@ internal class DefaultStateService @AssistedInject constructor(@Assisted private
if (joinRules != null) {
val body = if (joinRules == RoomJoinRules.RESTRICTED) {
RoomJoinRulesContent(
_joinRules = RoomJoinRules.RESTRICTED.value,
joinRulesStr = RoomJoinRules.RESTRICTED.value,
allowList = allowList
).toContent()
} else {

View File

@ -55,7 +55,7 @@ internal data class SearchRequestRoomEvents(
* Requests the server return the current state for each room returned.
*/
@Json(name = "include_state")
val include_state: Boolean? = null
val includeState: Boolean? = null
/**
* Requests that the server partitions the result set based on the provided list of keys.

View File

@ -213,7 +213,7 @@ internal class RoomSyncHandler @Inject constructor(
val isInitialSync = insertType == EventInsertType.INITIAL_SYNC
val ephemeralResult = (roomSync.ephemeral as? LazyRoomSyncEphemeral.Parsed)
?._roomSyncEphemeral
?.roomSyncEphemeral
?.events
?.takeIf { it.isNotEmpty() }
?.let { handleEphemeral(realm, roomId, it, insertType == EventInsertType.INITIAL_SYNC, aggregator) }

View File

@ -64,9 +64,6 @@ naming:
VariableNaming:
# TODO Enable it
active: false
ConstructorParameterNaming:
# TODO Enable it
active: false
TopLevelPropertyNaming:
# TODO Enable it
active: false

View File

@ -27,23 +27,23 @@ data class UserProperties(
/**
* Whether the user has the favourites space enabled
*/
val WebMetaSpaceFavouritesEnabled: Boolean? = null,
val webMetaSpaceFavouritesEnabled: Boolean? = null,
/**
* Whether the user has the home space set to all rooms
*/
val WebMetaSpaceHomeAllRooms: Boolean? = null,
val webMetaSpaceHomeAllRooms: Boolean? = null,
/**
* Whether the user has the home space enabled
*/
val WebMetaSpaceHomeEnabled: Boolean? = null,
val webMetaSpaceHomeEnabled: Boolean? = null,
/**
* Whether the user has the other rooms space enabled
*/
val WebMetaSpaceOrphansEnabled: Boolean? = null,
val webMetaSpaceOrphansEnabled: Boolean? = null,
/**
* Whether the user has the people space enabled
*/
val WebMetaSpacePeopleEnabled: Boolean? = null,
val webMetaSpacePeopleEnabled: Boolean? = null,
/**
* The selected messaging use case during the onboarding flow.
*/
@ -82,11 +82,11 @@ data class UserProperties(
fun getProperties(): Map<String, Any>? {
return mutableMapOf<String, Any>().apply {
WebMetaSpaceFavouritesEnabled?.let { put("WebMetaSpaceFavouritesEnabled", it) }
WebMetaSpaceHomeAllRooms?.let { put("WebMetaSpaceHomeAllRooms", it) }
WebMetaSpaceHomeEnabled?.let { put("WebMetaSpaceHomeEnabled", it) }
WebMetaSpaceOrphansEnabled?.let { put("WebMetaSpaceOrphansEnabled", it) }
WebMetaSpacePeopleEnabled?.let { put("WebMetaSpacePeopleEnabled", it) }
webMetaSpaceFavouritesEnabled?.let { put("WebMetaSpaceFavouritesEnabled", it) }
webMetaSpaceHomeAllRooms?.let { put("WebMetaSpaceHomeAllRooms", it) }
webMetaSpaceHomeEnabled?.let { put("WebMetaSpaceHomeEnabled", it) }
webMetaSpaceOrphansEnabled?.let { put("WebMetaSpaceOrphansEnabled", it) }
webMetaSpacePeopleEnabled?.let { put("WebMetaSpacePeopleEnabled", it) }
ftueUseCaseSelection?.let { put("ftueUseCaseSelection", it.name) }
numFavouriteRooms?.let { put("numFavouriteRooms", it) }
numSpaces?.let { put("numSpaces", it) }

View File

@ -53,7 +53,7 @@ class AutoCompleter @AssistedInject constructor(
@Assisted val isInThreadTimeline: Boolean,
private val avatarRenderer: AvatarRenderer,
private val commandAutocompletePolicy: CommandAutocompletePolicy,
AutocompleteCommandPresenterFactory: AutocompleteCommandPresenter.Factory,
autocompleteCommandPresenterFactory: AutocompleteCommandPresenter.Factory,
private val autocompleteMemberPresenterFactory: AutocompleteMemberPresenter.Factory,
private val autocompleteRoomPresenter: AutocompleteRoomPresenter,
private val autocompleteGroupPresenter: AutocompleteGroupPresenter,
@ -68,7 +68,7 @@ class AutoCompleter @AssistedInject constructor(
}
private val autocompleteCommandPresenter: AutocompleteCommandPresenter by lazy {
AutocompleteCommandPresenterFactory.create(isInThreadTimeline)
autocompleteCommandPresenterFactory.create(isInThreadTimeline)
}
private var editText: EditText? = null