From 1d8421b9d2e3110caac1286e3bd761123b578ae4 Mon Sep 17 00:00:00 2001 From: Ashish Agrawal Date: Tue, 27 Sep 2022 16:20:11 -0700 Subject: [PATCH] Update ktlint and force common-codec version Signed-off-by: Ashish Agrawal --- .../alerting/model/BucketLevelTriggerRunResult.kt | 2 +- .../alerting/resthandler/RestGetAlertsAction.kt | 2 +- .../alerting/resthandler/RestGetDestinationsAction.kt | 2 +- .../alerting/resthandler/RestGetMonitorAction.kt | 2 +- .../alerting/resthandler/RestIndexDestinationAction.kt | 2 +- .../alerting/transport/TransportIndexDestinationAction.kt | 2 +- .../transport/TransportIndexEmailAccountAction.kt | 2 +- .../alerting/transport/TransportIndexEmailGroupAction.kt | 2 +- .../alerting/transport/TransportIndexMonitorAction.kt | 2 +- .../kotlin/org/opensearch/alerting/MonitorRunnerIT.kt | 8 ++++---- build.gradle | 2 +- notification/build.gradle | 7 +++++++ 12 files changed, 21 insertions(+), 14 deletions(-) diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/model/BucketLevelTriggerRunResult.kt b/alerting/src/main/kotlin/org/opensearch/alerting/model/BucketLevelTriggerRunResult.kt index 79d48e8b2..63131d835 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/model/BucketLevelTriggerRunResult.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/model/BucketLevelTriggerRunResult.kt @@ -38,7 +38,7 @@ data class BucketLevelTriggerRunResult( override fun writeTo(out: StreamOutput) { super.writeTo(out) out.writeMap(aggregationResultBuckets, StreamOutput::writeString) { - valueOut: StreamOutput, aggResultBucket: AggregationResultBucket -> + valueOut: StreamOutput, aggResultBucket: AggregationResultBucket -> aggResultBucket.writeTo(valueOut) } out.writeMap(actionResultsMap as Map) diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestGetAlertsAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestGetAlertsAction.kt index a2063494b..a189c3f52 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestGetAlertsAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestGetAlertsAction.kt @@ -68,7 +68,7 @@ class RestGetAlertsAction : BaseRestHandler() { val getAlertsRequest = GetAlertsRequest(table, severityLevel, alertState, monitorId) return RestChannelConsumer { - channel -> + channel -> client.execute(GetAlertsAction.INSTANCE, getAlertsRequest, RestToXContentListener(channel)) } } diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestGetDestinationsAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestGetDestinationsAction.kt index d0f02ce80..d6ee82f71 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestGetDestinationsAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestGetDestinationsAction.kt @@ -89,7 +89,7 @@ class RestGetDestinationsAction : BaseRestHandler() { destinationType ) return RestChannelConsumer { - channel -> + channel -> client.execute(GetDestinationsAction.INSTANCE, getDestinationsRequest, RestToXContentListener(channel)) } } diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestGetMonitorAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestGetMonitorAction.kt index 3046a8736..4d9bac033 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestGetMonitorAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestGetMonitorAction.kt @@ -68,7 +68,7 @@ class RestGetMonitorAction : BaseRestHandler() { } val getMonitorRequest = GetMonitorRequest(monitorId, RestActions.parseVersion(request), request.method(), srcContext) return RestChannelConsumer { - channel -> + channel -> client.execute(GetMonitorAction.INSTANCE, getMonitorRequest, RestToXContentListener(channel)) } } diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestIndexDestinationAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestIndexDestinationAction.kt index 6a790cb98..a3934353a 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestIndexDestinationAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestIndexDestinationAction.kt @@ -86,7 +86,7 @@ class RestIndexDestinationAction : BaseRestHandler() { } val indexDestinationRequest = IndexDestinationRequest(id, seqNo, primaryTerm, refreshPolicy, request.method(), destination) return RestChannelConsumer { - channel -> + channel -> client.execute( IndexDestinationAction.INSTANCE, indexDestinationRequest, indexDestinationResponse(channel, request.method()) diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexDestinationAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexDestinationAction.kt index 5ad5acd7d..dd5c2998b 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexDestinationAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexDestinationAction.kt @@ -306,7 +306,7 @@ class TransportIndexDestinationAction @Inject constructor( var failureReasons = StringBuilder() if (response.shardInfo.failed > 0) { response.shardInfo.failures.forEach { - entry -> + entry -> failureReasons.append(entry.reason()) } return failureReasons.toString() diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexEmailAccountAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexEmailAccountAction.kt index 1c49908bc..008090902 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexEmailAccountAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexEmailAccountAction.kt @@ -301,7 +301,7 @@ class TransportIndexEmailAccountAction @Inject constructor( val failureReasons = StringBuilder() if (response.shardInfo.failed > 0) { response.shardInfo.failures.forEach { - entry -> + entry -> failureReasons.append(entry.reason()) } diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexEmailGroupAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexEmailGroupAction.kt index 00e4f17ec..21c9c31da 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexEmailGroupAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexEmailGroupAction.kt @@ -233,7 +233,7 @@ class TransportIndexEmailGroupAction @Inject constructor( val failureReasons = StringBuilder() if (response.shardInfo.failed > 0) { response.shardInfo.failures.forEach { - entry -> + entry -> failureReasons.append(entry.reason()) } diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexMonitorAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexMonitorAction.kt index 12738a94b..d58c10c07 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexMonitorAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexMonitorAction.kt @@ -478,7 +478,7 @@ class TransportIndexMonitorAction @Inject constructor( val failureReasons = StringBuilder() if (response.shardInfo.failed > 0) { response.shardInfo.failures.forEach { - entry -> + entry -> failureReasons.append(entry.reason()) } return failureReasons.toString() diff --git a/alerting/src/test/kotlin/org/opensearch/alerting/MonitorRunnerIT.kt b/alerting/src/test/kotlin/org/opensearch/alerting/MonitorRunnerIT.kt index dc505ae41..34fb65871 100644 --- a/alerting/src/test/kotlin/org/opensearch/alerting/MonitorRunnerIT.kt +++ b/alerting/src/test/kotlin/org/opensearch/alerting/MonitorRunnerIT.kt @@ -1007,7 +1007,7 @@ class MonitorRunnerIT : AlertingRestTestCase() { val output = entityAsMap(response) @Suppress("UNCHECKED_CAST") (output["trigger_results"] as HashMap).forEach { - _, v -> + _, v -> assertTrue((v as HashMap)["triggered"] as Boolean) } assertEquals(monitor.name, output["monitor_name"]) @@ -1037,7 +1037,7 @@ class MonitorRunnerIT : AlertingRestTestCase() { val output = entityAsMap(response) @Suppress("UNCHECKED_CAST") (output["trigger_results"] as HashMap).forEach { - _, v -> + _, v -> assertTrue((v as HashMap)["triggered"] as Boolean) } assertEquals(monitor.name, output["monitor_name"]) @@ -1064,7 +1064,7 @@ class MonitorRunnerIT : AlertingRestTestCase() { val output = entityAsMap(response) @Suppress("UNCHECKED_CAST") (output["trigger_results"] as HashMap).forEach { - _, v -> + _, v -> assertTrue((v as HashMap)["triggered"] as Boolean) } @Suppress("UNCHECKED_CAST") @@ -1093,7 +1093,7 @@ class MonitorRunnerIT : AlertingRestTestCase() { val output = entityAsMap(response) @Suppress("UNCHECKED_CAST") (output["trigger_results"] as HashMap).forEach { - _, v -> + _, v -> assertFalse((v as HashMap)["triggered"] as Boolean) } @Suppress("UNCHECKED_CAST") diff --git a/build.gradle b/build.gradle index d7cddaca4..6d5800642 100644 --- a/build.gradle +++ b/build.gradle @@ -40,7 +40,7 @@ configurations { } dependencies { - add("ktlint", "com.pinterest:ktlint:0.41.0") { + add("ktlint", "com.pinterest:ktlint:0.45.1") { attributes { attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling, Bundling.EXTERNAL)) } diff --git a/notification/build.gradle b/notification/build.gradle index 7e3913830..02d63e84b 100644 --- a/notification/build.gradle +++ b/notification/build.gradle @@ -9,6 +9,13 @@ apply plugin: 'jacoco' apply plugin: 'maven-publish' apply plugin: 'signing' +configurations.all { + if (it.state != Configuration.State.UNRESOLVED) return + resolutionStrategy { + force "commons-codec:commons-codec:1.13" + } +} + dependencies { compileOnly "org.opensearch:opensearch:${opensearch_version}" compile "org.apache.httpcomponents:httpcore:4.4.5"