Releases: pinterest/ktlint
1.5.0
The release of Kotlin 2.1 is the primary reason for publishing this release earlier than planned. Because of the removal of some language elements in Kotlin 2.1, the embedded Kotlin compiler in KtLint blocked Kotlinter users from upgrading to Kotlin 2.1.
🆕 Features
-
Add missing space between
fun
keyword and identifier when latter is wrapped between backticks - #2890, by @paul-dingemans -
Add configuration setting for constant names in
property-naming
rule - #2893, by @paul-dingemans -
Allow backing property to be defined in the companion object (
backing-property-naming
) - #2895, by @paul-dingemans
🔧 Fixes
-
Ignore multi dollar string interpolation prefix in
string-template-indent
rule - #2888, by @paul-dingemans -
Wrap the expression body in case
.editorconfig
propertyktlint_function_signature_body_expression_wrapping
is set toalways
- #2873, by @paul-dingemans -
Fix false positive when empty parameter list is in between trailing lambda's of a nested call expression - #2891, by @paul-dingemans
-
Do not wrap a context receiver in a function parameter type reference - #2892, by @paul-dingemans
-
Allow comment before parameter list in function literal (
function-literal
) - #2894, by @paul-dingemans
📦 Dependencies
-
chore(deps): update plugin com.gradle.develocity to v3.18.2 - #2865, by @renovate[bot]
-
chore(deps): update dependency gradle to v8.11.1 - #2875, by @renovate[bot]
-
fix(deps): update dependency io.github.hakky54:logcaptor to v2.10.0 - #2874, by @renovate[bot]
-
fix(deps): update dependency org.jetbrains.kotlin:kotlin-gradle-plugin to v2.1.0-rc2 - #2871, by @renovate[bot]
-
fix(deps): update dependency io.github.oshai:kotlin-logging-jvm to v7.0.3 - #2883, by @renovate[bot]
-
fix(deps): update kotlin monorepo to v2.1.0 - #2880, by @renovate[bot]
-
fix(deps): update dependency com.github.ajalt.clikt:clikt to v5.0.2 - #2886, by @renovate[bot]
-
chore(deps): update plugin org.gradle.toolchains.foojay-resolver-convention to v0.9.0 - #2887, by @renovate[bot]
-
fix(deps): update dependency dev.drewhamilton.poko:poko-gradle-plugin to v0.18.0 - #2889, by @renovate[bot]
1.4.1
🔧 Fixes
- Catch java.lang.NoSuchFieldError when looking for WHEN_ENTRY_GUARD in kotlin version 2.0.1 - #2857, by @paul-dingemans
📦 Dependencies
1.4.0
🆕 Features
-
Suppress
backing-property-naming
on@Suppress("PropertyName")
- #2741, by @paul-dingemans -
Check that code can still be parsed after a format - #2742, by @paul-dingemans
-
Support suppressing backing-property-naming via ObjectPropertyName - #2751, by @Goooler
-
Ignore properties starting with
_
inbacking-property-naming
rule - #2753, by @paul-dingemans -
Suppress
backing-property-naming
rule with@Suppress("LocalVariableName")
- #2785, by @paul-dingemans -
Do not repeat formatting if file is unchanged - #2805, by @paul-dingemans
-
Add new rule
when-entry-bracing
- #2829, by @paul-dingemans -
Add
.editorconfig
propertyij_kotlin_indent_before_arrow_on_new_line
- #2838, by @paul-dingemans -
Add CLI option
--stdin-path
to provide a virtual file location for stdin - #2836, by @adecker89 -
Add property
.editorconfig
propertyktlint_enum_entry_name_casing
- #2839, by @paul-dingemans
🔧 Fixes
-
Prevent line separators to be changed from CRLF to LF - #2752, by @paul-dingemans
-
fix: don't remove arrow from lambdas that are when/if leaf nodes - #2758, by @tKe
-
Fix false positive in
no-semi
rule for enum class without enum entries - #2774, by @paul-dingemans -
Prevent conflict between
multiline-expression-wrapping
andfunction-signature
- #2775, by @paul-dingemans -
Ignore
max_line_length
property unlessmax-line-length
rule is enabled - #2783, by @paul-dingemans -
Fix false positive in
class-signature
when EOL comment is between a class annotation and other class modifier - #2786, by @paul-dingemans -
Fix globs ending with
**
- #2787, by @paul-dingemans -
Return exit code 1 in case violations have been found but file is unchanged - #2803, by @paul-dingemans
-
Ignore missing whitespace after trailing comma in single line parameter value list - #2806, by @paul-dingemans
-
Function signature rule ignores context receiver when on separate line - #2814, by @paul-dingemans
-
Do not remove imports for which the fully qualified path is identical to the package name - #2822, by @paul-dingemans
-
Fix indentation of a multiline parameter list inside a function literal for code style
ktlint_official
- #2823, by @paul-dingemans -
Do not insert a trailing comma in a multiline when-entry containing a guard - #2825, by @paul-dingemans
-
Fix wrapping of expression body when
max_line_length
not set - #2833, by @paul-dingemans
📦 Dependencies
-
Update dependency io.github.oshai:kotlin-logging-jvm to v7 - #2701, by @renovate[bot]
-
Update dependency org.assertj:assertj-core to v3.26.3 - #2738, by @renovate[bot]
-
Update mikepenz/release-changelog-builder-action action to v5 - #2756, by @renovate[bot]
-
chore(deps): update plugin kotlinx-binary-compatibiltiy-validator to v0.16.3 - #2759, by @renovate[bot]
-
fix(deps): update dependency org.slf4j:slf4j-simple to v2.0.16 - #2764, by @renovate[bot]
-
chore(deps): update gradle/actions action to v4 - #2760, by @renovate[bot]
-
chore(deps): update plugin com.gradle.develocity to v3.18.1 - #2792, by @renovate[bot]
-
chore(deps): update dependency gradle to v8.10.2 - #2812, by @renovate[bot]
-
chore(deps): update plugin shadow to v8.3.3 - #2820, by @renovate[bot]
-
fix(deps): update dependency com.github.ajalt.clikt:clikt to v5.0.1 - #2828, by @renovate[bot]
-
chore(deps): update kotlin monorepo to v2.0.21 - #2831, by @renovate[bot]
-
fix(deps): update dependency org.ec4j.core:ec4j-core to v1.1.0 - #2832, by @renovate[bot]
-
fix(deps): update dependency org.jetbrains.kotlin:kotlin-gradle-plugin to v2.1.0-beta2 - #2834, by @renovate[bot]
-
fix(deps): update dependency dev.drewhamilton.poko:poko-gradle-plugin to v0.17.2 - #2837, by @renovate[bot]
-
fix(deps): update dependency org.junit.jupiter:junit-jupiter to v5.11.3 - #2840, by @renovate[bot]
-
chore(deps): update actions/checkout digest to 11bd719 - #2841, by @renovate[bot]
1.3.1
🔧 Fixes
- Add link for backing-property-naming, correct binary-expression-wrapping - #2704, by @rsmith20
- Do not insert a whitespace element as first or last child inside a composite element - #2715, by @paul-dingemans
- Do not rewrite a class to a single line signature in case it contains an EOL comment - #2716, by @paul-dingemans
- Fix false positive when anonymous function is used as value argument - #2718, by @paul-dingemans
- Fix suppression handling when 'formatter:on' not properly specified - #2719, by @paul-dingemans
- Fix false positive when primary constructor has no arguments and a secondary constructor exists - #2717, by @paul-dingemans
- Ignore suppressions for no-unused-imports rule - #2720, by @paul-dingemans
- Ignore suppressions in rule
no-unused-imports
- #2725, by @paul-dingemans - Fix false alert
Format was not able to resolve all violations which (theoretically) can be autocorrected
- #2727, by @paul-dingemans - Fix "unset" value for property ktlint_chain_method_rule_force_multiline_when_chain_operator_count_greater_or_equal_than - #2728, by @paul-dingemans
📦 Dependencies
- Update dependency gradle to v8.8 - #2680, by @renovate[bot]
- Update plugin com.gradle.develocity to v3.17.5 - #2697, by @renovate[bot]
- Update actions/checkout digest to 692973e - #2699, by @renovate[bot]
- Update dependency io.github.hakky54:logcaptor to v2.9.3 - #2707, by @renovate[bot]
- Update dependency org.junit.jupiter:junit-jupiter to v5.10.3 - #2721, by @renovate[bot]
💬 Other
- Remove sdkman - #2693, by @paul-dingemans
1.3.0
🆕 Features
-
Support partial formatting - #2631, by @paul-dingemans
-
Suppress
property-name
rule forObjectPropertyName
orPrivatePropertyName
- #2643, by @paul-dingemans -
Let API Consumer decide whether a LintError has to be autocorrected, or not - #2671, by @paul-dingemans
-
Promote experimental rules to non-experimental - #2674, by @paul-dingemans
🔧 Fixes
-
Do not wrap operation reference after multiline string template - #2591, by @paul-dingemans
-
Ignore max line length in case the line contains only a string template followed by a comma - #2598, by @paul-dingemans
-
Ignore nested reference expressions in
chain-method-continuation
- #2606, by @paul-dingemans -
Prevent exception in
binary-expression-wrapping
rule - #2607, by @paul-dingemans -
Do not merge opening quotes of multiline string template with (single line) function signature - #2609, by @paul-dingemans
-
Fix replacement of redundant curly braces - #2617, by @paul-dingemans
-
Set and reset Locale to pass test for non-english contributor. - #2622, by @Jaehwa-Noh
-
Fix unwanted whitespace between super class constructor and its argument list - #2630, by @tKe
-
Fix typo's - #2641, by @paul-dingemans
-
Handle trailing space on preceding line in call to
lineLengthWithoutNewlinePrefix
- #2644, by @paul-dingemans -
Fix not checking for spacing around binary operators inside unary expression - #2653, by @cflee
-
Fix
blank line before declarations
rule code example - #2657, by @k-taro56 -
Fixed [{ }] notation for issue #2675 - #2677, by @Jolanrensen
📦 Dependencies
-
Update dependency org.jetbrains.dokka:dokka-gradle-plugin to v1.9.20 - #2590, by @renovate[bot]
-
Update softprops/action-gh-release action to v2 - #2600, by @renovate[bot]
-
Update dependency io.github.detekt.sarif4k:sarif4k to v0.6.0 - #2605, by @renovate[bot]
-
Update dependency org.slf4j:slf4j-simple to v2.0.13 - #2632, by @renovate[bot]
-
Update gradle/wrapper-validation-action action to v3 - #2633, by @renovate[bot]
-
Update dependency io.github.oshai:kotlin-logging-jvm to v6.0.9 - #2634, by @renovate[bot]
-
Update dependency com.github.ajalt.clikt:clikt to v4.4.0 - #2647, by @renovate[bot]
-
Update kotlin monorepo to v1.9.24 - #2649, by @renovate[bot]
-
Update plugin com.gradle.develocity to v3.17.4 - #2660, by @renovate[bot]
-
Update dependency dev.drewhamilton.poko:poko-gradle-plugin to v0.15.3 - #2662, by @renovate[bot]
-
Update actions/checkout digest to a5ac7e5 - #2664, by @renovate[bot]
-
Update dependency org.assertj:assertj-core to v3.26.0 - #2669, by @renovate[bot]
1.2.1
🆕 Features
None
🔧 Fixes
- Mark new rules as experimental - #2579, by @paul-dingemans
- Fix null byte as default value for "--pattern-from-stdin" - #2580, by @paul-dingemans
- Fix handling of "--reporter" CLI parameter - #2581, by @paul-dingemans
1.2.0
🆕 Features
WARNING: The new rules have accidentally not been marked as experimental. This will be fixed in a bugfix!
-
Break dependency between string-template-indent and multiline-expression-wrapping - #2505, by @paul-dingemans
-
Allow string template to exceed max line length when it is the only element on a line - #2480, by @paul-dingemans
-
Add configuration setting for ignoring
argument-list-wrapping
above treshold of argument - #2481, by @paul-dingemans
NOTE: In code stylektlint_official
this threshold isunset
so that arguments are always wrapped. If this impacts your code too much, you can make it backward compatible by setting.editorconfig
propertyktlint_argument_list_wrapping_ignore_when_parameter_count_greater_or_equal_than
to value8
. For other code styles this property is initialized with value8
and as of that backward compatible by default. -
Ignore EOL comment that causes max_line_length to be exceeded, except in max-line-length rule - #2516, by @paul-dingemans
-
Add new rule for disallowing KDoc at non-whitelisted locations - #2548, by @paul-dingemans
-
Improve insert of suppression - #2546, by @paul-dingemans
-
Ignore modifier of backing property in
android_studio
code style - #2552, by @paul-dingemans -
Add rule to check spacing around square brackets 'square-brackets-spacing' - #2555, by @paul-dingemans
-
Add rule
blank-line-between-when-conditions
- #2564, by @paul-dingemans
🔧 Fixes
-
Prevent IllegalArgumentException in
argument-list-wrapping
rule - #2500, by @paul-dingemans -
Ignore function which is returned as result in a function body - #2526, by @paul-dingemans
-
Fix false positive newline expected before comment in enum - #2527, by @paul-dingemans
-
Report violation when parameter list is preceded by a comment - #2541, by @paul-dingemans
-
Ignore EOL comments in
value-argument-comment
andvalue-parameter-comment
- #2551, by @paul-dingemans -
Do not indent string template starting at first position of line - #2553, by @paul-dingemans
-
Prevent conflict when curly closing brace is followed by range (until) operator - #2554, by @paul-dingemans
-
Run argument-list-wrapping after function-signature - #2568, by @paul-dingemans
-
Ignore simple reference expressions in
chain-method-continuation
- #2569, by @paul-dingemans
📦 Dependencies
-
chore(deps): update plugin org.gradle.toolchains.foojay-resolver-convention to v0.8.0 - #2503, by @renovate[bot]
-
fix(deps): update dependency io.github.oshai:kotlin-logging-jvm to v6 - #2440, by @renovate[bot]
-
Replace gradle/gradle-build-action@v3 with gradle/actions/setup-gradle@v3 - #2518, by @paul-dingemans
-
chore(deps): update plugin kotlinx-binary-compatibiltiy-validator to v0.14.0 - #2522, by @renovate[bot]
-
chore(deps): update gradle/wrapper-validation-action action to v2 - #2523, by @renovate[bot]
-
chore(deps): update ffurrer2/extract-release-notes action to v2 - #2515, by @renovate[bot]
-
chore(deps): update dependency gradle to v8.6 - #2531, by @renovate[bot]
-
fix(deps): update dependency org.assertj:assertj-core to v3.25.3 - #2536, by @renovate[bot]
-
fix(deps): update dependency org.junit.jupiter:junit-jupiter to v5.10.2 - #2534, by @renovate[bot]
-
fix(deps): update dependency org.slf4j:slf4j-simple to v2.0.12 - #2538, by @renovate[bot]
-
fix(deps): update dependency org.codehaus.janino:janino to v3.1.12 - #2559, by @renovate[bot]
💬 Other
-
2550 clikt - #2556, by @paul-dingemans
1.1.1
🆕 Features
None
🔧 Fixes
-
Fix incorrect generateEditorConfig example in documentation - #2444, by @stay7
-
Fix insert of suppression on binary expression - #2463, by @paul-dingemans
-
Loosen dependency between chain-method-continuation and argument-list-wrapping - #2468, by @paul-dingemans
-
Keep arrow when both parameter list and block of function literal are empty - #2469, by @paul-dingemans
-
Improve wrapping of binary expressions - #2479, by @paul-dingemans
-
Resolve conflict between parameter-list-spacing and parameter-list-wrapping - #2491, by @paul-dingemans
-
Do not wrap binary expression value argument if it is already preceded by a newline - #2493, by @paul-dingemans
-
Fix operator spacing - #2473, by @paul-dingemans
-
Run
argument-list-wrapping
,class-signature
andfunction-signature
when comment rules are disabled - #2466, by @paul-dingemans
📦 Dependencies
-
fix(deps): update kotlin monorepo to v1.9.22 - #2456, by @renovate[bot]
-
chore(deps): update actions/setup-python action to v5 - #2417, by @renovate[bot]
-
fix(deps): update dependency org.slf4j:slf4j-simple to v2.0.10 - #2470, by @renovate[bot]
-
fix(deps): update dependency dev.drewhamilton.poko:poko-gradle-plugin to v0.15.2 - #2485, by @renovate[bot]
-
fix(deps): update dependency org.assertj:assertj-core to v3.25.1 - #2486, by @renovate[bot]
1.1.0
🆕 Features
-
Compile with java 21 instead of 20 - #2320, by @paul-dingemans
-
Improve checking on backing property - #2346, by @paul-dingemans
-
Add multiline-loop to complement multiline-if-else - #2298, by @hendraanggrian
-
Add "UnusedImport" as @Suppress alias - #2357, by @paul-dingemans
-
Allow backing property to be correlated to a public function - #2356, by @paul-dingemans
-
Add helper function 'fromSnippetWithPath' to create a Code instance - #2359, by @paul-dingemans
-
Support logging and exception throwing when loading baseline - #2362, by @paul-dingemans
-
Allow factory methods to use generics, and to overload other factory … - #2366, by @paul-dingemans
-
Remove dependencies on discouraged-comment-location rule - #2371, by @paul-dingemans
-
Ignore imports for
rangeUntil
inno-unused-imports
rule - #2376, by @paul-dingemans -
Ignore imports for
assign
inno-unused-imports
rule - #2382, by @paul-dingemans -
Ignore invalid function names when importing from "junit.framework" - #2386, by @paul-dingemans
-
Add experimental rules
condition-wrapping
andmixed-condition-operators
- #2401, by @paul-dingemans -
Allow property, function and class name to be same as keyword wrapped with backticks - #2405, by @paul-dingemans
-
Set offset of
max-line-length
violation to the last position at which a newline can be inserted to fix the violation - #2419, by @paul-dingemans -
Add support for API Consumers to add suppressions - #2428, by @paul-dingemans
-
Disallow
else-if (..) <statement>
as single line construct - #2430, by @paul-dingemans -
Allow empty constructor for expected class declaration - #2431, by @paul-dingemans
-
Disallow comments in try-catch-finally at unexpected locations - #2432, by @paul-dingemans
-
Make ktlint.bat more environment agnostic - #2421, by @TWiStErRob
-
Suppress property-naming rule via
@Suppress("ConstPropertyName")
- #2442, by @paul-dingemans
🔧 Fixes
-
Remove obsolete configuration files - #2321, by @paul-dingemans
-
De-indent the closing angle bracket of the type argument list and type parameter lists in ktlint_official code style - #2302, by @paul-dingemans
-
docs: Fix artifact url of Maven Central Badge - #2327, by @guicamest
-
Remove redundant arrow in function literal without parameters / fix documentation - #2365, by @paul-dingemans
-
Move curly brace before all consecutive comments preceding that curly brace - #2375, by @paul-dingemans
-
Prevent stack overflow exception when code provided via stdin can not be parsed as Kotlin, nor Kotlin script - #2380, by @paul-dingemans
-
Fix searching from inside a hidden directory - #2377, by @kitterion
-
Prevent unwanted joining of KDoc with preceding type-parameter-list - #2381, by @paul-dingemans
-
Fix false positive violation in
annotation
rule - #2400, by @paul-dingemans -
Replace all function bodies with body expressions in a single run - #2395, by @paul-dingemans
-
Fix offset for violation when final newline is missing - #2407, by @paul-dingemans
-
Fix path to ktlint JAR file in
ktlint.bat
- #2408, by @paul-dingemans -
Simplify
max-line-length
implementation - #2410, by @paul-dingemans -
Remove deprecated cli parameters
--experimental
,--code-style
,--disabled-rules
- #2411, by @paul-dingemans -
Fix adding blank line between declaration and an annotated declaration which is preceded by comment - #2429, by @paul-dingemans
-
Update CODE_OF_CONDUCT with correct path - #2437, by @OriginalMHV
📦 Dependencies
-
fix(deps): update dependency org.jetbrains.dokka:dokka-gradle-plugin to v1.9.10 - #2323, by @renovate[bot]
-
fix(deps): update dependency org.junit.jupiter:junit-jupiter to v5.10.1 - #2342, by @renovate[bot]
-
fix(deps): update kotlin monorepo to v1.9.21 - #2374, by @renovate[bot]
-
fix(deps): update dependency org.codehaus.janino:janino to v3.1.11 - #2387, by @renovate[bot]
-
fix(deps): update dependency dev.drewhamilton.poko:poko-gradle-plugin to v0.15.1 - #2389, by @renovate[bot]
-
chore(deps): update dependency gradle to v8.5 - #2392, by @renovate[bot]
-
chore(deps): update actions/checkout digest to b4ffde6 - #2329, by @renovate[bot]
-
chore(deps): update actions/setup-java action to v4 - #2393, by @renovate[bot]
-
fix(deps): update dependency ch.qos.logback:logback-classic to v1.3.14 - #2406, by @renovate[bot]
-
fix(deps): update dependency io.github.hakky54:logcaptor to v2.9.2 - #2409, by @renovate[bot]
-
fix(deps): update dependency io.github.oshai:kotlin-logging-jvm to v5.1.4 - #2439, by @renovate[bot]
1.0.1
🆕 Features
- Add
.editorconfig
propertyktlint_function_naming_ignore_when_annotated_with
so that rulefunction-naming
can be ignored based on annotations on that rule. See function-naming.
🔧 Fixes
-
Fix code style parameter in cli - #2241, by @paul-dingemans
-
Anonymous function in assignment - #2263, by @paul-dingemans
-
Fix indent of multiline object declaration inside class - #2266, by @paul-dingemans
-
Do not replace function body with multiple exit points - #2273, by @paul-dingemans
-
Ignore override of function in rule
function-naming
- #2274, by @paul-dingemans -
Suppress
function-naming
based on annotations - #2275, by @paul-dingemans -
Force blank line before object declaration - #2287, by @paul-dingemans
-
Multiline expression wrapping - #2290, by @paul-dingemans
-
Ignore function naming in Kotest classes - #2291, by @paul-dingemans
-
Improve violation message in
discouraged-comment-location
- #2293, by @paul-dingemans -
Fix malformed AST when
&&
or||
is at start of linechain-wrapping
- #2300, by @paul-dingemans -
Do not report false positives
type-argument-list-spacing
andtype-parameter-list-spacing
- #2303, by @paul-dingemans -
Fix chain method continuation containing higher order function call - #2305, by @paul-dingemans
📦 Dependencies
-
Update dependency io.github.detekt.sarif4k:sarif4k to v0.5.0 - #2277, by @renovate[bot]
-
Update actions/checkout action to v4 - #2225, by @renovate[bot]
-
Update actions/checkout digest to 8ade135 - #2295, by @renovate[bot]