Update dependency com.pinterest.ktlint:ktlint-bom to v0.50.0 #168
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
0.49.1
->0.50.0
Release Notes
pinterest/ktlint (com.pinterest.ktlint:ktlint-bom)
v0.50.0
Compare Source
Deprecation of ktlint-enable and ktlint-disable directives
The
ktlint-disable
andktlint-enable
directives are no longer supported. Ktlint rules can now only be suppressed using the@Suppress
or@SuppressWarnings
annotations. A new rule,internal:ktlint-suppression
, is provided to replace the directives with annotations.API consumers do not need to provide this rule, but it does no harm when done.
The
internal:ktlint-suppression
rule can not be disabled via the.editorconfig
nor via@Suppress
or@SuppressWarnings
annotations.Custom Rule Providers need to prepare for Kotlin 1.9
In Kotlin 1.9 the extension points of the embedded kotlin compiler will change. Ktlint only uses the
org.jetbrains.kotlin.com.intellij.treeCopyHandler
extension point. This extension is not yet supported in 1.9, neither is it documented (#KT-58704). Without this extension point it might happen that your custom rules will throw exceptions during runtime. See #1981.In Ktlint, 7 out of 77 rules needed small and sometimes bigger changes to become independent of the extension point
org.jetbrains.kotlin.com.intellij.treeCopyHandler
. The impact on your custom rules may vary dependent on the way the autocorrect has been implemented. When manipulatingASTNode
s there seems to be no impact. When, manipulatingPsiElement
s, some functions consistently result in a runtime exception.Based on the refactoring of the rules as provided by
ktlint-ruleset-standard
in Ktlint0.49.x
the suggested refactoring is as follows:LeafElement.replaceWithText(String)
withLeafElement.rawReplaceWithText(String)
.PsiElement.addAfter(PsiElement, PsiElement)
withAstNode.addChild(AstNode, AstNode)
. Note that this method inserts the new node (first) argument before the second argument node and as of that is not a simple replacement of thePsiElement.addAfter(PsiElement, PsiElement)
.PsiElement.replace(PsiElement)
with a sequence ofAstNode.addChild(AstNode, AstNode)
andAstNode.removeChild(AstNode)
.Be aware that your custom rules might use other functions which also throw exceptions when the extension point
org.jetbrains.kotlin.com.intellij.treeCopyHandler
is no longer supported.In order to help you to analyse and fix the problems with your custom rules, ktlint temporarily supports to disable the extension point
org.jetbrains.kotlin.com.intellij.treeCopyHandler
using a flag. This flag is available in the Ktlint CLI and in theKtlintRuleEngine
. By default, the extension point is enabled like it was in previous versions of ktlint.At least you should analyse the problems by running your test suits by running ktlint and disabling the extension point. Next you can start with fixing and releasing the updated rules. All rules in this version of ktlint have already been refactored and are not dependent on the extension point anymore. In Ktlint CLI the flag is to be activated with parameter
--disable-kotlin-extension-point
. API Consumers that use theKtlintRuleEngine
directly, have to set propertyenableKotlinCompilerExtensionPoint
tofalse
.At this point in time, it is not yet decided what the next steps will be. Ktlint might drop the support of the extension points entirely. Or, if the extension point
org.jetbrains.kotlin.com.intellij.treeCopyHandler
is fully supported at the time that ktlint will be based on kotlin 1.9 it might be kept. In either case, the flag will be dropped in a next version of ktlint.Added
binary-expression-wrapping
. This rule wraps a binary expression in case the max line length is exceeded (#1940)org.jetbrains.kotlin.com.intellij.treeCopyHandler
to analyse impact on custom rules #1981no-empty-file
for all code styles. A kotlin (script) file may not be empty (#1074)statement-wrapping
which ensures function, class, or other blocks statement body doesn't start or end at starting or ending braces of the block (#1938)blank-line-before-declaration
. This rule requires a blank line before class, function or property declarations (#1939)wrapping
(#1078)ktlint-suppression
to replace thektlint-disable
andktlint-enable
directives with annotations. This rule can not be disabled via the.editorconfig
(#1947)--format
option of KtLint CLI when finding a violation that can be autocorrected (#1071)Removed
0.49.x
is removed. Consult changelog of 0.49.x` released for more information. Summary of removed code:Fixed
property-naming
(#2024)serialVersionUID
inproperty-naming
(#2045)parameter-list-wrapping
(#1324)else
branch when body contains only chained calls or binary expression (#2057)Changed
RuleId
andRuleSetId
classes. Those classes were defined as value classes in0.49.0
and0.49.1
. Although the classes were marked with@JvmInline
it seems that it is not possible to uses those classes from Java base API Consumers like Spotless. The classes have now been replaced with data classes (#2041)info.picocli:picocli
to v4.7.4org.junit.jupiter:junit-jupiter
to v5.9.31.8.22
and Kotlin version to1.8.22
.Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate. View repository job log here.