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

Update ktlint-lib to v0.46.1 #728

Closed
wants to merge 1 commit into from
Closed

Update ktlint-lib to v0.46.1 #728

wants to merge 1 commit into from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Jun 19, 2022

Mend Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
com.pinterest.ktlint:ktlint-test 0.45.2 -> 0.46.1 age adoption passing confidence
com.pinterest.ktlint:ktlint-core 0.45.2 -> 0.46.1 age adoption passing confidence

Release Notes

pinterest/ktlint

v0.46.1

Compare Source

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

Compare Source

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

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 these updates again.


  • If you want to rebase/retry this PR, click this checkbox.

This PR has been generated by Mend Renovate. View repository job log here.

@renovate renovate bot requested a review from RBusarow as a code owner June 19, 2022 10:36
@renovate renovate bot added automerge dependencies Pull requests that update a dependency file labels Jun 19, 2022
@RBusarow
Copy link
Member

Blocked until the Gradle plugin is updated to handle api-breaking changes.

JLLeitschuh/ktlint-gradle#589

@renovate renovate bot force-pushed the renovate/ktlint-lib branch 4 times, most recently from 53885df to ca5463d Compare June 21, 2022 21:38
@renovate renovate bot changed the title Update ktlint-lib to v0.46.0 Update ktlint-lib to v0.46.1 Jun 21, 2022
@renovate renovate bot force-pushed the renovate/ktlint-lib branch 4 times, most recently from 80bcab2 to 3c5b32a Compare June 23, 2022 22:33
@renovate
Copy link
Contributor Author

renovate bot commented Jun 23, 2022

Renovate Ignore Notification

As this PR has been closed unmerged, Renovate will now ignore this update (0.46.1). You will still receive a PR once a newer version is released, so if you wish to permanently ignore this dependency, please add it to the ignoreDeps array of your renovate config.

If this PR was closed by mistake or you changed your mind, you can simply rename this PR and you will soon get a fresh replacement PR opened.

@renovate renovate bot deleted the renovate/ktlint-lib branch June 23, 2022 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant