All Versions
83
Latest Version
Avg Release Cycle
47 days
Latest Release
102 days ago

Changelog History
Page 1

  • v0.46.1 Changes

    June 21, 2022

    ๐Ÿš€ Minor release to address some regressions introduced in 0.46.0

    ๐Ÿ›  Fixed

    • โœ‚ Remove experimental flag -Xuse-k2 as it forces API Consumers to compile their projects with this same flag (#1506).
    • ๐Ÿ‘• Account for separating spaces when parsing the disabled rules (#1508).
    • ๐Ÿ‘• Do not remove space before a comment in a parameter list (#1509).
    • ๐Ÿ‘• A delegate property which starts on the same line as the property declaration should not have an extra indentation indent (#1510)
  • v0.46.0 Changes

    June 18, 2022

    Promoting experimental rules to standard

    The rules below are promoted from the experimental ruleset to the standard ruleset.

    • annotation
    • annotation-spacing
    • argument-list-wrapping
    • double-colon-spacing
    • enum-entry-name-case
    • multiline-if-else
    • no-empty-first-line-in-method-block
    • ๐Ÿ“ฆ package-name
    • trailing-comma
    • spacing-around-angle-brackets
    • spacing-between-declarations-with-annotations
    • spacing-between-declarations-with-comments
    • unary-op-spacing

    ๐Ÿšš Note that as a result of moving the rules that the prefix experimental: has to be removed from all references to this rule. Check references in:

    • The .editorconfig setting disabled_rules.
    • ๐Ÿ‘• KtLint disable and enable directives.
    • The VisitorModifier.RunAfterRule.

    ๐Ÿ‘• If your project did not run with the experimental ruleset enabled before, you might expect new lint violations to be reported. Please note that rules can be disabled via the the .editorconfig in case you do not want the rules to be applied on your project.

    API Changes & RuleSet providers

    ๐Ÿš€ If you are not an API user nor a RuleSet provider, then you can safely skip this section. Otherwise, please read below carefully and upgrade your usage of ktlint. In this and coming releases, we are changing and adapting important parts of our API in order to increase maintainability and flexibility for future changes. Please avoid skipping a releases as that will make it harder to migrate.

    ๐Ÿ‘• Lint and formatting functions

    ๐Ÿ‘• The lint and formatting changes no longer accept parameters of type Params but only ExperimentalParams. Also, the VisitorProvider parameter has been removed. Because of this, your integration with KtLint breaks. Based on feedback with ktlint 0.45.x, we now prefer to break at compile time instead of trying to keep the interface backwards compatible. Please raise an issue, in case you help to convert to the new API.

    ๐Ÿ‘‰ Use of ".editorconfig" properties & userData

    ๐Ÿ‘ป The interface UsesEditorConfigProperties provides method getEditorConfigValue to retrieve a named .editorconfig property for a given ASTNode. When implementing this interface, the value editorConfigProperties needs to be overridden. Previously it was not checked whether a retrieved property was actually recorded in this list. Now, retrieval of unregistered properties results in an exception.

    ๐Ÿ‘• Property Ktlint.DISABLED has been removed. The property value can now be retrieved as follows:

    astNode
        .getEditorConfigValue(DefaultEditorConfigProperties.disabledRulesProperty)
        .split(",")
    

    and be supplied via the ExperimentalParams as follows:

    ExperimentalParams(
        ...
        editorConfigOverride =  EditorConfigOverride.from(
          DefaultEditorConfigProperties.disabledRulesProperty to "some-rule-id,experimental:some-other-rule-id"
        )
        ...
    )
    

    ๐Ÿ‘‰ Property Ktlint.ANDROID_USER_DATA_KEY has been removed. The property value can now be retrieved as follows:

    astNode
        .getEditorConfigValue(DefaultEditorConfigProperties.codeStyleProperty)
    

    and be supplied via the ExperimentalParams as follows:

    ExperimentalParams(
        ...
        editorConfigOverride =  EditorConfigOverride.from(
          DefaultEditorConfigProperties.codeStyleProperty to "android" 
        )
        ...
    )
    

    ๐Ÿ’… This property defaults to the official Kotlin code style when not set.

    ๐Ÿ‘• Testing KtLint rules

    ๐Ÿ’… An AssertJ style API for testing KtLint rules (#1444) has been added. Usage of this API is encouraged in favor of using the old RuleExtension API. For more information, see KtLintAssertThat API

    โž• Added

    • โž• Add experimental rule for unexpected spacing between function name and opening parenthesis (spacing-between-function-name-and-opening-parenthesis) (#1341)
    • โž• Add experimental rule for unexpected spacing in the parameter list (parameter-list-spacing) (#1341)
    • โž• Add experimental rule for incorrect spacing around the function return type (function-return-type-spacing) (#1341)
    • โž• Add experimental rule for unexpected spaces in a nullable type (nullable-type-spacing) (#1341)
    • ๐Ÿ‘• Do not add a space after the typealias name (type-parameter-list-spacing) (#1435)
    • โž• Add experimental rule for consistent spacing before the start of the function body (function-start-of-body-spacing) (#1341)
    • ๐Ÿ‘• Suppress ktlint rules using @Suppress (more information) (#765)
    • โž• Add experimental rule for rewriting the function signature (function-signature) (#1341)

    ๐Ÿ›  Fixed

    • ๐Ÿ‘• Move disallowing blank lines in chained method calls from no-consecutive-blank-lines to new rule (no-blank-lines-in-chained-method-calls) (#1248)
    • ๐Ÿ›  Fix check of spacing in the receiver type of an anonymous function (#1440)
    • ๐Ÿ‘ Allow comment on same line as super class in class declaration wrapping (#1457)
    • ๐Ÿ‘• Respect git hooksPath setting (#1465)
    • ๐Ÿ›  Fix formatting of a property delegate with a dot-qualified-expression indent (#1340)
    • ๐Ÿ‘• Keep formatting of for-loop in sync with default IntelliJ formatter (indent) and a newline in the expression in a for-statement should not force to wrap it wrapping (#1350)
    • ๐Ÿ›  Fix indentation of property getter/setter when the property has an initializer on a separate line indent (#1335)
    • ๐Ÿ‘• When .editorconfig setting indentSize is set to value tab then return the default tab width as value for indentSize (#1485)
    • ๐Ÿ‘ Allow suppressing all rules or a list of specific rules in the entire file with @file:Suppress(...) (#1029)

    ๐Ÿ”„ Changed

    • โšก๏ธ Update Kotlin development version to 1.7.0 and Kotlin version to 1.7.0.
    • ๐Ÿš€ Update shadow plugin to 7.1.2 release
    • ๐Ÿš€ Update picocli to 4.6.3 release
    • ๐Ÿ‘• A file containing only one (non private) top level declaration (class, interface, object, type alias or function) must be named after that declaration. The name also must comply with the Pascal Case convention. The same applies to a file containing one single top level class declaration and one ore more extension functions for that class. filename (#1004)
    • ๐Ÿ‘• Promote experimental rules to standard rules set: annotation, annotation-spacing, argument-list-wrapping, double-colon-spacing, enum-entry-name-case, multiline-if-else, no-empty-first-line-in-method-block, package-name, traling-comma, spacing-around-angle-brackets, spacing-between-declarations-with-annotations, spacing-between-declarations-with-comments, unary-op-spacing (#1481)
    • The CLI parameter --android can be omitted when the .editorconfig property ktlint_code_style = android is defined
  • v0.45.2 Changes

    April 06, 2022

    ๐Ÿ›  Fixed

    ๐Ÿ”„ Changed

    • Set Kotlin development version to 1.6.20 and Kotlin version to 1.6.20.
  • v0.45.1 Changes

    March 21, 2022

    ๐Ÿš€ Minor release to fix a breaking issue with ktlint API consumers

    ๐Ÿ›  Fixed

    • โœ‚ Remove logback dependency from ktlint-core module (#1421)
  • v0.45.0 Changes

    March 18, 2022

    API Changes & RuleSet providers

    ๐Ÿš€ If you are not an API user nor a RuleSet provider, then you can safely skip this section. Otherwise, please read below carefully and upgrade your usage of ktlint. In this and coming releases, we are changing and adapting important parts of our API in order to increase maintainability and flexibility for future changes. Please avoid skipping a releases as that will make it harder to migrate.

    Retrieving ".editorconfig" property value

    This section is applicable when providing rules that depend on one or more values of ".editorconfig" properties. Property values should no longer be retrieved via EditConfig or directly via userData[EDITOR_CONFIG_USER_DATA_KEY]. Property values should now only be retrieved using method ASTNode.getEditorConfigValue(editorConfigProperty) of interface UsesEditorConfigProperties which is provided in this release. Starting from next release after the current release, the EditConfig and/or userData[EDITOR_CONFIG_USER_DATA_KEY] may be removed without further notice which will break your API or rule. To prevent disruption of your end user, you should migrate a.s.a.p.

    โž• Added

    • โž• Add experimental rule for unexpected spaces in a type reference before a function identifier (function-type-reference-spacing) (#1341)
    • โž• Add experimental rule for incorrect spacing after a type parameter list (type-parameter-list-spacing) (#1366)
    • โž• Add experimental rule to detect discouraged comment locations (discouraged-comment-location) (#1365)
    • โž• Add rule to check spacing after fun keyword (fun-keyword-spacing) (#1362)
    • โž• Add experimental rules for unnecessary spacing between modifiers in and after the last modifier in a modifier list (#1361)
    • ๐Ÿ†• New experimental rule for aligning the initial stars in a block comment when present (experimental:block-comment-initial-star-alignment (#297)
    • Respect .editorconfig property ij_kotlin_packages_to_use_import_on_demand (no-wildcard-imports) (#1272)
    • โž• Add new experimental rules for wrapping of block comment (comment-wrapping) (#1403)
    • โž• Add new experimental rules for wrapping of KDoc comment (kdoc-wrapping) (#1403)
    • โž• Add experimental rule for incorrect spacing after a type parameter list (type-parameter-list-spacing) (#1366)
    • โœ… Expand check task to run tests on JDK 17 - "testOnJdk17"

    ๐Ÿ›  Fixed

    • ๐Ÿ›  Fix lint message to "Unnecessary long whitespace" (no-multi-spaces) (#1394)
    • ๐Ÿ‘• Do not remove trailing comma after a parameter of type array in an annotation (experimental:trailing-comma) (#1379)
    • ๐Ÿ‘• Do not delete blank lines in KDoc (no-trailing-spaces) (#1376)
    • ๐Ÿ‘• Do not indent raw string literals that are not followed by either trimIndent() or trimMargin() (indent) (#1375)
    • ๐Ÿ‘• Revert remove unnecessary wildcard imports as introduced in Ktlint 0.43.0 (no-unused-imports) (#1277), (#1393), (#1256)
    • ๐Ÿ‘• (Possibly) resolve memory leak (#1216)
    • ๐ŸŽ‰ Initialize loglevel in Main class after parsing the CLI parameters (#1412)

    ๐Ÿ”„ Changed

    • ๐Ÿ‘• Print the rule id always in the PlainReporter (#1121)
    • ๐Ÿ‘• All wrapping logic is moved from the indent rule to the new rule wrapping (as part of the standard ruleset). In case you currently have disabled the indent rule, you may want to reconsider whether this is still necessary or that you also want to disable the new wrapping rule to keep the status quo. Both rules can be run independent of each other. (#835)

    โœ‚ Removed

  • v0.44.0 Changes

    February 15, 2022

    ๐Ÿ‘• Please welcome paul-dingemans as an official maintainer of ktlint!

    โž• Added

    • ๐Ÿ‘‰ Use Gradle JVM toolchain with language version 8 to compile the project
    • ๐Ÿ‘• Basic tests for CLI (#540)
    • โž• Add experimental rule for unnecessary parentheses in function call followed by lambda (#1068)

    ๐Ÿ›  Fixed

    • ๐Ÿ›  Fix indentation of function literal (#1247)
    • ๐Ÿ›  Fix false positive in rule spacing-between-declarations-with-annotations (#1281)
    • ๐Ÿ‘• Do not remove imports for same class when different alias is used (#1243)
    • ๐Ÿ›  Fix NoSuchElementException for property accessor (trailing-comma) (#1280)
    • ๐Ÿ›  Fix ClassCastException using ktlintFormat on class with KDoc (no-trailing-spaces) (#1270)
    • ๐Ÿ‘• Do not remove trailing comma in annotation (#1297)
    • ๐Ÿ‘• Do not remove import which is used as markdown link in KDoc only (no-unused-imports) (#1282)
    • ๐Ÿ›  Fix indentation of secondary constructor (indent) (#1222)
    • ๐Ÿ‘• Custom gradle tasks with custom ruleset results in warning (#1269)
    • ๐Ÿ›  Fix alignment of arrow when trailing comma is missing in when entry (trailing-comma) (#1312)
    • ๐Ÿ›  Fix indent of delegated super type entry (indent) (#1210)
    • ๐Ÿ‘Œ Improve indentation of closing quotes of a multiline raw string literal (indent) (#1262)
    • ๐Ÿ‘• Trailing space should not lead to delete of indent of next line (no-trailing-spaces) (#1334)
    • ๐Ÿ‘• Force a single line function type inside a nullable type to a separate line when the max line length is exceeded (parameter-list-wrapping) (#1255)
    • ๐Ÿ‘• A single line function with a parameter having a lambda as default argument does not throw error (indent) (#1330)
    • ๐Ÿ›  Fix executable jar on Java 16+ (#1195)
    • ๐Ÿ›  Fix false positive unused import after autocorrecting a trailing comma (#1367)
    • ๐Ÿ›  Fix false positive indentation (parameter-list-wrapping, argument-list-wrapping) (#897, #1045, #1119, #1255, #1267, #1319, #1320, #1337
    • ๐Ÿ‘• Force a single line function type inside a nullable type to a separate line when the max line length is exceeded (parameter-list-wrapping) (#1255)

    ๐Ÿ”„ Changed

    • ๐Ÿš€ Update Kotlin version to 1.6.0 release
    • โž• Add separate tasks to run tests on JDK 11 - "testOnJdk11"
    • ๐Ÿš€ Update Dokka to 1.6.0 release
    • ๐Ÿ‘• Apply ktlint experimental rules on the ktlint code base itself.
    • ๐Ÿš€ Update shadow plugin to 7.1.1 release
    • โž• Add Kotlin-logging backed by logback as logging framework (#589)
    • โšก๏ธ Update Gradle to 7.4 version
  • v0.43.2 Changes

    December 01, 2021

    ๐Ÿ›  Fixed

    • ๐Ÿ‘• KtLint CLI 0.43 doesn't work with JDK 1.8 (#1271)
  • v0.43.0 Changes

    November 02, 2021

    โž• Added

    • ๐Ÿ†• New trailing-comma rule (#709) (prior art by paul-dingemans) ### ๐Ÿ›  Fixed
    • ๐Ÿ›  Fix false positive with lambda argument and call chain (indent) (#1202)
    • ๐Ÿ›  Fix trailing spaces not formatted inside block comments (no-trailing-spaces) (#1197)
    • ๐Ÿ‘• Do not check for .idea folder presence when using applyToIDEA globally (#1186)
    • โœ‚ Remove spaces before primary constructor (paren-spacing) (#1207)
    • ๐Ÿ›  Fix false positive for delegated properties with a lambda argument (indent) (#1210)
    • ๐Ÿ‘• (REVERTED in Ktlint 0.45.0) Remove unnecessary wildcard imports (no-unused-imports) (#1256)
    • ๐Ÿ›  Fix indentation of KDoc comment when using tab indentation style (indent) (#850) ### ๐Ÿ”„ Changed
    • ๐Ÿ‘Œ Support absolute paths for globs (#1131)
    • ๐Ÿ›  Fix regression from 0.41 with argument list wrapping after dot qualified expression (argument-list-wrapping)(#1159)
    • โšก๏ธ Update Gradle to 7.2 version
    • โšก๏ธ Update Gradle shadow plugin to 7.1 version
    • โšก๏ธ Update Kotlin version to 1.5.31 version. Default Kotlin API version was changed to 1.4!
  • v0.42.1 Changes

    August 06, 2021

    ๐Ÿš€ Dot release to fix regressions in indent rule introduced in 0.42.0 release. Thanks to t-kameyama for the fixes!

    ๐Ÿ›  Fixed

    • ๐Ÿ›  Fix false positive with delegated properties (indent) (#1189)
    • ๐Ÿ›  Fix false positive with lambda argument in super type entry (indent) (#1188)
  • v0.42.0 Changes

    July 29, 2021

    ๐Ÿš€ Thank you to the following contributors for this release:

    โž• Added

    • ๐Ÿ‘• SARIF output support (#1102)

    ๐Ÿ›  Fixed

    • โœ‚ Remove needless blank lines in dot qualified expression (#1077)
    • ๐Ÿ›  Fix false positives for SpacingBetweenDeclarationsWithAnnotationsRule (#1125)
    • ๐Ÿ›  Fix false positive with eol comment (annotation-spacing) (#1124)
    • ๐Ÿ›  Fix KtLint dependency variant selection (#1114)
    • ๐Ÿ›  Fix false positive with 'by lazy {}' (indent) (#1162)
    • ๐Ÿ›  Fix false positive with value argument list has lambda (indent) (#764)
    • ๐Ÿ›  Fix false positive in lambda in dot qualified expression (argument-list-wrapping) (#1112)
    • ๐Ÿ›  Fix false positive with multiline expression with elvis operator in assignment (indent) (#1165)
    • ๐Ÿ‘• Ignore backticks in imports for ordering purposes (import-ordering) (#1106)
    • ๐Ÿ›  Fix false positive with elvis operator and comment (chain-wrapping) (#1055)
    • ๐Ÿ›  Fix false negative in when conditions (chain-wrapping) (#1130)
    • ๐Ÿ›  Fix the Html reporter Chinese garbled (#1140)
    • ๐ŸŽ Performance regression introduced in 0.41.0 (#1135)

    ๐Ÿ”„ Changed

    • โšก๏ธ Updated to dokka 1.4.32 (#1148)
    • โšก๏ธ Updated Kotlin to 1.5.20 version