-
Notifications
You must be signed in to change notification settings - Fork 163
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
Upgrade ktlint support #595
Conversation
private val androidProperty = UsesEditorConfigProperties.EditorConfigProperty( | ||
type = PropertyType.LowerCasingPropertyType( | ||
"android", | ||
"A boolean value indicating that the project is an Android one.", | ||
PropertyType.PropertyValueParser.IDENTITY_VALUE_PARSER, | ||
emptySet() | ||
), | ||
defaultValue = "false" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't this be inferred?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seemed to me you were treating this property as a String
but it seems feasible to be "inferred" when looking at how the indentSize
property is handled in the ktlint API.
I can give it a try.
@@ -12,10 +12,10 @@ import kotlin.streams.asStream | |||
|
|||
object TestVersions { | |||
const val minSupportedGradleVersion = KtlintBasePlugin.LOWEST_SUPPORTED_GRADLE_VERSION | |||
const val maxSupportedGradleVersion = "7.1.1" | |||
const val maxSupportedGradleVersion = "7.4.2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We like keeping the same version range support as the Google android plugin in general. Is this still kept with this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're on the same page, the latest Android Gradle plugin version is 7.2 which supports Gradle 7.3.3 and onwards (source). Do you want me to lower the version to 7.3.3?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Support as high as possible. But make sure we're not loosing versions still supported by the AGP
@JLLeitschuh how do you see the Ktlint support of this plugin? As is, it only supports the If you still want to support the full range of versions from IMHO, I think the support for the older versions could be dropped with a new major release of this plugin. Ktlint is a quality tool that should not harm any project by upgrading it. Moreover, it is configurable so that any new rule could be disabled. What's your opinion on this? |
I guess one solution is to simply say that if someone requires backwards compatibility, they are welcome to contribute it. Under that pretense, please be sure to clearly document that this will be a breaking change and move forward with the change 🙂 |
I apologize for the delay, I got an increased amount of work lately so I'm lacking time on this. I updated the PR with a new minimal supported version to I also stepped back on the |
I believe that this is now outdated by #597, correct? |
1 similar comment
I believe that this is now outdated by #597, correct? |
@JLLeitschuh I don't get the point of the 11.0.0 release (which contains #597).:monocle_face: This only bumped Kotlin and Gradle. I thought the goal was to make ktlint-gradle ready for ktlint 0.46.+ (which this PR does)? Maybe I am missing something? |
I'll give this a look during the week-end. I should be able to rebase it. That's progress anyway. Thanks. |
Maybe you can even check whether ktlint 0.47.0 works with your changes. |
I've managed to rebase this PR without trouble. Regarding the upgrade to Ktlint First, the The second change concerns the Last, the generation of IDEA configuration is no longer provided by Ktlint. It is up to this plugin to also drop the support or to implement it directly. I had some other failing tests I didn't look at closely but I don't think there are other significant issues. I'll be glad to continue the upgrade process but I think this could be done in a separate MR due to the new changes it involves. Please let me know what's your opinion on that. |
I'm certainly in favor of this. Thanks for your effort. |
Dropping support in parity with the ktlint version seems reasonable. Especially if the major version was revised again and the minimum supported ktlint version was set to 0.47 (or perhaps 0.48 by the time this is merged). It would be a big, breaking change—but reducing the maintenance cost of this plugin seems valuable until it can get some new maintainers onboard. There's also an argument to be made that IntelliJ should be responsible for its own configuration, so the kotlin plugin could provide an "official" and "android official" style preset, which would obviate the need for the ktlint/ktlint-gradle implementation. Here's the relevant rationale upstream: pinterest/ktlint/issues/701 |
Any update on this PR? |
You might want to do something similar to diffplug/spotless#1303 to ensure it's easy to maintain support for multiple versions of KtLint. |
I think we can close this PR, since I have added support for newer versions of ktlint in a way that is backward compatible via reflection |
Hi 👋
This MR is an attempt on upgrading support of Ktlint up to 0.46.1 (#589).
I started to work on this before this MR #593 arrived. So I opened a new one anyway at least to provide help.
I've split my work into steps in order to test each version from 0.42.1 to 0.46.1.
I also upgraded Gradle to 7.4.2 and Kotlin to 1.6.21.