ktlint
ktlint copied to clipboard
An anti-bikeshedding Kotlin linter with built-in formatter
## Expected Behavior The following code only reports an error on the commented line: ```kotlin @Serializable data class EmploymentAgreement( @Contextual val firstEmploymentDate: LocalDate, val employmentLevel: Double, @Contextual val activeFrom: LocalDate,...
When destructured parameters in a lambda are put on separate lines with trailing commas turned on, the error `Missing newline after "," (wrapping)` is issued just after the final trailing...
## Expected Behavior I have a Kotlin file `KmsKeyId.kt` that contains only this line of code ``` @JvmInline value class KmsKeyId(val kmsKeyId: String) ``` I am using the Bazel kotlin_rules...
## Expected Behavior ```kotlin enum class Test { TEST_1, TEST_2, TEST_3, } fun bla(value: Test) = when (value) { Test.TEST_1, Test.TEST_2 -> { println("1, 2") } Test.TEST_3 -> { println("3")...
## Description Fix indent of when entry with a dot qualified expression (for example a qualified enum value) instead of simple value when trailing comma is required: ``` fun bla(value:...
## Description Replace (biggest part of) processing of MODIFIER_LIST and FILE_ANNOTATION_LIST with processing of individual ANNOTATION_ENTRY. This allows ANNOTATION_ENTRY to be followed by EOL_COMMENT plus another ANNOTATION_ENTRY: ``` @Suppress("AnnotationRule") //...
ktlint { version.set("0.45.2") android.set(true) additionalEditorconfigFile.set(file("/my-android/.editorconfig")) disabledRules.set(Set.of("max_line_length", "import-ordering", "no-wildcard-imports", "final-newline", "missing-newline-after", "no-unused-imports", "indent")) } } Result: Exceeded max line length (100) (cannot be auto-corrected) With these settings, I keep getting an...
When releasing a new version of ktlint, the documentation should be updated: * https://pinterest.github.io/ktlint/install/integrations/#maven-integration * https://pinterest.github.io/ktlint/install/integrations/#custom-gradle-integration * https://pinterest.github.io/ktlint/install/cli/
## Expected Rule behavior If one of if/else/else if use braces then all parts must use it Correct: ```kotlin if (true) 1 else 2 if (true) 1 else if (false)...
## Expected Behavior The task should tell me if there is a problem with the code style or not. ## Observed Behavior Crash: ``` > Task :ktlintFormat FAILED 17:02:10.989 [main]...