diff --git a/build.gradle b/build.gradle index 59a523f48..bc7b472e8 100644 --- a/build.gradle +++ b/build.gradle @@ -79,7 +79,7 @@ buildscript { classpath "org.opensearch.gradle:build-tools:${opensearch_version}" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}" classpath "org.jetbrains.kotlin:kotlin-allopen:${kotlin_version}" - classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.23.3" + classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.23.6" classpath "org.jacoco:org.jacoco.agent:0.8.10" } } @@ -105,6 +105,10 @@ configurations.all { resolutionStrategy { force "org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}" force "org.jetbrains.kotlin:kotlin-stdlib-common:${kotlin_version}" + force "org.jetbrains.kotlin:kotlin-reflect:${kotlin_version}" + force "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlin_version}" + force "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${kotlin_version}" + force "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${kotlin_version}" force 'junit:junit:4.13.1' force 'commons-beanutils:commons-beanutils:1.9.4' force 'com.google.guava:guava:30.0-jre' @@ -222,7 +226,7 @@ dependencies { } } configurations.ktlint { - resolutionStrategy.force "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22" + resolutionStrategy.force "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.10" } // https://aws.oss.sonatype.org/content/repositories/snapshots/org/opensearch/plugin/ diff --git a/detekt.yml b/detekt.yml index 57ab2f3c5..620bd4998 100644 --- a/detekt.yml +++ b/detekt.yml @@ -15,6 +15,10 @@ style: excludes: ['**/test/**'] FunctionOnlyReturningConstant: active: false + UseRequire: + active: false + UnusedPrivateProperty: + active: false complexity: LargeClass: diff --git a/src/main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/ManagedIndexRunner.kt b/src/main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/ManagedIndexRunner.kt index 003a612ce..890e5008d 100644 --- a/src/main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/ManagedIndexRunner.kt +++ b/src/main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/ManagedIndexRunner.kt @@ -7,6 +7,7 @@ package org.opensearch.indexmanagement.indexstatemanagement import kotlinx.coroutines.CoroutineName import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.DelicateCoroutinesApi import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.SupervisorJob @@ -254,6 +255,7 @@ object ManagedIndexRunner : } } + @OptIn(DelicateCoroutinesApi::class) @Suppress("ReturnCount", "ComplexMethod", "LongMethod", "ComplexCondition", "NestedBlockDepth") private suspend fun runManagedIndexConfig(managedIndexConfig: ManagedIndexConfig, jobContext: JobExecutionContext) { logger.debug("Run job for index ${managedIndexConfig.index}") @@ -640,6 +642,7 @@ object ManagedIndexRunner : * update metadata in config index, and save metadata in history after update * this can be called 2 times in one job run, so need to save seqNo & primeTerm */ + @OptIn(DelicateCoroutinesApi::class) private suspend fun updateManagedIndexMetaData( managedIndexMetaData: ManagedIndexMetaData, lastUpdateResult: UpdateMetadataResult? = null, diff --git a/src/main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/step/forcemerge/AttemptCallForceMergeStep.kt b/src/main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/step/forcemerge/AttemptCallForceMergeStep.kt index 3ff796e55..e7596842a 100644 --- a/src/main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/step/forcemerge/AttemptCallForceMergeStep.kt +++ b/src/main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/step/forcemerge/AttemptCallForceMergeStep.kt @@ -6,6 +6,7 @@ package org.opensearch.indexmanagement.indexstatemanagement.step.forcemerge import kotlinx.coroutines.CoroutineName +import kotlinx.coroutines.DelicateCoroutinesApi import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.delay @@ -30,6 +31,7 @@ class AttemptCallForceMergeStep(private val action: ForceMergeAction) : Step(nam private var stepStatus = StepStatus.STARTING private var info: Map? = null + @OptIn(DelicateCoroutinesApi::class) @Suppress("TooGenericExceptionCaught", "ComplexMethod") override suspend fun execute(): AttemptCallForceMergeStep { val context = this.context ?: return this