All notable changes to this project will be documented in this file.
This project adheres to Semantic Versioning.
--color-name command line flag. (#585)--apply-to-idea flag; use applyToIDEA subcommand instead (#554)--apply-to-idea-project flag; use applyToIDEAProject subcommand instead (#593)0.0.0-SNAPSHOT builds; snapshot builds are now versioned, e.g. 0.35.0-SNAPSHOT (#588)kotlin-compiler-embeddable to your ruleset project.AnnotationRule (#552) (#601IndentationRule (#597) (#599)} and ] (#596)--version output with gradle-built JAR (#613)Minor bugfix release for 0.34.0. (Note: 0.34.1 deprecated/deleted due to regression in disabled_flags .editorconfig support.)
--disabled_rules command line flag. (#534)--stdin flag for printAST command (#528)NoUnusedImports rule (#531, #526)disabled_rules property in .editorconfig (#503)experimental:no-empty-first-line-in-method-block (#474)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; use installGitPreCommitHook subcommand instead (#487)--print-ast flag; use printAST subcommand instead (#500)--ruleset-repository and --ruleset-update flagsimport-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)-> in some cases (#403)SpacingAroundCommaRule will no longer move code into comments= less aggressive (#368) (#380)experimental/import-ordering rule (#189). Use ktlint --experimental to enabled.ktlint now part of Homebrew core (shyiko/ktlint tap deprecated)super (#369).com.pinterest packagecom.pinterestMETA-INF.services file must be renamed to com.pinterest.ktlint.core.RuleSetProvider< & > 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.* as node.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).Missing newline before ")" (#327).kotlin-compiler version to 1.3.20 (from 1.2.71) (#331).--ruleset/--reporter switched to HTTPS (#332).no-semi rule to preserve semicolon after companion object; (see #281 for details).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).package-name rule (directories containing . in their names are no longer considered to be invalid) (#276).max-line-length rule (multi-line strings are no longer checked) (#262).json reporter \ and control characters escaping (#256).package-name rule (#246).--editorconfig=path/to/.editorconfig (#250).end_of_line=native (.editorconfig) (#225).tab -> space * indent_size auto-correction (--format/-F).(cannot be auto-corrected) reporting.--debug mode while trying to print root=true <- root=false .editorconfig chain.kotlin-compiler version to 1.2.51 (from 1.2.50).paren-spacing rule (#223).ktlint --install-git-pre-commit-hook)ktlint --install-git-pre-push-hook to install) (#229).end_of_line=crlf (.editorconfig) (#225)..editorconfig path resolution.editorconfig to be loaded) (#207).comment-spacing rule to exclude //noinspection (#212).kotlin-compiler version to 1.2.50 (from 1.2.41) (#226).ClassCastException: cannot be cast to LeafPsiElement (#205).comment-spacing (#198),filename (#194) rules.parameter-list-wrapping left parenthesis placement check (#201).parameter-list-wrapping auto-correction when max_line_length is exceeded (#200).kotlin-compiler version to 1.2.41 (from 1.2.40).--apply-to-idea-project (as an alternative to (global) --apply-to-idea) (#178).--format commenting out operators (chain-wrapping rule) (#193).indent rule (continuation_indent_size is now ignored) (#171).continuation_indent_size (and gcd(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).indent rule to ignore where <type constraint list> clause (#180).--reporter=<name>,artifact=<group_id>:<artifact_id>:<version>) (#176).--ruleset/--reporter dependency tree validation.--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-line if/else without curly braces.kotlin-compiler version to 1.2.30 (from 1.2.20).Internal Error (parameter-list-wrapping) when indent_size=unset (#165).+/- wrapping inside catch block, after else and if (..) (#160).indent rule.ktlint --format/-F when some of the errors cannot be auto-corrected (previously it was 0 instead of expected 1) (#162).when block (#160).parameter-list-wrapping rule (#130).+, -, *, /, %, &&, || wrapping check (now part of chain-wrapping rule).componentN import (where N > 5) false positive (#142).modifier-order rule to match official Kotlin Coding Conventions (#146)override modifier should be placed before suspend/tailrec, not after)no-line-break-after-else rule (#125).kotlin-compiler version to 1.2.20 (from 1.2.0).continuation_indent_size to 4 when --android profile is used (android/kotlin-guides#37).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--color CLI option for colored output (where supported, e.g. --print-ast, default (plain) reporter, etc).editorconfig property resolution.[*.{kt,kts}] is not required anymore (ktlint looks for sections containing *.kt (or *.kts) and will fallback to [*] whenever property cannot be found elsewhere)..editorconfig (unless it contains root=true).max-line-length rule to assume max_line_length=100 when ktlint --android ... is usedkotlin-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)max-line-length even though regular comments were not).= in @annotation|s (op-spacing).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.org.eclipse.aether:aether-*:1.1.0 and org.eclipse.aether:aether-*:1.0.0.v20140518 (#100).--android (-a) CLI option (turns on Android Kotlin Style Guide compatibility)ktlint --apply-to-idea).ktlint --apply-to-idea to account for indent_size & continuation_indent_size in .editorconfig (if any).ktlint-intellij-idea-integration binary (deprecated in 0.9.0).component1..component5).--reporter's output handling (previously parent directory was expected to exist) (#97).no-blank-line-before-rbrace rule (#65).} and :: (curly-spacing).This release contains changes that were meant for 0.11.0 and so it was retagged as such.
} and [key]/(...) (curly-spacing) (#91).ktlint --install-git-pre-commit-hook to install).--reporter=<name>,output=<path/to/file>) (#71).indent_size=unset (.editorconfig) (#70).( { formatting( { 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 include OPTIMIZE_IMPORTS_ON_THE_FLY=true.: Unit = formatting (: Unit is no longer dropped when = is used) (#77).${super.toString()} linting (string-template rule) (#69).ktlint comes with 3 built-in reporters: plain (default; ?group_by_file can be appended to enable grouping by file (shown below)), json and checkstyle.$ 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.
insert_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 makes ktlint output file paths relative to working directory (e.g. dir/file.kt instead of /home/269/project/dir/file.kt).kotlin-compiler to 1.1.3-2 (from 1.1.0)).--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 binaryktlint (as ktlint --apply-to-idea)).setValue) (#55).get/setter spacing (#56).getValue) (#54).ktlint --stdin (#51).indent_size is honored and only if it's set in [*{kt,kts}] section).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.kotlin-compiler version to 1.1.0 (from 1.1-M04).super<T> (#34).} 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).kotlin-compiler version to 1.1-M04 (from 1.0.6).*.kts (script) support.kotlin-compiler version to 1.0.6 (from 1.0.3).no-wildcard-imports rule (kotlinx.android.synthetic excluded from check) (#16).curly-spacing false negative in case of }?..ktlint -F output (it now includes lint errors that cannot be fixed automatically).ktlint -F --debug error count.