From 8c79fd93a02c120e04e8366b447c7ade428b8eff Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 8 Feb 2024 23:56:21 +0000 Subject: [PATCH] [Security] Bumping ktlint to 0.47.1 (#960) Signed-off-by: Sean Li (cherry picked from commit 95de90805902bfc6790ba5b7b0fe23cafb5c5c04) Signed-off-by: github-actions[bot] --- build.gradle | 5 ++++- .../resthandler/OnDemandReportRestHandler.kt | 3 ++- .../reportsscheduler/settings/PluginSettings.kt | 13 +++++++++---- .../org/opensearch/integTest/PluginRestTestCase.kt | 3 ++- .../opensearch/integTest/rest/ReportInstanceIT.kt | 12 ++++++++---- .../model/GetAllReportInstancesResponseTests.kt | 1 - 6 files changed, 25 insertions(+), 12 deletions(-) diff --git a/build.gradle b/build.gradle index 7ee2a3a6..884dbe1e 100644 --- a/build.gradle +++ b/build.gradle @@ -137,6 +137,9 @@ configurations.all { force "org.jetbrains.kotlin:kotlin-stdlib-common:${kotlin_version}" force "com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:2.11.4" force "org.yaml:snakeyaml:2.0" + force "org.slf4j:slf4j-api:2.0.7" + force "ch.qos.logback:logback-classic:1.3.14" + force "ch.qos.logback:logback-core:1.3.14" } } @@ -199,7 +202,7 @@ dependencies { testImplementation "org.mockito:mockito-junit-jupiter:4.7.0" testImplementation 'com.google.code.gson:gson:2.8.9' - ktlint "com.pinterest:ktlint:0.45.1" + ktlint "com.pinterest:ktlint:0.47.1" } javadoc.enabled = false // turn off javadoc as it barfs on Kotlin code diff --git a/src/main/kotlin/org/opensearch/reportsscheduler/resthandler/OnDemandReportRestHandler.kt b/src/main/kotlin/org/opensearch/reportsscheduler/resthandler/OnDemandReportRestHandler.kt index 483ff762..3c803d32 100644 --- a/src/main/kotlin/org/opensearch/reportsscheduler/resthandler/OnDemandReportRestHandler.kt +++ b/src/main/kotlin/org/opensearch/reportsscheduler/resthandler/OnDemandReportRestHandler.kt @@ -109,7 +109,8 @@ internal class OnDemandReportRestHandler : PluginBaseHandler() { client.execute( OnDemandReportCreateAction.ACTION_TYPE, OnDemandReportCreateRequest.parse( - request.contentParserNextToken(), request.param(REPORT_DEFINITION_ID_FIELD) + request.contentParserNextToken(), + request.param(REPORT_DEFINITION_ID_FIELD) ), RestResponseToXContentListener(it) ) diff --git a/src/main/kotlin/org/opensearch/reportsscheduler/settings/PluginSettings.kt b/src/main/kotlin/org/opensearch/reportsscheduler/settings/PluginSettings.kt index bb54852c..24ba1a62 100644 --- a/src/main/kotlin/org/opensearch/reportsscheduler/settings/PluginSettings.kt +++ b/src/main/kotlin/org/opensearch/reportsscheduler/settings/PluginSettings.kt @@ -117,26 +117,31 @@ internal object PluginSettings { OPERATION_TIMEOUT_MS_KEY, defaultSettings[OPERATION_TIMEOUT_MS_KEY]!!.toLong(), MINIMUM_OPERATION_TIMEOUT_MS, - NodeScope, Dynamic + NodeScope, + Dynamic ) private val DEFAULT_ITEMS_QUERY_COUNT: Setting = Setting.intSetting( DEFAULT_ITEMS_QUERY_COUNT_KEY, defaultSettings[DEFAULT_ITEMS_QUERY_COUNT_KEY]!!.toInt(), MINIMUM_ITEMS_QUERY_COUNT, - NodeScope, Dynamic + NodeScope, + Dynamic ) private val LEGACY_FILTER_BY_BACKEND_ROLES: Setting = Setting.boolSetting( LEGACY_FILTER_BY_BACKEND_ROLES_KEY, false, - NodeScope, Dynamic, Setting.Property.Deprecated + NodeScope, + Dynamic, + Setting.Property.Deprecated ) private val FILTER_BY_BACKEND_ROLES: Setting = Setting.boolSetting( FILTER_BY_BACKEND_ROLES_KEY, LEGACY_FILTER_BY_BACKEND_ROLES, - NodeScope, Dynamic + NodeScope, + Dynamic ) /** diff --git a/src/test/kotlin/org/opensearch/integTest/PluginRestTestCase.kt b/src/test/kotlin/org/opensearch/integTest/PluginRestTestCase.kt index c48612c8..43c052d7 100644 --- a/src/test/kotlin/org/opensearch/integTest/PluginRestTestCase.kt +++ b/src/test/kotlin/org/opensearch/integTest/PluginRestTestCase.kt @@ -63,7 +63,8 @@ abstract class PluginRestTestCase : OpenSearchRestTestCase() { val response = client().performRequest(Request("GET", "/_cat/indices?format=json&expand_wildcards=all")) val xContentType = MediaType.fromMediaType(response.entity.contentType.value) xContentType.xContent().createParser( - NamedXContentRegistry.EMPTY, DeprecationHandler.THROW_UNSUPPORTED_OPERATION, + NamedXContentRegistry.EMPTY, + DeprecationHandler.THROW_UNSUPPORTED_OPERATION, response.entity.content ).use { parser -> for (index in parser.list()) { diff --git a/src/test/kotlin/org/opensearch/integTest/rest/ReportInstanceIT.kt b/src/test/kotlin/org/opensearch/integTest/rest/ReportInstanceIT.kt index 8ec9bfa0..4f6bc4f1 100644 --- a/src/test/kotlin/org/opensearch/integTest/rest/ReportInstanceIT.kt +++ b/src/test/kotlin/org/opensearch/integTest/rest/ReportInstanceIT.kt @@ -261,10 +261,12 @@ class ReportInstanceIT : PluginRestTestCase() { Assert.assertEquals(totalHits, 2) val reportInstanceList = listReportInstancesResponse.get("reportInstanceList").asJsonArray Assert.assertEquals( - reportInstanceId, reportInstanceList[0].asJsonObject.get("id").asString + reportInstanceId, + reportInstanceList[0].asJsonObject.get("id").asString ) Assert.assertEquals( - newReportInstanceId, reportInstanceList[1].asJsonObject.get("id").asString + newReportInstanceId, + reportInstanceList[1].asJsonObject.get("id").asString ) } @@ -514,10 +516,12 @@ class ReportInstanceIT : PluginRestTestCase() { Assert.assertEquals(totalHits, 2) val reportInstanceList = listReportInstancesResponse.get("reportInstanceList").asJsonArray Assert.assertEquals( - reportInstanceId, reportInstanceList[0].asJsonObject.get("id").asString + reportInstanceId, + reportInstanceList[0].asJsonObject.get("id").asString ) Assert.assertEquals( - newReportInstanceId, reportInstanceList[1].asJsonObject.get("id").asString + newReportInstanceId, + reportInstanceList[1].asJsonObject.get("id").asString ) } } diff --git a/src/test/kotlin/org/opensearch/reportsscheduler/model/GetAllReportInstancesResponseTests.kt b/src/test/kotlin/org/opensearch/reportsscheduler/model/GetAllReportInstancesResponseTests.kt index 747b7d56..c7fae73b 100644 --- a/src/test/kotlin/org/opensearch/reportsscheduler/model/GetAllReportInstancesResponseTests.kt +++ b/src/test/kotlin/org/opensearch/reportsscheduler/model/GetAllReportInstancesResponseTests.kt @@ -16,7 +16,6 @@ import org.opensearch.reportsscheduler.getJsonString internal class GetAllReportInstancesResponseTests { private fun createReportInstanceSearchResults(): ReportInstanceSearchResults { - return ReportInstanceSearchResults( startIndex = 0, totalHits = 100,