mrmans0n / compose-rules

Lint rules for ktlint/detekt aimed to contribute to a healthier usage of Compose. Actively maintained and evolved fork of the Twitter Compose rules.
https://mrmans0n.github.io/compose-rules
Other
561 stars 21 forks source link

Compatibility with 0.49.0 #44

Closed PaulWoitaschek closed 1 year ago

PaulWoitaschek commented 1 year ago

The changelog of ktlint says:

https://github.com/pinterest/ktlint/releases/tag/0.49.0

WARNING: This version of KtLint contains a number of breaking changes in KtLint CLI and KtLint API. If you are using KtLint with custom ruleset jars or custom reporter jars, then those need to be upgraded before you can use them with this version of ktlint. Please contact the maintainers of those jars and ask them to upgrade a.s.a.p.

It would be great if you could update it :) Also I'm wondering why renovate didn't pick it up.

mrmans0n commented 1 year ago

Yea, life got in the way (literally, my son was born a few days ago lol).

Renovate not working is a big pain in the ass, I missed this because of that. I'll look into fixing renovate and then address all updates after.

mrmans0n commented 1 year ago

https://github.com/mrmans0n/compose-rules/commit/71a1d306822dd43457ecf62282ec431b054b7f66 seems this fixed renovate. Will look into updating ktlint.

PaulWoitaschek commented 1 year ago

Yea, life got in the way (literally, my son was born a few days ago lol).

Wow, congratulations! Enjoy your time and try to get some sleep from time to time 😊

I've you're too busy I can also tackle it. Let me know!

mrmans0n commented 1 year ago

Ok, this should be merged. a 0.1.6-SNAPSHOT version should have this, hopefully works alright. Can you verify when you have a minute if that snapshot version works for you with the new ktlint?

PaulWoitaschek commented 1 year ago

Had a hard time building the jar and figuring out how the build works but got it working

It looks like something is broken:

/Users/ph1b/repos/yazio/android/shared/generator/ui/src/jvmMain/kotlin/com/yazio/generator/ui/flow/screenConfig/view/FlowMultipleChoiceScreenConfigContent.kt:1:1: Internal Error (rule 'compose:content-emitter-returning-values-check') in FlowMultipleChoiceScreenConfigContent.kt at position '1:1. Please create a ticket at https://github.com/pinterest/ktlint/issues and provide the source code that triggered an error.
com.pinterest.ktlint.rule.engine.api.KtLintRuleException: Rule 'compose:content-emitter-returning-values-check' throws exception in file 'FlowMultipleChoiceScreenConfigContent.kt' at position (1:1)
   Rule maintainer: Compose Rules
   Issue tracker  : https://github.com/mrmans0n/compose-rules/issues
   Repository     : https://github.com/mrmans0n/compose-rules
    at com.pinterest.ktlint.rule.engine.internal.RuleExecutionContext.executeRule(RuleExecutionContext.kt:64)
    at com.pinterest.ktlint.rule.engine.api.KtLintRuleEngine$lint$3.invoke(KtLintRuleEngine.kt:100)
    at com.pinterest.ktlint.rule.engine.api.KtLintRuleEngine$lint$3.invoke(KtLintRuleEngine.kt:99)
    at com.pinterest.ktlint.rule.engine.internal.VisitorProvider$visitor$3.invoke(VisitorProvider.kt:46)
    at com.pinterest.ktlint.rule.engine.internal.VisitorProvider$visitor$3.invoke(VisitorProvider.kt:44)
    at com.pinterest.ktlint.rule.engine.api.KtLintRuleEngine.lint(KtLintRuleEngine.kt:99)
    at com.pinterest.ktlint.cli.internal.KtlintCommandLine.lint(KtlintCommandLine.kt:544)
    at com.pinterest.ktlint.cli.internal.KtlintCommandLine.process(KtlintCommandLine.kt:469)
    at com.pinterest.ktlint.cli.internal.KtlintCommandLine.access$process(KtlintCommandLine.kt:61)
    at com.pinterest.ktlint.cli.internal.KtlintCommandLine$lintFiles$3.invoke$lambda$0(KtlintCommandLine.kt:412)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
    at java.base/java.lang.Thread.run(Thread.java:1623)
Caused by: java.lang.IllegalStateException: Unable to find config key `compose_content_emitters`. Make sure it is defined in the KtlintRule `editorConfigProperties` property.
    at io.nlopez.rules.core.ktlint.KtlintComposeKtConfig.find(KtlintComposeKtConfig.kt:48)
    at io.nlopez.rules.core.ktlint.KtlintComposeKtConfig.access$find(KtlintComposeKtConfig.kt:16)
    at io.nlopez.rules.core.ktlint.KtlintComposeKtConfig$getList$1.invoke(KtlintComposeKtConfig.kt:34)
    at io.nlopez.rules.core.ktlint.KtlintComposeKtConfig$getList$1.invoke(KtlintComposeKtConfig.kt:33)
    at io.nlopez.rules.core.ktlint.KtlintComposeKtConfig.getValueAsOrPut(KtlintComposeKtConfig.kt:24)
    at io.nlopez.rules.core.ktlint.KtlintComposeKtConfig.getList(KtlintComposeKtConfig.kt:33)
    at io.nlopez.rules.core.ktlint.KtlintComposeKtConfig$getSet$1.invoke(KtlintComposeKtConfig.kt:38)
    at io.nlopez.rules.core.ktlint.KtlintComposeKtConfig$getSet$1.invoke(KtlintComposeKtConfig.kt:38)
    at io.nlopez.rules.core.ktlint.KtlintComposeKtConfig.getValueAsOrPut(KtlintComposeKtConfig.kt:24)
    at io.nlopez.rules.core.ktlint.KtlintComposeKtConfig.getSet(KtlintComposeKtConfig.kt:38)
    at io.nlopez.rules.core.util.ComposablesKt.getEmitsContent(Composables.kt:49)
    at io.nlopez.compose.rules.ComposeMultipleContentEmitters$Companion.getDirectUiEmitterCount$common(ComposeMultipleContentEmitters.kt:71)
    at io.nlopez.compose.rules.ComposeContentEmitterReturningValues.visitFile(ComposeContentEmitterReturningValues.kt:28)
    at io.nlopez.compose.rules.ktlint.ComposeContentEmitterReturningValuesCheck.visitFile(ComposeContentEmitterReturningValuesCheck.kt)
    at io.nlopez.rules.core.ktlint.KtlintRule.beforeVisitChildNodes(KtlintRule.kt:55)
    at com.pinterest.ktlint.rule.engine.internal.RuleExecutionContext$executeRuleOnNodeRecursively$1.invoke(RuleExecutionContext.kt:93)
    at com.pinterest.ktlint.rule.engine.internal.RuleExecutionContext$executeRuleOnNodeRecursively$1.invoke(RuleExecutionContext.kt:92)
    at com.pinterest.ktlint.rule.engine.internal.SuppressHandler.handle-dhiVX_g(SuppressHandler.kt:28)
    at com.pinterest.ktlint.rule.engine.internal.RuleExecutionContext.executeRuleOnNodeRecursively(RuleExecutionContext.kt:92)
    at com.pinterest.ktlint.rule.engine.internal.RuleExecutionContext.executeRule(RuleExecutionContext.kt:61)
    ... 13 more