style(detekt): Accept current use of TooGenericExceptionCaught cases

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2024-12-04 19:58:50 +01:00
parent 06f7597de0
commit f820277779
No known key found for this signature in database
GPG Key ID: 6CADC7E3523C308B
27 changed files with 41 additions and 5 deletions

View File

@ -745,6 +745,7 @@ class CallActivity : CallBaseActivity() {
binding!!.endCallPopupMenu.text = context.getString(R.string.leave_call)
}
@Suppress("Detekt.TooGenericExceptionCaught")
private fun createCameraEnumerator() {
var camera2EnumeratorIsSupported = false
try {

View File

@ -180,6 +180,7 @@ class IncomingDeckCardViewHolder(incomingView: View, payload: Any) : MessageHold
viewThemeUtils.talk.themeIncomingMessageBubble(bubble, message.isGrouped, message.isDeleted)
}
@Suppress("Detekt.TooGenericExceptionCaught")
private fun setParentMessageDataOnMessageItem(message: ChatMessage) {
if (message.parentMessageId != null && !message.isDeleted) {
CoroutineScope(Dispatchers.Main).launch {

View File

@ -158,6 +158,7 @@ class IncomingLinkPreviewMessageViewHolder(incomingView: View, payload: Any) :
viewThemeUtils.talk.themeIncomingMessageBubble(bubble, message.isGrouped, message.isDeleted)
}
@Suppress("Detekt.TooGenericExceptionCaught")
private fun setParentMessageDataOnMessageItem(message: ChatMessage) {
if (message.parentMessageId != null && !message.isDeleted) {
CoroutineScope(Dispatchers.Main).launch {

View File

@ -143,6 +143,7 @@ class IncomingLocationMessageViewHolder(incomingView: View, payload: Any) :
viewThemeUtils.talk.themeIncomingMessageBubble(bubble, message.isGrouped, message.isDeleted)
}
@Suppress("Detekt.TooGenericExceptionCaught")
private fun setParentMessageDataOnMessageItem(message: ChatMessage) {
if (message.parentMessageId != null && !message.isDeleted) {
CoroutineScope(Dispatchers.Main).launch {

View File

@ -165,6 +165,7 @@ class IncomingPollMessageViewHolder(incomingView: View, payload: Any) :
viewThemeUtils.talk.themeIncomingMessageBubble(bubble, message.isGrouped, message.isDeleted)
}
@Suppress("Detekt.TooGenericExceptionCaught")
private fun setParentMessageDataOnMessageItem(message: ChatMessage) {
if (message.parentMessageId != null && !message.isDeleted) {
CoroutineScope(Dispatchers.Main).launch {

View File

@ -165,6 +165,7 @@ class IncomingTextMessageViewHolder(itemView: View, payload: Any) :
viewThemeUtils.talk.themeIncomingMessageBubble(bubble, message.isGrouped, message.isDeleted)
}
@Suppress("Detekt.TooGenericExceptionCaught")
private fun processParentMessage(message: ChatMessage) {
if (message.parentMessageId != null && !message.isDeleted) {
CoroutineScope(Dispatchers.Main).launch {

View File

@ -278,6 +278,7 @@ class IncomingVoiceMessageViewHolder(incomingView: View, payload: Any) :
viewThemeUtils.talk.themeIncomingMessageBubble(bubble, message.isGrouped, message.isDeleted)
}
@Suppress("Detekt.TooGenericExceptionCaught")
private fun setParentMessageDataOnMessageItem(message: ChatMessage) {
if (message.parentMessageId != null && !message.isDeleted) {
CoroutineScope(Dispatchers.Main).launch {

View File

@ -171,6 +171,7 @@ class OutcomingDeckCardViewHolder(
commonMessageInterface.onClickReaction(chatMessage, emoji)
}
@Suppress("Detekt.TooGenericExceptionCaught")
private fun setParentMessageDataOnMessageItem(message: ChatMessage) {
if (message.parentMessageId != null && !message.isDeleted) {
CoroutineScope(Dispatchers.Main).launch {

View File

@ -146,6 +146,7 @@ class OutcomingLinkPreviewMessageViewHolder(outcomingView: View, payload: Any) :
commonMessageInterface.onClickReaction(chatMessage, emoji)
}
@Suppress("Detekt.TooGenericExceptionCaught")
private fun setParentMessageDataOnMessageItem(message: ChatMessage) {
if (message.parentMessageId != null && !message.isDeleted) {
CoroutineScope(Dispatchers.Main).launch {

View File

@ -198,6 +198,7 @@ class OutcomingLocationMessageViewHolder(incomingView: View) :
})
}
@Suppress("Detekt.TooGenericExceptionCaught")
private fun setParentMessageDataOnMessageItem(message: ChatMessage) {
if (message.parentMessageId != null && !message.isDeleted) {
CoroutineScope(Dispatchers.Main).launch {

View File

@ -158,6 +158,7 @@ class OutcomingPollMessageViewHolder(outcomingView: View, payload: Any) :
}
}
@Suppress("Detekt.TooGenericExceptionCaught")
private fun setParentMessageDataOnMessageItem(message: ChatMessage) {
if (message.parentMessageId != null && !message.isDeleted) {
CoroutineScope(Dispatchers.Main).launch {

View File

@ -157,6 +157,7 @@ class OutcomingTextMessageViewHolder(itemView: View) :
commonMessageInterface.onClickReaction(chatMessage, emoji)
}
@Suppress("Detekt.TooGenericExceptionCaught")
private fun processParentMessage(message: ChatMessage) {
if (message.parentMessageId != null && !message.isDeleted) {
CoroutineScope(Dispatchers.Main).launch {

View File

@ -283,6 +283,7 @@ class OutcomingVoiceMessageViewHolder(outcomingView: View) :
binding.progressBar.visibility = View.VISIBLE
}
@Suppress("Detekt.TooGenericExceptionCaught")
private fun setParentMessageDataOnMessageItem(message: ChatMessage) {
if (message.parentMessageId != null && !message.isDeleted) {
CoroutineScope(Dispatchers.Main).launch {

View File

@ -112,6 +112,7 @@ class TemporaryMessageViewHolder(outgoingView: View, payload: Any) :
ViewCompat.setBackground(bubble, bubbleDrawable)
}
@Suppress("Detekt.TooGenericExceptionCaught")
private fun processParentMessage(message: ChatMessage) {
if (message.parentMessageId != null && !message.isDeleted) {
CoroutineScope(Dispatchers.Main).launch {

View File

@ -399,7 +399,7 @@ class OfflineFirstChatRepository @Inject constructor(
.map(ChatMessageEntity::asModel)
}
@Suppress("UNCHECKED_CAST", "MagicNumber")
@Suppress("UNCHECKED_CAST", "MagicNumber", "Detekt.TooGenericExceptionCaught")
private fun getMessagesFromServer(bundle: Bundle): Pair<Int, List<ChatMessageJson>>? {
val fieldMap = bundle.getSerializable(BundleKeys.KEY_FIELD_MAP) as HashMap<String, Int>

View File

@ -69,6 +69,7 @@ class ContactsViewModel @Inject constructor(
_isAddParticipantsView.value = value
}
@Suppress("Detekt.TooGenericExceptionCaught")
fun getContactsFromSearchParams() {
_contactsViewState.value = ContactsUiState.Loading
viewModelScope.launch {
@ -84,6 +85,8 @@ class ContactsViewModel @Inject constructor(
}
}
}
@Suppress("Detekt.TooGenericExceptionCaught")
fun createRoom(roomType: String, sourceType: String, userId: String, conversationName: String?) {
viewModelScope.launch {
try {

View File

@ -75,6 +75,7 @@ class ConversationCreationViewModel @Inject constructor(
_conversationDescription.value = conversationDescription
}
@Suppress("Detekt.TooGenericExceptionCaught")
fun createRoomAndAddParticipants(
roomType: String,
conversationName: String,
@ -142,6 +143,7 @@ class ConversationCreationViewModel @Inject constructor(
return repository.getImageUri(avatarId, requestBigSize)
}
@Suppress("Detekt.TooGenericExceptionCaught")
fun createRoom(roomType: String, conversationName: String?) {
viewModelScope.launch {
try {

View File

@ -150,6 +150,7 @@ class ConversationInfoViewModel @Inject constructor(
}
}
@Suppress("Detekt.TooGenericExceptionCaught")
fun listBans(user: User, token: String) {
val url = ApiUtils.getUrlForBans(user.baseUrl!!, token)
viewModelScope.launch {
@ -163,6 +164,7 @@ class ConversationInfoViewModel @Inject constructor(
}
}
@Suppress("Detekt.TooGenericExceptionCaught")
fun banActor(user: User, token: String, actorType: String, actorId: String, internalNote: String) {
val url = ApiUtils.getUrlForBans(user.baseUrl!!, token)
viewModelScope.launch {
@ -182,6 +184,7 @@ class ConversationInfoViewModel @Inject constructor(
}
}
@Suppress("Detekt.TooGenericExceptionCaught")
fun setConversationReadOnly(roomToken: String, state: Int) {
viewModelScope.launch {
try {
@ -193,6 +196,7 @@ class ConversationInfoViewModel @Inject constructor(
}
}
@Suppress("Detekt.TooGenericExceptionCaught")
fun unbanActor(user: User, token: String, banId: Int) {
val url = ApiUtils.getUrlForUnban(user.baseUrl!!, token, banId)
viewModelScope.launch {
@ -206,6 +210,7 @@ class ConversationInfoViewModel @Inject constructor(
}
}
@Suppress("Detekt.TooGenericExceptionCaught")
fun allowGuests(token: String, allow: Boolean) {
viewModelScope.launch {
try {
@ -217,6 +222,7 @@ class ConversationInfoViewModel @Inject constructor(
}
}
@Suppress("Detekt.TooGenericExceptionCaught")
@SuppressLint("SuspiciousIndentation")
fun setPassword(password: String, token: String) {
viewModelScope.launch {
@ -241,6 +247,7 @@ class ConversationInfoViewModel @Inject constructor(
conversationsRepository.unarchiveConversation(user.getCredentials(), url)
}
@Suppress("Detekt.TooGenericExceptionCaught")
fun clearChatHistory(apiVersion: Int, roomToken: String) {
viewModelScope.launch {
try {

View File

@ -75,6 +75,7 @@ class ConversationInfoEditViewModel @Inject constructor(
?.subscribe(DeleteConversationAvatarObserver())
}
@Suppress("Detekt.TooGenericExceptionCaught")
fun renameRoom(roomToken: String, newRoomName: String) {
viewModelScope.launch {
try {
@ -86,6 +87,7 @@ class ConversationInfoEditViewModel @Inject constructor(
}
}
@Suppress("Detekt.TooGenericExceptionCaught")
fun setConversationDescription(roomToken: String, conversationDescription: String?) {
viewModelScope.launch {
try {

View File

@ -102,6 +102,7 @@ class OfflineFirstConversationsRepository @Inject constructor(
}
}
@Suppress("Detekt.TooGenericExceptionCaught")
private suspend fun getRoomsFromServer(): List<ConversationEntity>? {
var conversationsFromSync: List<ConversationEntity>? = null

View File

@ -13,6 +13,7 @@ import com.bluelinelabs.logansquare.LoganSquare
class ArrayListConverter {
@Suppress("Detekt.TooGenericExceptionCaught")
@TypeConverter
fun arrayListToString(list: ArrayList<String>?): String? {
return if (list == null) {

View File

@ -36,6 +36,7 @@ import java.net.URLConnection
class SaveFileToStorageWorker(val context: Context, workerParameters: WorkerParameters) :
Worker(context, workerParameters) {
@Suppress("Detekt.TooGenericExceptionCaught")
override fun doWork(): Result {
try {
val sourceFilePath = inputData.getString(KEY_SOURCE_FILE_PATH)

View File

@ -1130,6 +1130,7 @@ class SettingsActivity :
}
}
@Suppress("Detekt.TooGenericExceptionCaught")
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
@ -1349,6 +1350,7 @@ class SettingsActivity :
})
}
@Suppress("Detekt.TooGenericExceptionCaught")
private fun observeReadPrivacy() {
lifecycleScope.launch {
var state = appPreferences.readPrivacy
@ -1384,6 +1386,7 @@ class SettingsActivity :
}
}
@Suppress("Detekt.TooGenericExceptionCaught")
private fun observeTypingStatus() {
lifecycleScope.launch {
var state = appPreferences.typingStatus

View File

@ -202,6 +202,7 @@ class ConversationsListBottomDialog(
}
}
@Suppress("Detekt.TooGenericExceptionCaught")
@SuppressLint("StringFormatInvalid", "TooGenericExceptionCaught")
private fun addConversationToFavorites() {
val apiVersion = ApiUtils.getConversationApiVersion(currentUser, intArrayOf(ApiUtils.API_V4, ApiUtils.API_V1))
@ -228,6 +229,7 @@ class ConversationsListBottomDialog(
}
}
@Suppress("Detekt.TooGenericExceptionCaught")
@SuppressLint("StringFormatInvalid", "TooGenericExceptionCaught")
private fun removeConversationFromFavorites() {
val apiVersion = ApiUtils.getConversationApiVersion(currentUser, intArrayOf(ApiUtils.API_V4, ApiUtils.API_V1))

View File

@ -522,6 +522,7 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
}
}
@Suppress("Detekt.TooGenericExceptionCaught")
override fun getMessageQueue(internalConversationId: String): MutableList<MessageInputViewModel.QueuedMessage> {
val queueStr =
runBlocking { async { readString(internalConversationId + MESSAGE_QUEUE).first() } }.getCompleted()

View File

@ -8,7 +8,6 @@
*/
package com.nextcloud.talk.utils.preferences.preferencestorage
import android.annotation.SuppressLint
import android.text.TextUtils
import android.util.Log
import autodagger.AutoInjector
@ -64,7 +63,7 @@ class DatabaseStorageModule(conversationUser: User, conversationToken: String) {
this.conversationToken = conversationToken
}
@SuppressLint("TooGenericExceptionCaught")
@Suppress("Detekt.TooGenericExceptionCaught")
suspend fun saveBoolean(key: String, value: Boolean) {
if ("call_notifications_switch" == key) {
val apiVersion = getConversationApiVersion(conversationUser, intArrayOf(ApiUtils.API_V4))
@ -92,7 +91,7 @@ class DatabaseStorageModule(conversationUser: User, conversationToken: String) {
}
}
@SuppressLint("TooGenericExceptionCaught")
@Suppress("Detekt.TooGenericExceptionCaught")
suspend fun saveString(key: String, value: String) {
when (key) {
"conversation_settings_dropdown" -> {

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: 167
maxIssues: 125
weights:
# complexity: 2
# LongParameterList: 1