Skip to content

Commit 95de908

Browse files
authored
[Security] Bumping ktlint to 0.47.1 (opensearch-project#960)
Signed-off-by: Sean Li <[email protected]>
1 parent 36f06b9 commit 95de908

File tree

6 files changed

+25
-12
lines changed

6 files changed

+25
-12
lines changed

build.gradle

+4-1
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ configurations.all {
136136
force "org.jetbrains.kotlin:kotlin-stdlib-common:${kotlin_version}"
137137
force "com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:2.11.4"
138138
force "org.yaml:snakeyaml:2.0"
139+
force "org.slf4j:slf4j-api:2.0.7"
140+
force "ch.qos.logback:logback-classic:1.3.14"
141+
force "ch.qos.logback:logback-core:1.3.14"
139142
}
140143
}
141144

@@ -198,7 +201,7 @@ dependencies {
198201
testImplementation "org.mockito:mockito-junit-jupiter:${versions.mockito}"
199202
testImplementation 'com.google.code.gson:gson:2.8.9'
200203

201-
ktlint "com.pinterest:ktlint:0.45.1"
204+
ktlint "com.pinterest:ktlint:0.47.1"
202205
}
203206

204207
javadoc.enabled = false // turn off javadoc as it barfs on Kotlin code

src/main/kotlin/org/opensearch/reportsscheduler/resthandler/OnDemandReportRestHandler.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ internal class OnDemandReportRestHandler : PluginBaseHandler() {
109109
client.execute(
110110
OnDemandReportCreateAction.ACTION_TYPE,
111111
OnDemandReportCreateRequest.parse(
112-
request.contentParserNextToken(), request.param(REPORT_DEFINITION_ID_FIELD)
112+
request.contentParserNextToken(),
113+
request.param(REPORT_DEFINITION_ID_FIELD)
113114
),
114115
RestResponseToXContentListener(it)
115116
)

src/main/kotlin/org/opensearch/reportsscheduler/settings/PluginSettings.kt

+9-4
Original file line numberDiff line numberDiff line change
@@ -117,26 +117,31 @@ internal object PluginSettings {
117117
OPERATION_TIMEOUT_MS_KEY,
118118
defaultSettings[OPERATION_TIMEOUT_MS_KEY]!!.toLong(),
119119
MINIMUM_OPERATION_TIMEOUT_MS,
120-
NodeScope, Dynamic
120+
NodeScope,
121+
Dynamic
121122
)
122123

123124
private val DEFAULT_ITEMS_QUERY_COUNT: Setting<Int> = Setting.intSetting(
124125
DEFAULT_ITEMS_QUERY_COUNT_KEY,
125126
defaultSettings[DEFAULT_ITEMS_QUERY_COUNT_KEY]!!.toInt(),
126127
MINIMUM_ITEMS_QUERY_COUNT,
127-
NodeScope, Dynamic
128+
NodeScope,
129+
Dynamic
128130
)
129131

130132
private val LEGACY_FILTER_BY_BACKEND_ROLES: Setting<Boolean> = Setting.boolSetting(
131133
LEGACY_FILTER_BY_BACKEND_ROLES_KEY,
132134
false,
133-
NodeScope, Dynamic, Setting.Property.Deprecated
135+
NodeScope,
136+
Dynamic,
137+
Setting.Property.Deprecated
134138
)
135139

136140
private val FILTER_BY_BACKEND_ROLES: Setting<Boolean> = Setting.boolSetting(
137141
FILTER_BY_BACKEND_ROLES_KEY,
138142
LEGACY_FILTER_BY_BACKEND_ROLES,
139-
NodeScope, Dynamic
143+
NodeScope,
144+
Dynamic
140145
)
141146

142147
/**

src/test/kotlin/org/opensearch/integTest/PluginRestTestCase.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ abstract class PluginRestTestCase : OpenSearchRestTestCase() {
6363
val response = client().performRequest(Request("GET", "/_cat/indices?format=json&expand_wildcards=all"))
6464
val xContentType = MediaType.fromMediaType(response.entity.contentType)
6565
xContentType.xContent().createParser(
66-
NamedXContentRegistry.EMPTY, DeprecationHandler.THROW_UNSUPPORTED_OPERATION,
66+
NamedXContentRegistry.EMPTY,
67+
DeprecationHandler.THROW_UNSUPPORTED_OPERATION,
6768
response.entity.content
6869
).use { parser ->
6970
for (index in parser.list()) {

src/test/kotlin/org/opensearch/integTest/rest/ReportInstanceIT.kt

+8-4
Original file line numberDiff line numberDiff line change
@@ -261,10 +261,12 @@ class ReportInstanceIT : PluginRestTestCase() {
261261
Assert.assertEquals(totalHits, 2)
262262
val reportInstanceList = listReportInstancesResponse.get("reportInstanceList").asJsonArray
263263
Assert.assertEquals(
264-
reportInstanceId, reportInstanceList[0].asJsonObject.get("id").asString
264+
reportInstanceId,
265+
reportInstanceList[0].asJsonObject.get("id").asString
265266
)
266267
Assert.assertEquals(
267-
newReportInstanceId, reportInstanceList[1].asJsonObject.get("id").asString
268+
newReportInstanceId,
269+
reportInstanceList[1].asJsonObject.get("id").asString
268270
)
269271
}
270272

@@ -514,10 +516,12 @@ class ReportInstanceIT : PluginRestTestCase() {
514516
Assert.assertEquals(totalHits, 2)
515517
val reportInstanceList = listReportInstancesResponse.get("reportInstanceList").asJsonArray
516518
Assert.assertEquals(
517-
reportInstanceId, reportInstanceList[0].asJsonObject.get("id").asString
519+
reportInstanceId,
520+
reportInstanceList[0].asJsonObject.get("id").asString
518521
)
519522
Assert.assertEquals(
520-
newReportInstanceId, reportInstanceList[1].asJsonObject.get("id").asString
523+
newReportInstanceId,
524+
reportInstanceList[1].asJsonObject.get("id").asString
521525
)
522526
}
523527
}

src/test/kotlin/org/opensearch/reportsscheduler/model/GetAllReportInstancesResponseTests.kt

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import org.opensearch.reportsscheduler.getJsonString
1616
internal class GetAllReportInstancesResponseTests {
1717

1818
private fun createReportInstanceSearchResults(): ReportInstanceSearchResults {
19-
2019
return ReportInstanceSearchResults(
2120
startIndex = 0,
2221
totalHits = 100,

0 commit comments

Comments
 (0)