Skip to content

Commit

Permalink
Use "import on demand" only for Ktor modules (#4495)
Browse files Browse the repository at this point in the history
  • Loading branch information
osipxd authored Nov 19, 2024
1 parent 9380363 commit 37d9676
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 16 deletions.
9 changes: 6 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ indent_size = 2

[*.{kt,kts}]
ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL
ij_kotlin_name_count_to_use_star_import = 1
ij_kotlin_name_count_to_use_star_import_for_members = 1
ij_kotlin_packages_to_use_import_on_demand = java.util.*, io.ktor.**

ktlint_standard_no-wildcard-imports = disabled
ktlint_standard_trailing-comma-on-call-site = disabled
ktlint_standard_trailing-comma-on-declaration-site = disabled
ktlint_standard_filename = disabled
ktlint_standard_class-naming = disabled
ktlint_standard_annotation = disabled
ktlint_standard_comment-wrapping = disabled
ktlint_standard_comment-wrapping = disabled

[*.kts]
# Always use wildcard imports in scripts
ij_kotlin_name_count_to_use_star_import = 2
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ build
.gradle
.gradletasknamecache
.idea/*
!.idea/externalDependencies.xml
!.idea/runConfigurations
!.idea/runConfigurations/*
!.idea/vcs.xml
Expand Down
6 changes: 6 additions & 0 deletions .idea/externalDependencies.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,14 @@ A few things to remember:

* Your code should conform to
the official [Kotlin code style guide](https://kotlinlang.org/docs/reference/coding-conventions.html)
except that star imports should be always enabled
(ensure Preferences | Editor | Code Style | Kotlin, tab **Imports**, both `Use import with '*'` should be checked).
except that star imports should always be used for `io.ktor.*` packages.
Code style is managed by [EditorConfig](https://www.jetbrains.com/help/idea/editorconfig.html),
so make sure the EditorConfig plugin is enabled in the IDE.
* Every new source file should have a copyright header.
* Every public API (including functions, classes, objects and so on) should be documented,
every parameter, property, return types and exceptions should be described properly.
* A questionable and new API should be marked with the `@KtorExperimentalAPI` annotation.
* A Public API that is not intended to be used by end-users that couldn't be made private/internal due to technical reasons,
* A Public API which is not intended to be used by end-users that couldn't be made private/internal due to technical
reasons,
should be marked with `@InternalAPI` annotation.

### Commit messages
Expand Down
11 changes: 6 additions & 5 deletions ktor-http/ktor-http-cio/jvm/src/io/ktor/http/cio/Multipart.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ package io.ktor.http.cio

import io.ktor.http.cio.internals.*
import io.ktor.utils.io.*
import io.ktor.utils.io.ByteString
import io.ktor.utils.io.core.*
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.*
import kotlinx.io.*
import kotlinx.io.bytestring.*
import kotlinx.coroutines.channels.ReceiveChannel
import kotlinx.coroutines.channels.produce
import kotlinx.io.IOException
import kotlinx.io.Source
import kotlinx.io.bytestring.ByteString
import java.io.EOFException
import java.nio.*
import java.nio.ByteBuffer

/**
* Represents a multipart content starting event. Every part need to be completely consumed or released via [release]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
/*
* Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/

package io.ktor.http.cio

import io.ktor.http.*
import io.ktor.utils.io.*
import io.ktor.utils.io.core.*
import kotlinx.io.*
import java.nio.*
import kotlinx.io.Source
import java.nio.ByteBuffer

/**
* Builds an HTTP request or response
Expand Down

0 comments on commit 37d9676

Please sign in to comment.