Skip to content

Commit

Permalink
Disable wildcard imports (#344)
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsvanvelzen authored Dec 23, 2021
1 parent 482ee30 commit 012f76f
Show file tree
Hide file tree
Showing 23 changed files with 212 additions and 46 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ trim_trailing_whitespace = true
charset = utf-8
indent_style = tab
tab_width = 4
# Disable wildcard imports in IntelliJ/Android Studio
ij_kotlin_name_count_to_use_star_import = 1000
ij_kotlin_name_count_to_use_star_import_for_members = 1000
ij_kotlin_packages_to_use_import_on_demand =

[*.xml]
charset = utf-8
Expand Down
6 changes: 5 additions & 1 deletion buildSrc/src/main/kotlin/Publishing.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import org.gradle.api.Project
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin
import org.gradle.kotlin.dsl.*
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.getByType
import org.gradle.kotlin.dsl.provideDelegate
import org.gradle.kotlin.dsl.withType
import org.gradle.plugins.signing.SigningExtension
import org.gradle.plugins.signing.SigningPlugin

Expand Down
2 changes: 0 additions & 2 deletions detekt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ complexity:
ignoreDeprecated: true

style:
WildcardImport:
active: false
LoopWithTooManyJumpStatements:
maxJumpCount: 6
ReturnCount:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.jellyfin.sdk.api.client

import io.ktor.utils.io.*
import io.ktor.utils.io.ByteReadChannel
import org.jellyfin.sdk.api.client.util.ApiSerializer

public class RawResponse(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
package org.jellyfin.sdk.api.client.util

import io.ktor.utils.io.*
import kotlinx.serialization.*
import io.ktor.utils.io.ByteReadChannel
import io.ktor.utils.io.readRemaining
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.InternalSerializationApi
import kotlinx.serialization.KSerializer
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json
import kotlinx.serialization.serializer

@OptIn(ExperimentalSerializationApi::class, InternalSerializationApi::class)
public object ApiSerializer {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package org.jellyfin.sdk.api.client.util

import io.ktor.http.*
import io.ktor.util.*
import io.ktor.http.URLBuilder
import io.ktor.http.encodeURLParameter
import io.ktor.http.takeFrom
import io.ktor.util.InternalAPI
import org.jellyfin.sdk.api.client.exception.MissingPathVariableException

public object UrlBuilder {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.jellyfin.sdk.api.client.util

import io.ktor.utils.io.*
import io.ktor.utils.io.charsets.*
import io.ktor.utils.io.ByteReadChannel
import io.ktor.utils.io.charsets.Charsets
import kotlinx.coroutines.test.runTest
import kotlin.test.Test
import kotlin.test.assertEquals
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
package org.jellyfin.sdk.api.client

import io.ktor.client.*
import io.ktor.client.call.*
import io.ktor.client.features.*
import io.ktor.client.request.*
import io.ktor.client.statement.*
import io.ktor.content.*
import io.ktor.http.*
import io.ktor.network.sockets.*
import io.ktor.util.*
import io.ktor.client.HttpClient
import io.ktor.client.call.NoTransformationFoundException
import io.ktor.client.features.HttpRequestTimeoutException
import io.ktor.client.features.HttpTimeout
import io.ktor.client.request.header
import io.ktor.client.request.request
import io.ktor.client.statement.HttpResponse
import io.ktor.content.TextContent
import io.ktor.http.ContentType
import io.ktor.http.HttpHeaders
import io.ktor.http.isSuccess
import io.ktor.network.sockets.ConnectTimeoutException
import io.ktor.network.sockets.SocketTimeoutException
import io.ktor.util.toMap
import kotlinx.serialization.SerializationException
import mu.KotlinLogging
import org.jellyfin.sdk.api.client.exception.ApiClientException
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,114 @@
package org.jellyfin.sdk.api.sockets

import io.ktor.client.*
import io.ktor.client.features.*
import io.ktor.client.features.websocket.*
import io.ktor.http.*
import io.ktor.http.cio.websocket.*
import io.ktor.util.*
import kotlinx.coroutines.*
import io.ktor.client.HttpClient
import io.ktor.client.features.HttpTimeout
import io.ktor.client.features.websocket.WebSockets
import io.ktor.client.features.websocket.ws
import io.ktor.http.URLProtocol
import io.ktor.http.cio.websocket.Frame
import io.ktor.http.cio.websocket.readText
import io.ktor.http.takeFrom
import io.ktor.util.error
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.Job
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.channels.Channel.Factory.BUFFERED
import kotlinx.coroutines.channels.ReceiveChannel
import kotlinx.coroutines.channels.SendChannel
import kotlinx.coroutines.channels.awaitClose
import kotlinx.coroutines.flow.*
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.callbackFlow
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.consumeAsFlow
import kotlinx.coroutines.flow.onCompletion
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.receiveAsFlow
import kotlinx.coroutines.joinAll
import kotlinx.coroutines.launch
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.KSerializer
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.*
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.buildJsonObject
import kotlinx.serialization.json.decodeFromJsonElement
import kotlinx.serialization.json.jsonObject
import kotlinx.serialization.json.jsonPrimitive
import kotlinx.serialization.json.put
import kotlinx.serialization.json.putJsonObject
import kotlinx.serialization.serializer
import mu.KotlinLogging
import org.jellyfin.sdk.api.client.ApiClient
import org.jellyfin.sdk.api.client.util.ApiSerializer
import org.jellyfin.sdk.api.operations.Api
import org.jellyfin.sdk.model.api.SessionMessageType
import org.jellyfin.sdk.model.api.SessionMessageType.*
import org.jellyfin.sdk.model.socket.*
import org.jellyfin.sdk.model.api.SessionMessageType.ACTIVITY_LOG_ENTRY
import org.jellyfin.sdk.model.api.SessionMessageType.ACTIVITY_LOG_ENTRY_START
import org.jellyfin.sdk.model.api.SessionMessageType.ACTIVITY_LOG_ENTRY_STOP
import org.jellyfin.sdk.model.api.SessionMessageType.FORCE_KEEP_ALIVE
import org.jellyfin.sdk.model.api.SessionMessageType.GENERAL_COMMAND
import org.jellyfin.sdk.model.api.SessionMessageType.KEEP_ALIVE
import org.jellyfin.sdk.model.api.SessionMessageType.LIBRARY_CHANGED
import org.jellyfin.sdk.model.api.SessionMessageType.PACKAGE_INSTALLATION_CANCELLED
import org.jellyfin.sdk.model.api.SessionMessageType.PACKAGE_INSTALLATION_COMPLETED
import org.jellyfin.sdk.model.api.SessionMessageType.PACKAGE_INSTALLATION_FAILED
import org.jellyfin.sdk.model.api.SessionMessageType.PACKAGE_INSTALLING
import org.jellyfin.sdk.model.api.SessionMessageType.PACKAGE_UNINSTALLED
import org.jellyfin.sdk.model.api.SessionMessageType.PLAY
import org.jellyfin.sdk.model.api.SessionMessageType.PLAYSTATE
import org.jellyfin.sdk.model.api.SessionMessageType.REFRESH_PROGRESS
import org.jellyfin.sdk.model.api.SessionMessageType.RESTART_REQUIRED
import org.jellyfin.sdk.model.api.SessionMessageType.SCHEDULED_TASKS_INFO
import org.jellyfin.sdk.model.api.SessionMessageType.SCHEDULED_TASKS_INFO_START
import org.jellyfin.sdk.model.api.SessionMessageType.SCHEDULED_TASKS_INFO_STOP
import org.jellyfin.sdk.model.api.SessionMessageType.SCHEDULED_TASK_ENDED
import org.jellyfin.sdk.model.api.SessionMessageType.SERIES_TIMER_CANCELLED
import org.jellyfin.sdk.model.api.SessionMessageType.SERIES_TIMER_CREATED
import org.jellyfin.sdk.model.api.SessionMessageType.SERVER_RESTARTING
import org.jellyfin.sdk.model.api.SessionMessageType.SERVER_SHUTTING_DOWN
import org.jellyfin.sdk.model.api.SessionMessageType.SESSIONS
import org.jellyfin.sdk.model.api.SessionMessageType.SESSIONS_START
import org.jellyfin.sdk.model.api.SessionMessageType.SESSIONS_STOP
import org.jellyfin.sdk.model.api.SessionMessageType.SYNC_PLAY_COMMAND
import org.jellyfin.sdk.model.api.SessionMessageType.SYNC_PLAY_GROUP_UPDATE
import org.jellyfin.sdk.model.api.SessionMessageType.TIMER_CANCELLED
import org.jellyfin.sdk.model.api.SessionMessageType.TIMER_CREATED
import org.jellyfin.sdk.model.api.SessionMessageType.USER_DATA_CHANGED
import org.jellyfin.sdk.model.api.SessionMessageType.USER_DELETED
import org.jellyfin.sdk.model.api.SessionMessageType.USER_UPDATED
import org.jellyfin.sdk.model.socket.ActivityLogEntryMessage
import org.jellyfin.sdk.model.socket.ForceKeepAliveMessage
import org.jellyfin.sdk.model.socket.GeneralCommandMessage
import org.jellyfin.sdk.model.socket.IncomingSocketMessage
import org.jellyfin.sdk.model.socket.KeepAliveMessage
import org.jellyfin.sdk.model.socket.LibraryChangedMessage
import org.jellyfin.sdk.model.socket.OutgoingSocketMessage
import org.jellyfin.sdk.model.socket.PackageInstallationCancelledMessage
import org.jellyfin.sdk.model.socket.PackageInstallationCompletedMessage
import org.jellyfin.sdk.model.socket.PackageInstallationFailedMessage
import org.jellyfin.sdk.model.socket.PackageInstallingMessage
import org.jellyfin.sdk.model.socket.PackageUninstalledMessage
import org.jellyfin.sdk.model.socket.PlayMessage
import org.jellyfin.sdk.model.socket.PlayStateMessage
import org.jellyfin.sdk.model.socket.RefreshProgressMessage
import org.jellyfin.sdk.model.socket.RestartRequiredMessage
import org.jellyfin.sdk.model.socket.ScheduledTaskEndedMessage
import org.jellyfin.sdk.model.socket.ScheduledTasksInfoMessage
import org.jellyfin.sdk.model.socket.SeriesTimerCancelledMessage
import org.jellyfin.sdk.model.socket.SeriesTimerCreatedMessage
import org.jellyfin.sdk.model.socket.ServerRestartingMessage
import org.jellyfin.sdk.model.socket.ServerShuttingDownMessage
import org.jellyfin.sdk.model.socket.SessionsMessage
import org.jellyfin.sdk.model.socket.SyncPlayCommandMessage
import org.jellyfin.sdk.model.socket.SyncPlayGroupUpdateMessage
import org.jellyfin.sdk.model.socket.TimerCancelledMessage
import org.jellyfin.sdk.model.socket.TimerCreatedMessage
import org.jellyfin.sdk.model.socket.UserDataChangedMessage
import org.jellyfin.sdk.model.socket.UserDeletedMessage
import org.jellyfin.sdk.model.socket.UserUpdatedMessage

private val logger = KotlinLogging.logger {}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package org.jellyfin.sdk.discovery

import io.ktor.http.*
import io.ktor.http.URLBuilder
import io.ktor.http.URLParserException
import io.ktor.http.URLProtocol
import io.ktor.http.Url
import io.ktor.http.takeFrom
import mu.KotlinLogging

private val logger = KotlinLogging.logger {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package org.jellyfin.sdk.model.extensions

import org.jellyfin.sdk.model.api.GeneralCommandType
import org.jellyfin.sdk.model.socket.GeneralCommandMessage
import java.util.*
import java.util.UUID
import kotlin.test.Test
import kotlin.test.assertEquals

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.jellyfin.sdk.model.extensions

import org.jellyfin.sdk.model.api.NameGuidPair
import java.util.*
import java.util.UUID
import kotlin.test.Test
import kotlin.test.assertEquals

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.jellyfin.sdk.model.serializer

import kotlinx.serialization.json.Json
import java.util.*
import java.util.UUID
import kotlin.test.Test
import kotlin.test.assertEquals

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package org.jellyfin.openapi

import org.jellyfin.openapi.builder.api.*
import org.jellyfin.openapi.builder.api.ApiBuilder
import org.jellyfin.openapi.builder.api.ApiClientExtensionsBuilder
import org.jellyfin.openapi.builder.api.ApiNameBuilder
import org.jellyfin.openapi.builder.api.OperationBuilder
import org.jellyfin.openapi.builder.api.OperationUrlBuilder
import org.jellyfin.openapi.builder.extra.DeprecatedAnnotationSpecBuilder
import org.jellyfin.openapi.builder.extra.DescriptionBuilder
import org.jellyfin.openapi.builder.extra.FileSpecBuilder
Expand All @@ -9,7 +13,11 @@ import org.jellyfin.openapi.builder.model.EmptyModelBuilder
import org.jellyfin.openapi.builder.model.EnumModelBuilder
import org.jellyfin.openapi.builder.model.ModelBuilder
import org.jellyfin.openapi.builder.model.ObjectModelBuilder
import org.jellyfin.openapi.builder.openapi.*
import org.jellyfin.openapi.builder.openapi.OpenApiApiServicesBuilder
import org.jellyfin.openapi.builder.openapi.OpenApiConstantsBuilder
import org.jellyfin.openapi.builder.openapi.OpenApiModelBuilder
import org.jellyfin.openapi.builder.openapi.OpenApiReturnTypeBuilder
import org.jellyfin.openapi.builder.openapi.OpenApiTypeBuilder
import org.koin.dsl.module

val mainModule = module {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package org.jellyfin.openapi.builder.api

import com.squareup.kotlinpoet.*
import com.squareup.kotlinpoet.ClassName
import com.squareup.kotlinpoet.FunSpec
import com.squareup.kotlinpoet.KModifier
import com.squareup.kotlinpoet.PropertySpec
import com.squareup.kotlinpoet.TypeSpec
import org.jellyfin.openapi.builder.Builder
import org.jellyfin.openapi.constants.Classes
import org.jellyfin.openapi.constants.Packages
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
package org.jellyfin.openapi.builder.api

import com.squareup.kotlinpoet.*
import com.squareup.kotlinpoet.ClassName
import com.squareup.kotlinpoet.FunSpec
import com.squareup.kotlinpoet.KModifier
import com.squareup.kotlinpoet.MemberName
import com.squareup.kotlinpoet.ParameterSpec
import com.squareup.kotlinpoet.ParameterizedTypeName
import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.plusParameter
import org.jellyfin.openapi.builder.Builder
import org.jellyfin.openapi.builder.extra.DeprecatedAnnotationSpecBuilder
Expand All @@ -9,7 +14,11 @@ import org.jellyfin.openapi.constants.Classes
import org.jellyfin.openapi.constants.Packages
import org.jellyfin.openapi.constants.Strings
import org.jellyfin.openapi.constants.Types
import org.jellyfin.openapi.model.*
import org.jellyfin.openapi.model.ApiServiceOperation
import org.jellyfin.openapi.model.ApiServiceOperationParameter
import org.jellyfin.openapi.model.CustomDefaultValue
import org.jellyfin.openapi.model.IntRangeValidation
import org.jellyfin.openapi.model.ParameterValidation

open class OperationBuilder(
private val descriptionBuilder: DescriptionBuilder,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package org.jellyfin.openapi.builder.model

import com.squareup.kotlinpoet.*
import com.squareup.kotlinpoet.AnnotationSpec
import com.squareup.kotlinpoet.FunSpec
import com.squareup.kotlinpoet.KModifier
import com.squareup.kotlinpoet.PropertySpec
import com.squareup.kotlinpoet.TypeSpec
import net.pearx.kasechange.CaseFormat
import net.pearx.kasechange.toPascalCase
import net.pearx.kasechange.toScreamingSnakeCase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ package org.jellyfin.openapi.builder.model

import org.jellyfin.openapi.OpenApiGeneratorError
import org.jellyfin.openapi.builder.Builder
import org.jellyfin.openapi.model.*
import org.jellyfin.openapi.model.ApiModel
import org.jellyfin.openapi.model.EmptyApiModel
import org.jellyfin.openapi.model.EnumApiModel
import org.jellyfin.openapi.model.JellyFile
import org.jellyfin.openapi.model.ObjectApiModel

class ModelBuilder(
private val emptyModelBuilder: EmptyModelBuilder,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
package org.jellyfin.openapi.builder.model

import com.squareup.kotlinpoet.*
import com.squareup.kotlinpoet.AnnotationSpec
import com.squareup.kotlinpoet.FunSpec
import com.squareup.kotlinpoet.KModifier
import com.squareup.kotlinpoet.ParameterSpec
import com.squareup.kotlinpoet.PropertySpec
import com.squareup.kotlinpoet.TypeName
import com.squareup.kotlinpoet.TypeSpec
import net.pearx.kasechange.CaseFormat
import net.pearx.kasechange.toPascalCase
import org.jellyfin.openapi.builder.Builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ import org.jellyfin.openapi.constants.Types
import org.jellyfin.openapi.hooks.ApiTypePath
import org.jellyfin.openapi.hooks.DefaultValueHook
import org.jellyfin.openapi.hooks.ServiceNameHook
import org.jellyfin.openapi.model.*
import org.jellyfin.openapi.model.ApiService
import org.jellyfin.openapi.model.ApiServiceOperation
import org.jellyfin.openapi.model.ApiServiceOperationParameter
import org.jellyfin.openapi.model.HttpMethod
import org.jellyfin.openapi.model.IntRangeValidation
import org.jellyfin.openapi.model.ParameterValidation

private val logger = KotlinLogging.logger { }

Expand Down
Loading

0 comments on commit 012f76f

Please sign in to comment.