Skip to content

Commit

Permalink
ktlint 1.0 (#324)
Browse files Browse the repository at this point in the history
and its terrible function naming rule that doesn't honor Compose conventions!
  • Loading branch information
JakeWharton authored Oct 25, 2023
1 parent d80b7e6 commit 0212a70
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 15 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ subprojects {
target("src/**/*.kt")
ktlint(libs.ktlint.get().version).editorConfigOverride([
'ktlint_standard_filename': 'disabled',
'ktlint_function_naming_ignore_when_annotated_with': 'Composable',
])
licenseHeaderFile(rootProject.file('gradle/license-header.txt'))
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-t

kotlinx-binaryCompatibilityValidator = "org.jetbrains.kotlinx:binary-compatibility-validator:0.13.2"

ktlint = "com.pinterest:ktlint:0.50.0"
ktlint = "com.pinterest.ktlint:ktlint:1.0.1"

maven-publish-plugin = { module = "com.vanniktech:gradle-maven-publish-plugin", version = "0.25.3" }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet.Companion.COMMON_MAIN_
import org.jetbrains.kotlin.gradle.plugin.SubpluginArtifact
import org.jetbrains.kotlin.gradle.plugin.SubpluginOption

private const val extensionName = "molecule"
private const val moleculeRuntime = "app.cash.molecule:molecule-runtime:$moleculeVersion"
private const val EXTENSION_NAME = "molecule"
private const val MOLECULE_RUNTIME = "app.cash.molecule:molecule-runtime:$moleculeVersion"

private abstract class MoleculeExtensionImpl
@Inject constructor(objectFactory: ObjectFactory) : MoleculeExtension {
Expand All @@ -54,7 +54,7 @@ class MoleculePlugin : KotlinCompilerPluginSupportPlugin {

extension = target.extensions.create(
MoleculeExtension::class.java,
extensionName,
EXTENSION_NAME,
MoleculeExtensionImpl::class.java,
)

Expand All @@ -76,7 +76,7 @@ class MoleculePlugin : KotlinCompilerPluginSupportPlugin {
| sourceSets {
| commonMain {
| dependencies {
| implementation("$moleculeRuntime")
| implementation("$MOLECULE_RUNTIME")
| }
| }
| }
Expand All @@ -93,7 +93,7 @@ class MoleculePlugin : KotlinCompilerPluginSupportPlugin {
val dependency: Any = if (target.isInternal()) {
target.dependencies.project(mapOf("path" to ":molecule-runtime"))
} else {
moleculeRuntime
MOLECULE_RUNTIME
}

if (jvm != null || android != null) {
Expand Down Expand Up @@ -122,7 +122,7 @@ class MoleculePlugin : KotlinCompilerPluginSupportPlugin {
3 -> SubpluginArtifact(parts[0], parts[1], parts[2])
else -> error(
"""
|Illegal format of '$extensionName.${MoleculeExtension::kotlinCompilerPlugin.name}' property.
|Illegal format of '$EXTENSION_NAME.${MoleculeExtension::kotlinCompilerPlugin.name}' property.
|Expected format: either '<VERSION>' or '<GROUP_ID>:<ARTIFACT_ID>:<VERSION>'
|Actual value: '$plugin'
""".trimMargin(),
Expand Down
8 changes: 0 additions & 8 deletions renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,5 @@
"org.jetbrains.kotlin:kotlin",
],
},
{
// ktlint breaks their API constantly and regularly needs a Spotless update to work.
"groupName": "Spotless/ktlint",
"matchPackagePrefixes": [
"com.diffplug.spotless",
"com.pinterest:ktlint",
],
},
],
}

0 comments on commit 0212a70

Please sign in to comment.