All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.
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.
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.
- 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
propertyij_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)
- 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)
- Print the rule id always in the PlainReporter (#1121)
- All wrapping logic is moved from the
indent
rule to the new rulewrapping
(as part of thestandard
ruleset). In case you currently have disabled theindent
rule, you may want to reconsider whether this is still necessary or that you also want to disable the newwrapping
rule to keep the status quo. Both rules can be run independent of each other. (#835)
0.44.0 - 2022-02-15
Please welcome paul-dingemans as an official maintainer of ktlint!
- 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)
- 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)
- 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
0.43.2 - 2021-12-01
- KtLint CLI 0.43 doesn't work with JDK 1.8 (#1271)
0.43.0 - 2021-11-02
- New
trailing-comma
rule (#709) (prior art by paul-dingemans)
- 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 usingapplyToIDEA
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)
- 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 to1.4
!
0.42.1 - 2021-08-06
Dot release to fix regressions in indent
rule introduced in 0.42.0 release. Thanks to t-kameyama for the fixes!
- Fix false positive with delegated properties (
indent
) (#1189) - Fix false positive with lambda argument in super type entry (
indent
) (#1188)
0.42.0 - 2021-07-29
Thank you to the following contributors for this release:
- SARIF output support (#1102)
- 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)
- Updated to dokka 1.4.32 (#1148)
- Updated Kotlin to 1.5.20 version
0.41.0 - 2021-03-16
Note: This release contains breaking changes to globs passed to ktlint via the command line. See (#999) and the README.
Thank you to t-kameyama and paul-dingemans for your contributions to this release!
- New
ktlint_ignore_back_ticked_identifier
EditorConfig option formax-line-length
rule to ignore long method names inside backticks (primarily used in tests) (#1007) - Allow to add/replace loaded
.editorconfig
values viaExperimentalParams#editorConfigOverride
(#1016) ReporterProvider
,LintError
,RuleSetProvider
now implementSerializable
interface
- Incorrect indentation with multiple interfaces (#1003)
- Empty line before primary constructor is not reported and formatted-out (#1004)
- Fix '.editorconfig' generation for "import-ordering" rule (#1011)
- Fix "filename" rule will not work when '.editorconfig' file is not found (#997)
- EditorConfig generation for
import-ordering
(#1011) - Internal error (
no-unused-imports
) (#996) - Fix false positive when argument list is after multiline dot-qualified expression (
argument-list-wrapping
) (#893) - Fix indentation for function types after a newline (
indent
) (#918) - Don't remove the equals sign for a default argument (
no-line-break-before-assignment
) (#1039) - Fix internal error in
no-unused-imports
(#1040) - Fix false positives when declaration has tail comments (
spacing-between-declarations-with-comments
) (#1053) - Fix false positive after
else
keyword (argument-list-wrapping
) (#1047) - Fix formatting with comments (
colon-spacing
) (#1057) - Fix IndexOutOfBoundsException in
argument-list-wrapping-rule
formatting file with many corrections (#1081) - Fix formatting in arguments (
multiline-if-else
) (#1079) - Fix experimental:annotation-spacing-rule autocorrection with comments
- Migrate from klob dependency and fix negated globs passed to CLI are no longer worked (#999) Breaking: absolute paths globs will no longer work, check updated README
- Update Gradle shadow plugin to
6.1.0
version - Align with Kotlin plugin on how alias pattern is represented for imports layout rule (#753)
- Align with Kotlin plugin on how subpackages are represented (#753)
- Deprecated custom
kotlin_imports_layout
EditorConfig property. Please useij_kotlin_imports_layout
to ensure that the Kotlin IDE plugin and ktlint use same imports layout (#753) - Deprecated
idea
andascii
shortcuts as theij_kotlin_imports_layout
property does not support those. Please check README on how to achieve those with patterns (#753) - Update Gradle to
6.8.3
version - Update Kotlin to
1.4.31
version. Fixes #1063.
0.40.0 - 2020-12-04
Special thanks to t-kameyama for the huge number of bugfixes in this release!
- Initial implementation IDE integration via '.editorconfig' based on rules default values (#701)
- CLI subcommand
generateEditorConfig
to generate '.editorconfig' content for Kotlin files (#701) - A new capability to generate baseline and run ktlint against it with
--baseline
cli option (#707)
- Do not report when semicolon is before annotation/comment/kdoc and lambda (#825)
- Fix false positive when import directive has backticks and alias (#910)
@receiver
annotations with parameters are not required to be on a separate line (#885)- Fix false positive "File annotations should be separated from file contents with a blank line" in kts files (#914)
- Fix false positive
Missing newline after "->"
whenwhen
entry has a nested if/else block (#901) - Allow an inline block comment in
argument-list-wrapping
(#926) - Fix false positive for line-breaks inside lambdas in
argument-list-wrapping
(#861) (#870) - Fix wrong indentation inside an if-condition in
argument-list-wrapping
(#854) (#864) - Fix false positive for method after string template in
argument-list-wrapping
(#842) (#859) - Fix false positive when a comment is not between declarations in
spacing-between-declarations-with-comments
(#865) - Fix formatting with comments (
multiline-if-else
) (#944) - Do not insert unnecessary spacings inside multiline if-else condition (
indent
) (#871) (#900) - Correctly indent primary constructor parameters when class has multiline type parameter (
parameter-list-wrapping
) (#921) (#938) - Correctly indent property delegates (
indent
) (#939) - Fix false positive for semicolon between empty enum entry and member (
no-semicolons
) (#957) - Fix wrong indentation for class delegates (
indent
) (#960) (#963) (#877) - Fix wrong indentation in named arguments (
indent
) (#964) - Fix wrong indentation when a function has multiline type arguments (
parameter-list-wrapping
) (#965) - Fix false positive for
spacing-between-declarations-with-annotations
(#970) - Fix ParseException when an assigment contains comments (
no-line-break-before-assignment
) (#956) - Fix false positive when right brace is after a try-catch block (
spacing-around-keyword
) (#978) - Fix false positive for control flow with empty body (
no-semicolons
) (#955) - Fix incorrect indentation for multi-line call expressions in conditions (
indent
) (#959) - Fix false positive for trailing comma before right parentheses|bracket|angle (
spacing-around-comma
) (#975) - Fix ktlint CLI could skip checking some of explicetly passed files (#942)
- 'import-ordering' now supports `.editorconfig' default value generation (#701)
- Update Gradle to
6.7.1
version
0.39.0 - 2020-09-14
- Add new applyToIDEA location for IDEA 2020.1.x and above on MacOs
- Debug output: print loaded .editorconfig content
- Extract
argument-list-wrapping
rule into experimental ruleset - Split
annotation-spacing
into separate experimental rule
- Do not enforce raw strings opening quote to be on a separate line (#711)
- False negative with multiline type parameter list in function signature for
parameter-list-wrapping
(#680) - Alternative
.editorconfig
path is ignored on stdin input (#869) - False positive with semicolons before annotations/comments/kdoc (#825)
- Do not report when string-template expression is a keyword (#883)
- False positive for subclass imports in
no-unused-imports
(#845) - False positive for static java function imports in
no-unused-imports
(#872) - Missing signature for KtLint CLI artifact published to Github release (#895)
- Crash in annotation rule (#868)
- False-positive unused import violation (#902)
Ktlint
object internal code cleanup- Deprecate some of public methods in
Ktlint
object that should not be exposed as public api - Update Kotlin to 1.4.10 version
- Make
RuleSet
class open so it can be inherited
0.38.1 - 2020-08-24
Minor release to support projects using mixed 1.3/1.4 Kotlin versions (e.g. Gradle plugins)
- Compile with
apiLevel = 1.3
0.38.0 - 2020-08-21
New release with Kotlin 1.4.0 support and several enhancements and bugfixes.
- Experimental SpacingAroundAngleBracketsRule (#769)
- Checksum generation for executable Jar (#695)
- Enable Gradle dependency verification
parameter-list-wrapping
rule now also considers function arguments while wrapping (#620)- Publish snapshots built against kotlin development versions
- Initial support for tab-based indentation (#128)
- Safe-called wrapped trailing lambdas indented correctly (#776)
provideDelegate
imports are not marked as unused anymore (#669)- Set continuation indent to 4 in IDE integration codestyle (#775)
- No empty lines between annotation and annotated target (#688)
- Unused imports reported correctly (#526) (#405)
- No false empty lines inserted in multiline if-else block (#793)
- No-wildcard-imports properly handles custom infix function with asterisk (#799)
- Do not require else to be in the same line of a right brace if the right brace is not part of the if statement (#756)
- Brace-less if-else bodies starting with parens indented correctly (#829)
- If-condition with multiline call expression inside indented correctly (#796)
- Update Gradle to 6.6 version
- Update ec4j to 0.2.2 version. Now it should report path to
.editorconfig
file on failed parsing and allow empty.editorconfig
files. - Update Kotlin to 1.4.0 version (#830)
0.37.2 - 2020-06-16
Minor release to fix further bugs in ImportOrderingRule
.
- Imports with aliases no longer removed (#766)
0.37.1 - 2020-06-08
Minor release to fix some bugs in the 0.37.0 release.
- Invalid path exception error on Windows machines when loading properties from .editorconfig (#761)
- Imports with
as
no longer removed (#766) - The contents of raw strings are no longer modified by the indent rule (#682)
0.37.0 - 2020-06-02
Thank you to Tapchicoma and romtsn for all their hard work on this release!
- Gradle wrapper validation (#684)
- Experimental
SpacingAroundDoubleColon
rule (#722] - Experimental
SpacingBetweenDeclarationsWithCommentsRule
andSpacingBetweenDeclarationsWithAnnotationsRule
. Fixes ([#721]pinterest#721) kotlin_imports_layout
config for.editorconfig
file so that import ordering is configurable. Fixes (#527)
- Kotlin was updated to 1.3.70 version
- Loading properties from
.editorconfig
was fully delegated to ec4j library. This fixes ability to override properties for specific files/directories (#742) - Promote experimental "indent" rule to standard one, old standard "indent" rule is removed
- Functions to calculate line/column are now public so they can be used by 3rd party tools (#725)
AnnotationRule
now handles file annotations as well (#714)
- Ignore keywords in KDoc comments (#671)
- Allow multiple spaces in KDoc comments (#706)
- Trailing comment no longer reported as incorrect indentation (#710]
- Annotated function types no longer reported as an error (#737)
FinalNewlineRule
no longer reports error for empty files (#723)- EOL comments will no longer cause
AnnotationRule
to report an error (#736) - Formatter will no longer break class declaration with trailing comment (#728)
- Formatting for single line if/else statements (#174)
- Exception in
NoLineBreakBeforeAssignmentRule
(#693)
- Removed Maven; builds all run under Gradle (#445)
- Old standard
IndentRule
0.36.0 - 2019-12-03
- HTML reporter (#641)
- Experimental rule to lint enum entry names (#638)
@Suppress("RemoveCurlyBracesFromTemplate")
now respected (#263)
.git
directory now discovered instead of hardcoded (#623)- Several bugs with the experimental annotation rule (#628) (#642) (#654) (#624)
- Allow newline after lambda return type (#643)
- Allow empty first line in a function that returns an anonymous object (#655)
- Indentation with lambda argument (#627)
- ktlint can now lint UTF-8 files with BOM (#630
- Indentation with newline before return type (#663)
- Build/tests on Windows (#640)
- Allow whitespace after
(
followed by a comment (#664)
0.35.0 - 2019-10-12
- Support for specifying color for output via
--color-name
command line flag. (#585) - Support for custom rulesets and providers on Java 9+ (#573)
--apply-to-idea
flag; useapplyToIDEA
subcommand instead (#554)--apply-to-idea-project
flag; useapplyToIDEAProject
subcommand instead (#593)0.0.0-SNAPSHOT
builds; snapshot builds are now versioned, e.g. 0.35.0-SNAPSHOT (#588)- Note: When using the new snapshot builds, you may need to add an explicit dependency on
kotlin-compiler-embeddable
to your ruleset project.
- Note: When using the new snapshot builds, you may need to add an explicit dependency on
- Support for loading 3rd party rulesets via Maven (#566)
- Bugs with spacing in experimental
AnnotationRule
(#552) (#601 - Brackets would be removed from empty companion object (#600)
- Bugs with experimental
IndentationRule
(#597) (#599) - Erroneous space between
}
and]
(#596) - Spacing around multiplication sign in lambdas (#598)
--version
output with gradle-built JAR (#613)
0.34.2 - 2019-07-22
Minor bugfix release for 0.34.0. (Note: 0.34.1 deprecated/deleted due to regression in disabled_flags .editorconfig support.)
- Support for globally disabling rules via
--disabled_rules
command line flag. (#534)
- Regression with
--stdin
flag forprintAST
command (#528) - Regressions with
NoUnusedImports
rule (#531, #526)- Note: this re-introduces #405
- Indentation for enums with multi-line initializers (#518)
0.34.0 - 2019-07-15
- Support for Kotlin 1.3.41
- Support for globally disabling rules via custom
disabled_rules
property in.editorconfig
(#503) experimental:no-empty-first-line-in-method-block
(#474)- Unit tests for ruleset providers
- AssertJ from 3.9.0 to 3.12.2 (#520)
- Final newline by default (#446)
no-wildcard-import
(Re-enabled after temporarily disabling in 0.33.0)experimental:annotation
(#509)experimental:multiline-if-else
(no autocorrection)experimental:package-name
(currently only disallows underscores in package names)
MavenDependencyResolver
. Scheduled to be removed in 0.35.0 (#468)--install-git-pre-commit-hook
flag; useinstallGitPreCommitHook
subcommand instead (#487)--print-ast
flag; useprintAST
subcommand instead (#500)
- Support for
--ruleset-repository
and--ruleset-update
flags
import-ordering
will now refuse to format import lists that contain top-level comments (#408)no-unused-imports
reporting false negatives or false positives in some cases (#405) and (#506)experimental:indent
incorrectly formatting a lambda's closing brace (#479)
0.33.0 - 2019-05-28
- Support for Kotlin 1.3.31
- No wildcard imports rule (#48). Developers wishing to still enforce this rule should add the code into a custom ruleset.
- Spec file parsing is now platform-agnostic (#365)
- Unnecessary newline after
->
in some cases (#403) SpacingAroundCommaRule
will no longer move code into comments- Made newlines after
=
less aggressive (#368) (#380) - Erroneous newline when parameter comments are used (#433)
0.32.0 - 2019-04-22
experimental/import-ordering
rule (#189). Usektlint --experimental
to enabled.- Support for Kotlin 1.3.30
- Build now compatible with jitpack
ktlint
now part of Homebrew core (shyiko/ktlint
tap deprecated)
- Incorrectly flagging a missing newline for functions with no parameters (#327).
- Semicolons now allowed in KDocs (#362).
- Spaces now disallowed after
super
(#369). - Annotations in function parameters now checked for indentation (#374]
- Code now lives in
com.pinterest
package - groupId now
com.pinterest
- Custom ruleset
META-INF.services
file must be renamed tocom.pinterest.ktlint.core.RuleSetProvider
0.31.0 - 2019-03-10
- Spacing check around
<
&>
operators.
no-multi-spaces
rule (horizontal alignment of comments is no longer allowed) (#269).colon-spacing
rule (:
must not appear at the beginning of the line).package-name
rule (disabled until #208 is resolved).--print-ast
to output com.pinterest.ktlint.core.ast.ElementType.* asnode.elementType
, e.g.
$ echo 'fun f() {}' | ./ktlint/target/ktlint --print-ast --color --stdin
1: ~.psi.KtFile (FILE)
1: ~.psi.KtPackageDirective (PACKAGE_DIRECTIVE) ""
1: ~.psi.KtImportList (IMPORT_LIST) ""
1: ~.psi.KtScript (SCRIPT)
1: ~.psi.KtBlockExpression (BLOCK)
1: ~.psi.KtNamedFunction (FUN)
1: ~.c.i.p.impl.source.tree.LeafPsiElement (FUN_KEYWORD) "fun"
1: ~.c.i.p.impl.source.tree.PsiWhiteSpaceImpl (WHITE_SPACE) " "
1: ~.c.i.p.impl.source.tree.LeafPsiElement (IDENTIFIER) "f"
1: ~.psi.KtParameterList (VALUE_PARAMETER_LIST)
1: ~.c.i.p.impl.source.tree.LeafPsiElement (LPAR) "("
1: ~.c.i.p.impl.source.tree.LeafPsiElement (RPAR) ")"
1: ~.c.i.p.impl.source.tree.PsiWhiteSpaceImpl (WHITE_SPACE) " "
1: ~.psi.KtBlockExpression (BLOCK)
1: ~.c.i.p.impl.source.tree.LeafPsiElement (LBRACE) "{"
1: ~.c.i.p.impl.source.tree.LeafPsiElement (RBRACE) "}"
1: ~.c.i.p.impl.source.tree.PsiWhiteSpaceImpl (WHITE_SPACE) "\n"
format: <line_number:> <node.psi::class> (<node.elementType>) "<node.text>"
legend: ~ = org.jetbrains.kotlin, c.i.p = com.intellij.psi
kotlin-compiler
version to 1.3.21 (from 1.3.20).
- Dependency on JCenter (#349).
0.30.0 - 2019-02-03
Missing newline before ")"
(#327).
kotlin-compiler
version to 1.3.20 (from 1.2.71) (#331).
--ruleset
/--reporter
switched to HTTPS (#332).
0.29.0 - 2018-10-02
no-semi
rule to preserve semicolon aftercompanion object;
(see #281 for details).- "line number off by one" when
end_of_line=CRLF
is used (#286).
package-name
rule not to check file location (until #280 can be properly addressed).comment-spacing
rule not to flag//region
&//endregion
comments (#278).kotlin-compiler
version to 1.2.71 (from 1.2.51).
0.28.0 - 2018-09-05
- ktlint hanging in case of unhandled exception in a reporter (#277).
package-name
rule (directories containing.
in their names are no longer considered to be invalid) (#276).
0.27.0 - 2018-08-06
- ktlint output (report location is now printed only if there are style violations) (#267).
0.26.0 - 2018-07-30
max-line-length
rule (multi-line strings are no longer checked) (#262).
0.25.1 - 2018-07-25
json
reporter \ and control characters escaping (#256).
0.25.0 - 2018-07-25
package-name
rule (#246).--editorconfig=path/to/.editorconfig
(#250).- Support for
end_of_line=native
(.editorconfig
) (#225). tab -> space * indent_size
auto-correction (--format
/-F
).
- "Unnecessary semicolon" false positive (#255).
(cannot be auto-corrected)
reporting.- OOM in
--debug
mode while trying to printroot=true <- root=false
.editorconfig
chain.
kotlin-compiler
version to 1.2.51 (from 1.2.50).
0.24.0 - 2018-06-22
paren-spacing
rule (#223).- Report location output (#218, #224).
- An indication that some lint errors cannot be auto-corrected (#219).
- Git hook to automatically check files for style violations on push (an alternative to existing
ktlint --install-git-pre-commit-hook
)
(executektlint --install-git-pre-push-hook
to install) (#229). - Support for
end_of_line=crlf
(.editorconfig
) (#225).
.editorconfig
path resolution
(you no longer need to be inside project directory for.editorconfig
to be loaded) (#207).- NPE in case of I/O error ([email protected]).
comment-spacing
rule to exclude//noinspection
(#212).kotlin-compiler
version to 1.2.50 (from 1.2.41) (#226).
0.23.1 - 2018-05-04
ClassCastException: cannot be cast to LeafPsiElement
(#205).
0.23.0 - 2018-05-02
comment-spacing
(#198),
filename
(#194) rules.parameter-list-wrapping
left parenthesis placement check (#201).parameter-list-wrapping
auto-correction whenmax_line_length
is exceeded (#200).
- "Unused import" false positive (x.y.zNNN import inside x.y.z package) (#204).
kotlin-compiler
version to 1.2.41 (from 1.2.40).
0.22.0 - 2018-04-22
--apply-to-idea-project
(as an alternative to (global)--apply-to-idea
) (#178).- Check to verify that annotations are placed before the modifiers (#183).
- Access to PsiFile location information (#194).
--format
commenting out operators (chain-wrapping
rule) (#193).
indent
rule (continuation_indent_size
is now ignored) (#171).
NOTE: if you have a customcontinuation_indent_size
(andgcd(indent_size, continuation_indent_size) == 1
) ktlint won't check the indentation.--apply-to-idea
to inherit "Predefined style / Kotlin style guide" (Kotlin plugin 1.2.20+).kotlin-compiler
version to 1.2.40 (from 1.2.30).
0.21.0 - 2018-03-29
indent
rule to ignorewhere <type constraint list>
clause (#180).
0.20.0 - 2018-03-20
- Ability to load 3rd party reporters from the command-line (e.g.
--reporter=<name>,artifact=<group_id>:<artifact_id>:<version>
) (#176). --ruleset
/--reporter
dependency tree validation.
- Handling of spaces in
--reporter=...,output=<path_to_a_file>
(#177). +
,-
,*
,/
,%
,&&
,||
wrapping (#168).
comma-spacing
rule to be more strict (#173).no-line-break-after-else
rule to allow multi-lineif/else
without curly braces.
0.19.0 - 2018-03-04
- Lambda formatting: if lambda is assigned a label, there should be no space between the label and the opening curly brace (#167).
0.18.0 - 2018-03-01
- Java 9 support (#152).
kotlin-compiler
version to 1.2.30 (from 1.2.20).
0.17.1 - 2018-02-28
Internal Error (parameter-list-wrapping)
whenindent_size=unset
(#165).
0.17.0 - 2018-02-28
+
/-
wrapping insidecatch
block, afterelse
andif (..)
(#160).- Multi-line parameter declaration indentation (#161).
- Expected indentation reported by
indent
rule.
- Error code returned by
ktlint --format/-F
when some of the errors cannot be auto-corrected (previously it was 0 instead of expected 1) (#162).
0.16.1 - 2018-02-27
- Handling of negative number condition in
when
block (#160).
0.16.0 - 2018-02-27
parameter-list-wrapping
rule (#130).+
,-
,*
,/
,%
,&&
,||
wrapping check (now part ofchain-wrapping
rule).
- Unused
componentN
import (where N > 5) false positive (#142). - max-line-length error suppression (#158).
modifier-order
rule to match official Kotlin Coding Conventions (#146)
(override
modifier should be placed beforesuspend
/tailrec
, not after)
0.15.1 - 2018-02-14
- Race condition when multiple rules try to modify AST node that gets detached as a result of mutation (#154).
0.15.0 - 2018-01-18
no-line-break-after-else
rule (#125).
kotlin-compiler
version to 1.2.20 (from 1.2.0).
0.14.0 - 2017-11-30
continuation_indent_size
to 4 when--android
profile is used (android/kotlin-guides#37).
- Maven integration (#117).
0.13.0 - 2017-11-28
no-line-break-before-assignment
(#105),
chain-wrapping
(#23) (when wrapping chained calls.
,?.
and?:
should be placed on the next line),
range-spacing
(no spaces around range (..
) operator) rules.--print-ast
CLI option which can be used to dump AST of the file
(see README / Creating a ruleset / AST for more details)--color
CLI option for colored output (where supported, e.g. --print-ast, default (plain) reporter, etc)
.editorconfig
property resolution.
An explicit[*.{kt,kts}]
is not required anymore (ktlint looks for sections containing*.kt
(or*.kts
) and will fallback to[*]
whenever property cannot be found elsewhere).
Also, a search for .editorconfig will no longer stop on first (closest).editorconfig
(unless it containsroot=true
).max-line-length
rule to assumemax_line_length=100
whenktlint --android ...
is used
(per Android Kotlin Style Guide).kotlin-compiler
version to 1.2.0 (from 1.1.51).
no-empty-class-body
auto-correction at the end of file (#109).max-line-length
rule when applied to KDoc (#112)
(previously KDoc was subject tomax-line-length
even though regular comments were not).- Spacing around
=
in @annotation|s (op-spacing
). - Spacing around generic type parameters of functions (e.g.
fun <T>f(): T {}
->fun <T> f(): T {}
). no-consecutive-blank-lines
not triggering at the end of file (when exactly 2 blank lines are present) (#108)indent
continuation_indent_size % indent_size != 0
case (#76)indent
rule skipping first parameter indentation check.final-newline
rule in the context of kotlin script.- Git hook (previously files containing space character (among others) in their names were ignored)
- Exit code when file cannot be linted due to the invalid syntax or internal error.
0.12.1 - 2017-11-13
- A conflict between
org.eclipse.aether:aether-*:1.1.0
andorg.eclipse.aether:aether-*:1.0.0.v20140518
(#100).
0.12.0 - 2017-11-10
--android
(-a
) CLI option (turns on Android Kotlin Style Guide compatibility)
(right now it's used only byktlint --apply-to-idea
).
ktlint --apply-to-idea
to account forindent_size
&continuation_indent_size
in.editorconfig
(if any).
ktlint-intellij-idea-integration
binary (deprecated in 0.9.0).
- "Unused import" false positive (
component1
..component5
).
0.11.1 - 2017-10-26
--reporter
'soutput
handling (previously parent directory was expected to exist) (#97).
0.11.0 - 2017-10-25
no-blank-line-before-rbrace
rule (#65).
- Redundant space inserted between
}
and::
(curly-spacing).
0.10.2 - 2017-10-25 [YANKED]
This release contains changes that were meant for 0.11.0 and so it was retagged as such.
0.10.1 - 2017-10-22
- Redundant space inserted between
}
and[key]
/(...)
(curly-spacing) (#91).
0.10.0 - 2017-10-10
- Git hook to automatically check files for style violations on commit
(executektlint --install-git-pre-commit-hook
to install). - Ability to specify multiple reporters
(output can be controlled with--reporter=<name>,output=<path/to/file>
) (#71). - Support for
indent_size=unset
(.editorconfig
) (#70).
( {
formatting
(previously both( {
and({
were accepted as correct, while only({
should be) (curly-spacing
rule) (#80).if\nfn {}\nelse
formatting (curly-spacing
rule).max_line_length=off
&max_line_length=unset
handling (.editorconfig
).
kotlin-compiler
version to 1.1.51 (from 1.1.3-2).ktlint --apply-to-idea
to includeOPTIMIZE_IMPORTS_ON_THE_FLY=true
.
0.9.2 - 2017-09-01
: Unit =
formatting (: Unit
is no longer dropped when=
is used) (#77).
0.9.1 - 2017-07-30
${super.toString()}
linting (string-template
rule) (#69).
0.9.0 - 2017-07-23
- Reporter API.
ktlint
comes with 3 built-in reporters:plain
(default;?group_by_file
can be appended to enable grouping by file (shown below)),json
andcheckstyle
.
$ ktlint --reporter=plain?group_by_file
path/to/file.kt
1:10 Unused import.
2:10 Unnecessary "Unit" return type.
path/to/another-file.kt
1:10 Unnecessary semicolon.
- string-template,
no-empty-class-body,
max-line-length (#47),
final-newline (activated only ifinsert_final_newline
is set in.editorconfig
(under[*.{kt,kts}]
)) rules. --limit
CLI option (e.g. use--limit=10
to limit the number of errors to display).--relative
CLI flag which makesktlint
output file paths relative to working directory (e.g.dir/file.kt
instead of/home/269/project/dir/file.kt
).
- BREAKING: JDK version to 1.8 (as a result of upgrading
kotlin-compiler
to 1.1.3-2 (from 1.1.0)). - File matching (offloaded to klob).
--ruleset-repository
and--ruleset-update
CLI arguments in favour of--repository
and--repository-update
respectively (--ruleset-*
will be removed in 1.0.0).ktlint-intellij-idea-integration
binary
(Intellij IDEA integration task is now included inktlint
(asktlint --apply-to-idea
)).
0.8.3 - 2017-06-19
- "Missing spacing after ";"" at the end of package declaration (#59).
- "Unused import" false positive (
setValue
) (#55). get
/set
ter spacing (#56).
0.8.2 - 2017-06-06
- "Unused import" false positive (
getValue
) (#54).
0.8.1 - 2017-05-30
ktlint --stdin
(#51).
0.8.0 - 2017-05-30
- .editorconfig support (right now only
indent_size
is honored and only if it's set in[*{kt,kts}]
section). - Support for vertically aligned comments (see NoMultipleSpacesRuleTest.kt).
- ktlint-ruleset-standard ("no-unit-return" & "modifier-order" where not included).
0.7.1 - 2017-05-29
- Triggering of "Unused import" when element is referenced in KDoc(s) only (#46).
0.7.0 - 2017-05-28
- no-unit-return rule.
- modifier-order rule (#42).
else/catch/finally
on the same line as}
check (now part of "keyword-spacing" rule).ktlint-intellij-idea-integration
binary for easy Intellij IDEA config injection.
0.6.2 - 2017-05-22
- Unused "iterator" extension function import false positive (#40).
0.6.1 - 2017-03-06
- Detection of unnecessary "same package" imports (no-unused-imports).
- FileNotFoundException while scanning FS (#36).
0.6.0 - 2017-03-01
kotlin-compiler
version to 1.1.0 (from 1.1-M04).
0.5.1 - 2017-02-28
- Unnecessary spacing around angle brackets in case of
super<T>
(#34).
0.5.0 - 2017-02-20
- Redundant space inserted between
}
and!!
(curly-spacing).
indent
rule to allow "Method declaration parameters -> Align when multiline" (as this option is (unfortunately) "on" by default in Intellij IDEA) (#26).
0.4.0 - 2017-02-01
- NPE in case of "Permission denied" (while scanning the file system).
kotlin-compiler
version to 1.1-M04 (from 1.0.6).
0.3.1 - 2017-01-25
- Unused infix function call import false positive (#25).
0.3.0 - 2017-01-11
*.kts
(script) support.
kotlin-compiler
version to 1.0.6 (from 1.0.3).
0.2.2 - 2016-10-11
no-wildcard-imports
rule (kotlinx.android.synthetic excluded from check) (#16).
0.2.1 - 2016-09-13
curly-spacing
false negative in case of}?.
.
0.2.0 - 2016-09-05
- Support for 3rd party "ruleset"s.
ktlint -F
output (it now includes lint errors that cannot be fixed automatically).
ktlint -F --debug
error count.- Glob implementation (previously it was prone to catastrophic backtracking).
- Redundant semicolon false positive in case of enum (#12).
- Unused operator import false positive (#13).
0.1.2 - 2016-08-05
- "in-use" escaped imports detection (#7) (no-unused-imports).
0.1.1 - 2016-08-01
- Incorrect spacing around curly braces (curly-spacing).