From 5be4aafd52a44d60a286410ef613648c0ed60d5a Mon Sep 17 00:00:00 2001 From: erwan-serandour-sonarsource Date: Wed, 13 Dec 2023 11:49:38 +0100 Subject: [PATCH] Fix quality flaw: use immutable List instead of mutable List (#401) --- .../org/sonarsource/kotlin/checks/CipherModeOperationCheck.kt | 2 +- .../kotlin/checks/RedundantMethodsInDataClassesCheck.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sonar-kotlin-checks/src/main/java/org/sonarsource/kotlin/checks/CipherModeOperationCheck.kt b/sonar-kotlin-checks/src/main/java/org/sonarsource/kotlin/checks/CipherModeOperationCheck.kt index bf8f19472..95e05d899 100644 --- a/sonar-kotlin-checks/src/main/java/org/sonarsource/kotlin/checks/CipherModeOperationCheck.kt +++ b/sonar-kotlin-checks/src/main/java/org/sonarsource/kotlin/checks/CipherModeOperationCheck.kt @@ -78,7 +78,7 @@ class CipherModeOperationCheck : CallAbstractCheck() { } } -private fun generateSecondaryLocations(secondaries: MutableList, kotlinFileContext: KotlinFileContext) = +private fun generateSecondaryLocations(secondaries: List, kotlinFileContext: KotlinFileContext) = secondaries.mapIndexed { i, secondary -> if (i < secondaries.size - 1) { SecondaryLocation(kotlinFileContext.textRange(secondary), "Initialization vector is configured here.") diff --git a/sonar-kotlin-checks/src/main/java/org/sonarsource/kotlin/checks/RedundantMethodsInDataClassesCheck.kt b/sonar-kotlin-checks/src/main/java/org/sonarsource/kotlin/checks/RedundantMethodsInDataClassesCheck.kt index 3ec9eb548..7180719da 100644 --- a/sonar-kotlin-checks/src/main/java/org/sonarsource/kotlin/checks/RedundantMethodsInDataClassesCheck.kt +++ b/sonar-kotlin-checks/src/main/java/org/sonarsource/kotlin/checks/RedundantMethodsInDataClassesCheck.kt @@ -206,7 +206,7 @@ private fun findParameter( private fun checkDotExpression( expression: KtExpression?, klassParameter: KtParameter, - methodParameters: MutableList, + methodParameters: List, ): Boolean = if (expression is KtDotQualifiedExpression) { ((expression.receiverExpression as KtNameReferenceExpression).getReferencedName() == methodParameters[0].name