Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump com.pinterest.ktlint:ktlint-cli-reporter from 0.49.1 to 0.51.0-FINAL #778

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Oct 28, 2024

Bumps com.pinterest.ktlint:ktlint-cli-reporter from 0.49.1 to 0.51.0-FINAL.

Release notes

Sourced from com.pinterest.ktlint:ktlint-cli-reporter's releases.

0.50.0

Deprecation of ktlint-enable and ktlint-disable directives

The ktlint-disable and ktlint-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 manipulating ASTNodes there seems to be no impact. When, manipulating PsiElements, some functions consistently result in a runtime exception.

Based on the refactoring of the rules as provided by ktlint-ruleset-standard in Ktlint 0.49.x the suggested refactoring is as follows:

  • Replace LeafElement.replaceWithText(String) with LeafElement.rawReplaceWithText(String).
  • Replace PsiElement.addAfter(PsiElement, PsiElement) with AstNode.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 the PsiElement.addAfter(PsiElement, PsiElement).
  • Replace PsiElement.replace(PsiElement) with a sequence of AstNode.addChild(AstNode, AstNode) and AstNode.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 the KtlintRuleEngine. 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 the KtlintRuleEngine directly, have to set property enableKotlinCompilerExtensionPoint to false.

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

  • Add new experimental rule binary-expression-wrapping. This rule wraps a binary expression in case the max line length is exceeded (#1940)
  • Add flag to disable extension point org.jetbrains.kotlin.com.intellij.treeCopyHandler to analyse impact on custom rules #1981
  • Add new experimental rule no-empty-file for all code styles. A kotlin (script) file may not be empty (#1074)
  • Add new experimental rule 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)
  • Add new experimental rule blank-line-before-declaration. This rule requires a blank line before class, function or property declarations (#1939)
  • Wrap multiple statements on same line wrapping (#1078)
  • Add new rule ktlint-suppression to replace the ktlint-disable and ktlint-enable directives with annotations. This rule can not be disabled via the .editorconfig (#1947)
  • Inform user about using --format option of KtLint CLI when finding a violation that can be autocorrected (#1071)

Removed

  • Code which was deprecated in 0.49.x is removed. Consult changelog of 0.49.x` released for more information. Summary of removed code:

Fixed

  • Do not flag a (potential) mutable extension property in case the getter is annotated or prefixed with a modifier property-naming (#2024)
  • Do not merge an annotated expression body with the function signature even if it fits on a single line (#2043)
  • Ignore property with name serialVersionUID in property-naming (#2045)
  • Prevent incorrect reporting of violations in case a nullable function type reference exceeds the maximum line length parameter-list-wrapping (#1324)

... (truncated)

Changelog

Sourced from com.pinterest.ktlint:ktlint-cli-reporter's changelog.

Changelog

All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.

[1.4.0] - 2024-10-24

🆕 Features

🔧 Fixes

... (truncated)

Commits

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

@dependabot dependabot bot added dependencies Pull requests that update a dependency file java Pull requests that update Java code labels Oct 28, 2024
Bumps [com.pinterest.ktlint:ktlint-cli-reporter](https://github.com/pinterest/ktlint) from 0.49.1 to 0.51.0-FINAL.
- [Release notes](https://github.com/pinterest/ktlint/releases)
- [Changelog](https://github.com/pinterest/ktlint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/pinterest/ktlint/commits)

---
updated-dependencies:
- dependency-name: com.pinterest.ktlint:ktlint-cli-reporter
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
@dependabot dependabot bot force-pushed the dependabot/gradle/com.pinterest.ktlint-ktlint-cli-reporter-0.51.0-FINAL branch from 00d65c0 to 5248c08 Compare October 29, 2024 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file java Pull requests that update Java code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants