Skip to content

Update ktlint to v0.48.2 #5723

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

Merged
merged 1 commit into from
Jan 24, 2023
Merged

Update ktlint to v0.48.2 #5723

merged 1 commit into from
Jan 24, 2023

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Jan 24, 2023

Mend Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
com.pinterest.ktlint:ktlint-ruleset-experimental 0.48.1 -> 0.48.2 age adoption passing confidence
com.pinterest.ktlint:ktlint-ruleset-standard 0.48.1 -> 0.48.2 age adoption passing confidence
com.pinterest.ktlint:ktlint-core 0.48.1 -> 0.48.2 age adoption passing confidence

Release Notes

pinterest/ktlint

v0.48.2

Compare Source

Additional clarification on API Changes in 0.48.0 and 0.48.1

Starting with Ktlint 0.48.x, rule and rule sets can be enabled/disabled with a separate property per rule (set). Please read deprecation of (ktlint_)disable_rules property for more information.

API Consumers that provide experimental rules to the KtLintRuleEngine, must also enable the experimental rules or instruct their users to do so in the .editorconfig file. From the perspective of the API Consumer it might be confusing or unnecessary to do so as the experimental rule was already provided explicitly.

Ktlint wants to provide the user (e.g. a developer) a uniform and consistent user experience. The .editorconfig becomes more and more central to store configuration for Ktlint. This to ensure that all team members use the exact same configuration when running ktlint regardless whether the Ktlint CLI or an API Consumer is being used.

The .editorconfig is a powerful configuration tool which can be used in very different ways. Most projects use a single .editorconfig file containing one common section for kotlin and kotlin scripts files. For example, the .editorconfig file of the Ktlint project contains following section:

[*.{kt,kts}]
ij_kotlin_imports_layout = *
ij_kotlin_allow_trailing_comma = true
ij_kotlin_allow_trailing_comma_on_call_site = true

Other projects might contain multiple .editorconfig files for different parts of the project directory hierarchy. Or, use a single .editorconfig file containing multiple sections with different globs. Like all other configuration settings in Ktlint, the user should be able to enable and disable the experimental rules. Both for the entire set of experimental rules and for individual experimental rules.

Ktlint allows API Consumers to set default values and override values for the .editorconfig. Specifying a default value means that the user does not need to define the property in the .editorconfig file but if the user specifies the value, it will take precedence. Specifying the override value ensures that this takes precedence on a value specified by the user in the .editorconfig.

From the Ktlint perspective, it is advised that API Consumers provide the default value. See example below, for how to specify the editorConfigDefault property:

KtLintRuleEngine(
    ruleProviders = ruleProviders,
    editorConfigDefaults = EditorConfigDefaults(
        EditorConfig
            .builder()
            .section(
                Section
                    .builder()
                    .glob(Glob("*.{kt,kts}"))
                    .properties(
                        Property
                            .builder()
                            .name("ktlint_experimental")
                            .value("enabled"),
                    ),
            )
            .build()
    )
)

If the user has set property ktlint_experimental explicitly than that value will be used. If the value is not defined, the value provided via editorConfigDefaults will be used.

If you do want to ignore the value of ktlint_experimental as set by the user, than you can set the EditorConfigOverride property. But as said before that is discouraged as the user might not understand why the .editorconfig property is being ignored (provided that the value set is not equal to the value provided by the API Consumer).

Added
Removed
Fixed
  • Fix with array-syntax annotations on the same line as other annotations annotation (#​1765)
  • Do not enable the experimental rules by default when .editorconfig properties disabled_rules or ktlint_disabled_rules are set. (#​1771)
  • A function signature not having any parameters which exceeds the max-line-length should be ignored by rule function-signature (#​1773)
  • Allow diacritics in names of classes, functions packages, and properties class-naming, function-naming, package-name, property-naming (#​1757)
  • Prevent violation of file-name rule on code snippets (#​1768)
  • Clarify that API Consumers have to enable experimental rules (#​1768)
  • Trim spaces in the .editorconfig property ij_kotlin_imports_layout's entries (#​1770)
Changed

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, check this box

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

@renovate renovate bot added the dependencies Pull requests that update a dependency file label Jan 24, 2023
@codecov
Copy link

codecov bot commented Jan 24, 2023

Codecov Report

Merging #5723 (2aae052) into main (aa2610f) will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff            @@
##               main    #5723   +/-   ##
=========================================
  Coverage     84.47%   84.47%           
  Complexity     3733     3733           
=========================================
  Files           543      543           
  Lines         12713    12713           
  Branches       2222     2222           
=========================================
  Hits          10739    10739           
  Misses          865      865           
  Partials       1109     1109           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@3flex 3flex merged commit 2e6b576 into main Jan 24, 2023
@3flex 3flex deleted the renovate/ktlint branch January 24, 2023 05:54
@3flex 3flex added this to the 1.23.0 milestone Jan 24, 2023
@cortinico cortinico added the notable changes Marker for notable changes in the changelog label Jan 25, 2023
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 notable changes Marker for notable changes in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants