-
Notifications
You must be signed in to change notification settings - Fork 50
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 Ktlint to 0.47.1
(+ bump Kotlin to 1.7.10)
#275
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ import org.jetbrains.kotlin.gradle.plugin.getKotlinPluginVersion | |
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
plugins { | ||
kotlin("jvm") version "1.7.0" | ||
kotlin("jvm") version "1.7.10" | ||
id("com.gradle.plugin-publish") version "0.21.0" | ||
`java-gradle-plugin` | ||
`maven-publish` | ||
|
@@ -27,7 +27,7 @@ description = projectDescription | |
object Versions { | ||
const val androidTools = "7.2.1" | ||
const val junit = "4.13.2" | ||
const val ktlint = "0.46.1" | ||
const val ktlint = "0.47.0" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's go to 0.47.1! |
||
const val mockitoKotlin = "4.0.0" | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ internal fun editorConfigOverride(ktLintParams: KtLintParams): EditorConfigOverr | |
return if (rules.isEmpty()) { | ||
EditorConfigOverride.emptyEditorConfigOverride | ||
} else { | ||
EditorConfigOverride.from(DefaultEditorConfigProperties.disabledRulesProperty to rules.joinToString(separator = ",")) | ||
EditorConfigOverride.from(DefaultEditorConfigProperties.ktlintDisabledRulesProperty to rules.joinToString(separator = ",")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
package org.jmailen.gradle.kotlinter.support | ||
|
||
import com.pinterest.ktlint.core.RuleSet | ||
import com.pinterest.ktlint.core.RuleSetProvider | ||
import com.pinterest.ktlint.core.RuleProvider | ||
import com.pinterest.ktlint.core.RuleSetProviderV2 | ||
import com.pinterest.ktlint.ruleset.experimental.ExperimentalRuleSetProvider | ||
import java.util.ServiceLoader | ||
import kotlin.comparisons.compareBy | ||
|
||
fun resolveRuleSets( | ||
providers: Iterable<RuleSetProvider>, | ||
internal fun resolveRuleProviders( | ||
providers: Iterable<RuleSetProviderV2>, | ||
includeExperimentalRules: Boolean = false, | ||
): List<RuleSet> { | ||
return providers | ||
.filter { includeExperimentalRules || it !is ExperimentalRuleSetProvider } | ||
.map { it.get() } | ||
.sortedWith( | ||
compareBy { | ||
when (it.id) { | ||
"standard" -> 0 | ||
else -> 1 | ||
} | ||
}, | ||
) | ||
} | ||
): Set<RuleProvider> = providers | ||
jeremymailen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
.asSequence() | ||
.filter { includeExperimentalRules || it !is ExperimentalRuleSetProvider } | ||
.sortedWith( | ||
compareBy { | ||
when (it.id) { | ||
"standard" -> 0 | ||
else -> 1 | ||
} | ||
}, | ||
) | ||
Comment on lines
+14
to
+21
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't understand why sorting was required, but I preserved the behavior, despite the new returned type is a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At one point way back we intentionally put standard rules first in the list although I can't dig up the reason why. It might have been to report them first, but this might be an obsolete concern. |
||
.map(RuleSetProviderV2::getRuleProviders) | ||
.flatten() | ||
.toSet() | ||
|
||
// statically resolve providers from plugin classpath. ServiceLoader#load alone resolves classes lazily which fails when run in parallel | ||
// https://github.com/jeremymailen/kotlinter-gradle/issues/101 | ||
val defaultRuleSetProviders: List<RuleSetProvider> = | ||
ServiceLoader.load(RuleSetProvider::class.java).toList() | ||
val defaultRuleSetProviders: List<RuleSetProviderV2> = | ||
ServiceLoader.load(RuleSetProviderV2::class.java).toList() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
plugins { | ||
kotlin("jvm") version "1.7.0" | ||
kotlin("jvm") version "1.7.10" | ||
id("org.jmailen.kotlinter") | ||
} |
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.
Out of curiosity, do we still work with 1.7.0 or do we need to update the compatibility matrix?
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.
I verified we're still compatible with kotlin
1.7.0
✅