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

ktlint 1.0 support #708

Merged
merged 1 commit into from
Sep 18, 2023
Merged

ktlint 1.0 support #708

merged 1 commit into from
Sep 18, 2023

Conversation

wakingrufus
Copy link
Collaborator

@wakingrufus wakingrufus commented Sep 14, 2023

Ktlint 1.0 support (fixes #706)

Allow editorconfig overrides in ktlint 0.49+ (fixes #707) using pinterest/ktlint#2194

@wakingrufus wakingrufus changed the title Fix editorconfig overrides ktlint 1.0 support Sep 14, 2023
@@ -2,7 +2,7 @@ pluginManagement {
val latestRelease = file("VERSION_LATEST_RELEASE.txt").readText().trim()
plugins {
id("org.jlleitschuh.gradle.ktlint") version latestRelease
id("org.jetbrains.kotlin.jvm") version "1.7.21"
id("org.jetbrains.kotlin.jvm") version "1.9.0"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have to upgrade because ktlint did (to support context receivers)

@wakingrufus wakingrufus force-pushed the fix-editorconfig-overrides branch 2 times, most recently from 6ba65c3 to 89cd401 Compare September 14, 2023 21:55
@wakingrufus wakingrufus marked this pull request as ready for review September 14, 2023 21:59
@wakingrufus wakingrufus force-pushed the fix-editorconfig-overrides branch 3 times, most recently from 3a2318f to 26a2e87 Compare September 14, 2023 22:39
}

private fun resolveGroup(ktlintVersion: String) = when {
SemVer.parse(ktlintVersion) < SemVer(0, 32, 0) -> "com.github.shyiko"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we dont support 0.32 anymore

Copy link
Contributor

@Goooler Goooler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can note

Change default code style to ktlint_official

in changelog, if someone is upgrading from the old versions, may need to override the style like ktlint_code_style = intellij_idea.

plugin/build.gradle.kts Outdated Show resolved Hide resolved
Copy link
Owner

@JLLeitschuh JLLeitschuh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@extmkv
Copy link

extmkv commented Sep 18, 2023

@wakingrufus @JLLeitschuh when are you planing to generate a new version?

@wakingrufus
Copy link
Collaborator Author

We can note

Change default code style to ktlint_official

in changelog, if someone is upgrading from the old versions, may need to override the style like ktlint_code_style = intellij_idea.

This is only true based on which ktlint version you are selecting right? the default is still 0.47.1

@Goooler
Copy link
Contributor

Goooler commented Sep 18, 2023

Yeah, before 1.0.0 the default style is intellij_idea but ktlint_official for now, this is a potential change, which with so many format conflicts.

Allow editorconfig overrides in ktlint 0.49+ (fixes #707) using pinterest/ktlint#2194
@wakingrufus
Copy link
Collaborator Author

Yeah, before 1.0.0 the default style is intellij_idea but ktlint_official for now, this is a potential change, which with so many format conflicts.

I think this will be important to note when we change the default to 1.0, but for now, this will not be imposed on anyone who is not explicitly upgrading. We also currently note:

The version of ktlint used by default may change between patch versions of this plugin.
If you don't want to inherit these changes then make sure you lock your version here.

in the README.md as well, but I will improve that to point to the ktlint release notes for reference.

@wakingrufus
Copy link
Collaborator Author

Yeah, before 1.0.0 the default style is intellij_idea but ktlint_official for now, this is a potential change, which with so many format conflicts.

I think this will be important to note when we change the default to 1.0, but for now, this will not be imposed on anyone who is not explicitly upgrading. We also currently note:

The version of ktlint used by default may change between patch versions of this plugin.
If you don't want to inherit these changes then make sure you lock your version here.

in the README.md as well, but I will improve that to point to the ktlint release notes for reference.

The reason I am hesitant to get overly verbose here, is that there are MANY changes in behavior between ktlint versions, many of which are just changes in the underlying implementation that has no impact on the plugin itself. I do not want to set an expectation that we will be documenting these: it is up to the user to determine which version of ktlint to use and when to upgrade. All the documentation needed for this is provided by the ktlint project.

@wakingrufus wakingrufus merged commit 96dfaab into main Sep 18, 2023
15 checks passed
@wakingrufus wakingrufus deleted the fix-editorconfig-overrides branch September 18, 2023 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support --disabled-rules CLI option in ktlintFormat and ktlintCheck Support Ktlint 1.0
4 participants