Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 1.3] [1.x] Update detekt and ktlint version #557

Merged
merged 1 commit into from
Dec 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions reports-scheduler/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ buildscript {
classpath "${opensearch_group}.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.12.0"
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.21.0"
classpath "org.jacoco:org.jacoco.agent:0.8.7"
}
}
Expand Down Expand Up @@ -84,6 +84,7 @@ configurations.all {
force "org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}"
force "org.jetbrains.kotlin:kotlin-stdlib-common:${kotlin_version}"
force "com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:2.13.4"
force 'org.yaml:snakeyaml:1.32'
}
}

Expand Down Expand Up @@ -144,7 +145,7 @@ dependencies {
testCompile "org.mockito:mockito-core:3.12.4"
testCompile 'com.google.code.gson:gson:2.8.9'

ktlint "com.pinterest:ktlint:0.33.0"
ktlint "com.pinterest:ktlint:0.45.1"
}

javadoc.enabled = false // turn off javadoc as it barfs on Kotlin code
Expand Down
5 changes: 5 additions & 0 deletions reports-scheduler/detekt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@ style:
ReturnCount:
active: true
max: 10
complexity:
LongMethod:
threshold: 120
NestedBlockDepth:
threshold: 5
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,26 @@

package org.opensearch.reportsscheduler

import org.opensearch.action.ActionRequest
import org.opensearch.action.ActionResponse
import org.opensearch.client.Client
import org.opensearch.cluster.metadata.IndexNameExpressionResolver
import org.opensearch.cluster.node.DiscoveryNodes
import org.opensearch.cluster.service.ClusterService
import org.opensearch.common.io.stream.NamedWriteableRegistry
import org.opensearch.common.settings.ClusterSettings
import org.opensearch.common.settings.IndexScopedSettings
import org.opensearch.common.settings.Setting
import org.opensearch.common.settings.Settings
import org.opensearch.common.settings.SettingsFilter
import org.opensearch.common.xcontent.NamedXContentRegistry
import org.opensearch.env.Environment
import org.opensearch.env.NodeEnvironment
import org.opensearch.jobscheduler.spi.JobSchedulerExtension
import org.opensearch.jobscheduler.spi.ScheduledJobParser
import org.opensearch.jobscheduler.spi.ScheduledJobRunner
import org.opensearch.plugins.ActionPlugin
import org.opensearch.plugins.Plugin
import org.opensearch.reportsscheduler.action.CreateReportDefinitionAction
import org.opensearch.reportsscheduler.action.DeleteReportDefinitionAction
import org.opensearch.reportsscheduler.action.GetAllReportDefinitionsAction
Expand All @@ -30,24 +47,6 @@ import org.opensearch.reportsscheduler.resthandler.ReportStatsRestHandler
import org.opensearch.reportsscheduler.scheduler.ReportDefinitionJobParser
import org.opensearch.reportsscheduler.scheduler.ReportDefinitionJobRunner
import org.opensearch.reportsscheduler.settings.PluginSettings

import org.opensearch.action.ActionRequest
import org.opensearch.action.ActionResponse
import org.opensearch.client.Client
import org.opensearch.cluster.metadata.IndexNameExpressionResolver
import org.opensearch.cluster.node.DiscoveryNodes
import org.opensearch.cluster.service.ClusterService
import org.opensearch.common.io.stream.NamedWriteableRegistry
import org.opensearch.common.settings.ClusterSettings
import org.opensearch.common.settings.IndexScopedSettings
import org.opensearch.common.settings.Setting
import org.opensearch.common.settings.Settings
import org.opensearch.common.settings.SettingsFilter
import org.opensearch.common.xcontent.NamedXContentRegistry
import org.opensearch.env.Environment
import org.opensearch.env.NodeEnvironment
import org.opensearch.plugins.ActionPlugin
import org.opensearch.plugins.Plugin
import org.opensearch.repositories.RepositoriesService
import org.opensearch.rest.RestController
import org.opensearch.rest.RestHandler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

package org.opensearch.reportsscheduler.action

import org.opensearch.commons.authuser.User
import org.opensearch.reportsscheduler.model.CreateReportDefinitionRequest
import org.opensearch.reportsscheduler.model.CreateReportDefinitionResponse
import org.opensearch.action.ActionType
import org.opensearch.action.support.ActionFilters
import org.opensearch.client.Client
import org.opensearch.common.inject.Inject
import org.opensearch.common.xcontent.NamedXContentRegistry
import org.opensearch.commons.authuser.User
import org.opensearch.reportsscheduler.model.CreateReportDefinitionRequest
import org.opensearch.reportsscheduler.model.CreateReportDefinitionResponse
import org.opensearch.transport.TransportService

/**
Expand All @@ -23,11 +23,13 @@ internal class CreateReportDefinitionAction @Inject constructor(
client: Client,
actionFilters: ActionFilters,
val xContentRegistry: NamedXContentRegistry
) : PluginBaseAction<CreateReportDefinitionRequest, CreateReportDefinitionResponse>(NAME,
) : PluginBaseAction<CreateReportDefinitionRequest, CreateReportDefinitionResponse>(
NAME,
transportService,
client,
actionFilters,
::CreateReportDefinitionRequest) {
::CreateReportDefinitionRequest
) {
companion object {
private const val NAME = "cluster:admin/opendistro/reports/definition/create"
internal val ACTION_TYPE = ActionType(NAME, ::CreateReportDefinitionResponse)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

package org.opensearch.reportsscheduler.action

import org.opensearch.commons.authuser.User
import org.opensearch.reportsscheduler.model.DeleteReportDefinitionRequest
import org.opensearch.reportsscheduler.model.DeleteReportDefinitionResponse
import org.opensearch.action.ActionType
import org.opensearch.action.support.ActionFilters
import org.opensearch.client.Client
import org.opensearch.common.inject.Inject
import org.opensearch.common.xcontent.NamedXContentRegistry
import org.opensearch.commons.authuser.User
import org.opensearch.reportsscheduler.model.DeleteReportDefinitionRequest
import org.opensearch.reportsscheduler.model.DeleteReportDefinitionResponse
import org.opensearch.transport.TransportService

/**
Expand All @@ -23,11 +23,13 @@ internal class DeleteReportDefinitionAction @Inject constructor(
client: Client,
actionFilters: ActionFilters,
val xContentRegistry: NamedXContentRegistry
) : PluginBaseAction<DeleteReportDefinitionRequest, DeleteReportDefinitionResponse>(NAME,
) : PluginBaseAction<DeleteReportDefinitionRequest, DeleteReportDefinitionResponse>(
NAME,
transportService,
client,
actionFilters,
::DeleteReportDefinitionRequest) {
::DeleteReportDefinitionRequest
) {
companion object {
private const val NAME = "cluster:admin/opendistro/reports/definition/delete"
internal val ACTION_TYPE = ActionType(NAME, ::DeleteReportDefinitionResponse)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

package org.opensearch.reportsscheduler.action

import org.opensearch.commons.authuser.User
import org.opensearch.reportsscheduler.model.GetAllReportDefinitionsRequest
import org.opensearch.reportsscheduler.model.GetAllReportDefinitionsResponse
import org.opensearch.action.ActionType
import org.opensearch.action.support.ActionFilters
import org.opensearch.client.Client
import org.opensearch.common.inject.Inject
import org.opensearch.common.xcontent.NamedXContentRegistry
import org.opensearch.commons.authuser.User
import org.opensearch.reportsscheduler.model.GetAllReportDefinitionsRequest
import org.opensearch.reportsscheduler.model.GetAllReportDefinitionsResponse
import org.opensearch.transport.TransportService

/**
Expand All @@ -23,11 +23,13 @@ internal class GetAllReportDefinitionsAction @Inject constructor(
client: Client,
actionFilters: ActionFilters,
val xContentRegistry: NamedXContentRegistry
) : PluginBaseAction<GetAllReportDefinitionsRequest, GetAllReportDefinitionsResponse>(NAME,
) : PluginBaseAction<GetAllReportDefinitionsRequest, GetAllReportDefinitionsResponse>(
NAME,
transportService,
client,
actionFilters,
::GetAllReportDefinitionsRequest) {
::GetAllReportDefinitionsRequest
) {
companion object {
private const val NAME = "cluster:admin/opendistro/reports/definition/list"
internal val ACTION_TYPE = ActionType(NAME, ::GetAllReportDefinitionsResponse)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

package org.opensearch.reportsscheduler.action

import org.opensearch.commons.authuser.User
import org.opensearch.reportsscheduler.model.GetAllReportInstancesRequest
import org.opensearch.reportsscheduler.model.GetAllReportInstancesResponse
import org.opensearch.action.ActionType
import org.opensearch.action.support.ActionFilters
import org.opensearch.client.Client
import org.opensearch.common.inject.Inject
import org.opensearch.common.xcontent.NamedXContentRegistry
import org.opensearch.commons.authuser.User
import org.opensearch.reportsscheduler.model.GetAllReportInstancesRequest
import org.opensearch.reportsscheduler.model.GetAllReportInstancesResponse
import org.opensearch.transport.TransportService

/**
Expand All @@ -23,11 +23,13 @@ internal class GetAllReportInstancesAction @Inject constructor(
client: Client,
actionFilters: ActionFilters,
val xContentRegistry: NamedXContentRegistry
) : PluginBaseAction<GetAllReportInstancesRequest, GetAllReportInstancesResponse>(NAME,
) : PluginBaseAction<GetAllReportInstancesRequest, GetAllReportInstancesResponse>(
NAME,
transportService,
client,
actionFilters,
::GetAllReportInstancesRequest) {
::GetAllReportInstancesRequest
) {
companion object {
private const val NAME = "cluster:admin/opendistro/reports/instance/list"
internal val ACTION_TYPE = ActionType(NAME, ::GetAllReportInstancesResponse)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

package org.opensearch.reportsscheduler.action

import org.opensearch.commons.authuser.User
import org.opensearch.reportsscheduler.model.GetReportDefinitionRequest
import org.opensearch.reportsscheduler.model.GetReportDefinitionResponse
import org.opensearch.action.ActionType
import org.opensearch.action.support.ActionFilters
import org.opensearch.client.Client
import org.opensearch.common.inject.Inject
import org.opensearch.common.xcontent.NamedXContentRegistry
import org.opensearch.commons.authuser.User
import org.opensearch.reportsscheduler.model.GetReportDefinitionRequest
import org.opensearch.reportsscheduler.model.GetReportDefinitionResponse
import org.opensearch.transport.TransportService

/**
Expand All @@ -23,11 +23,13 @@ internal class GetReportDefinitionAction @Inject constructor(
client: Client,
actionFilters: ActionFilters,
val xContentRegistry: NamedXContentRegistry
) : PluginBaseAction<GetReportDefinitionRequest, GetReportDefinitionResponse>(NAME,
) : PluginBaseAction<GetReportDefinitionRequest, GetReportDefinitionResponse>(
NAME,
transportService,
client,
actionFilters,
::GetReportDefinitionRequest) {
::GetReportDefinitionRequest
) {
companion object {
private const val NAME = "cluster:admin/opendistro/reports/definition/get"
internal val ACTION_TYPE = ActionType(NAME, ::GetReportDefinitionResponse)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

package org.opensearch.reportsscheduler.action

import org.opensearch.commons.authuser.User
import org.opensearch.reportsscheduler.model.GetReportInstanceRequest
import org.opensearch.reportsscheduler.model.GetReportInstanceResponse
import org.opensearch.action.ActionType
import org.opensearch.action.support.ActionFilters
import org.opensearch.client.Client
import org.opensearch.common.inject.Inject
import org.opensearch.common.xcontent.NamedXContentRegistry
import org.opensearch.commons.authuser.User
import org.opensearch.reportsscheduler.model.GetReportInstanceRequest
import org.opensearch.reportsscheduler.model.GetReportInstanceResponse
import org.opensearch.transport.TransportService

/**
Expand All @@ -23,11 +23,13 @@ internal class GetReportInstanceAction @Inject constructor(
client: Client,
actionFilters: ActionFilters,
val xContentRegistry: NamedXContentRegistry
) : PluginBaseAction<GetReportInstanceRequest, GetReportInstanceResponse>(NAME,
) : PluginBaseAction<GetReportInstanceRequest, GetReportInstanceResponse>(
NAME,
transportService,
client,
actionFilters,
::GetReportInstanceRequest) {
::GetReportInstanceRequest
) {
companion object {
private const val NAME = "cluster:admin/opendistro/reports/instance/get"
internal val ACTION_TYPE = ActionType(NAME, ::GetReportInstanceResponse)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

package org.opensearch.reportsscheduler.action

import org.opensearch.commons.authuser.User
import org.opensearch.reportsscheduler.model.InContextReportCreateRequest
import org.opensearch.reportsscheduler.model.InContextReportCreateResponse
import org.opensearch.action.ActionType
import org.opensearch.action.support.ActionFilters
import org.opensearch.client.Client
import org.opensearch.common.inject.Inject
import org.opensearch.common.xcontent.NamedXContentRegistry
import org.opensearch.commons.authuser.User
import org.opensearch.reportsscheduler.model.InContextReportCreateRequest
import org.opensearch.reportsscheduler.model.InContextReportCreateResponse
import org.opensearch.transport.TransportService

/**
Expand All @@ -23,11 +23,13 @@ internal class InContextReportCreateAction @Inject constructor(
client: Client,
actionFilters: ActionFilters,
val xContentRegistry: NamedXContentRegistry
) : PluginBaseAction<InContextReportCreateRequest, InContextReportCreateResponse>(NAME,
) : PluginBaseAction<InContextReportCreateRequest, InContextReportCreateResponse>(
NAME,
transportService,
client,
actionFilters,
::InContextReportCreateRequest) {
::InContextReportCreateRequest
) {
companion object {
private const val NAME = "cluster:admin/opendistro/reports/menu/download"
internal val ACTION_TYPE = ActionType(NAME, ::InContextReportCreateResponse)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

package org.opensearch.reportsscheduler.action

import org.opensearch.commons.authuser.User
import org.opensearch.reportsscheduler.model.OnDemandReportCreateRequest
import org.opensearch.reportsscheduler.model.OnDemandReportCreateResponse
import org.opensearch.action.ActionType
import org.opensearch.action.support.ActionFilters
import org.opensearch.client.Client
import org.opensearch.common.inject.Inject
import org.opensearch.common.xcontent.NamedXContentRegistry
import org.opensearch.commons.authuser.User
import org.opensearch.reportsscheduler.model.OnDemandReportCreateRequest
import org.opensearch.reportsscheduler.model.OnDemandReportCreateResponse
import org.opensearch.transport.TransportService

/**
Expand All @@ -23,11 +23,13 @@ internal class OnDemandReportCreateAction @Inject constructor(
client: Client,
actionFilters: ActionFilters,
val xContentRegistry: NamedXContentRegistry
) : PluginBaseAction<OnDemandReportCreateRequest, OnDemandReportCreateResponse>(NAME,
) : PluginBaseAction<OnDemandReportCreateRequest, OnDemandReportCreateResponse>(
NAME,
transportService,
client,
actionFilters,
::OnDemandReportCreateRequest) {
::OnDemandReportCreateRequest
) {
companion object {
private const val NAME = "cluster:admin/opendistro/reports/definition/on_demand"
internal val ACTION_TYPE = ActionType(NAME, ::OnDemandReportCreateResponse)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@

package org.opensearch.reportsscheduler.action

import org.opensearch.commons.ConfigConstants.OPENSEARCH_SECURITY_USER_INFO_THREAD_CONTEXT
import org.opensearch.commons.authuser.User
import org.opensearch.reportsscheduler.ReportsSchedulerPlugin.Companion.LOG_PREFIX
import org.opensearch.reportsscheduler.metrics.Metrics
import org.opensearch.reportsscheduler.util.logger
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
Expand All @@ -23,9 +18,14 @@ import org.opensearch.action.support.HandledTransportAction
import org.opensearch.client.Client
import org.opensearch.common.io.stream.Writeable
import org.opensearch.common.util.concurrent.ThreadContext
import org.opensearch.commons.ConfigConstants.OPENSEARCH_SECURITY_USER_INFO_THREAD_CONTEXT
import org.opensearch.commons.authuser.User
import org.opensearch.index.IndexNotFoundException
import org.opensearch.index.engine.VersionConflictEngineException
import org.opensearch.indices.InvalidIndexNameException
import org.opensearch.reportsscheduler.ReportsSchedulerPlugin.Companion.LOG_PREFIX
import org.opensearch.reportsscheduler.metrics.Metrics
import org.opensearch.reportsscheduler.util.logger
import org.opensearch.rest.RestStatus
import org.opensearch.tasks.Task
import org.opensearch.transport.TransportService
Expand Down
Loading