Skip to content

Exception thrown for blank files? #448

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

Open
enra64 opened this issue Apr 14, 2025 · 2 comments
Open

Exception thrown for blank files? #448

enra64 opened this issue Apr 14, 2025 · 2 comments

Comments

@enra64
Copy link

enra64 commented Apr 14, 2025

Hi! Thanks for the amazing compose rules 🙏

Can you help with the following issue? I'm getting an exception when running with the ktlint intellij plugin whose maintainer asked me to post this here:

An error occurred in a rule. Please see stacktrace below for rule that caused the problem and contact maintainer of the rule when the error can be reproduced. 
com.pinterest.ktlint.rule.engine.api.KtLintRuleException: Rule 'compose:composable-annotation-naming' throws exception in file ' ' 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:78) at 
com.pinterest.ktlint.rule.engine.internal.CodeFormatter.executeRule(CodeFormatter.kt:138) at 
com.pinterest.ktlint.rule.engine.internal.CodeFormatter.format(CodeFormatter.kt:109) at 
com.pinterest.ktlint.rule.engine.internal.CodeFormatter.format(CodeFormatter.kt:58) at 
com.pinterest.ktlint.rule.engine.internal.CodeFormatter.format(CodeFormatter.kt:28) at 
com.pinterest.ktlint.rule.engine.api.KtLintRuleEngine.lint(KtLintRuleEngine.kt:91) at 
com.nbadal.ktlint.KtlintFormatKt.executeKtlint(KtlintFormat.kt:113) at 
com.nbadal.ktlint.KtlintFormatKt.ktlintLint(KtlintFormat.kt:30) at 
com.nbadal.ktlint.KtlintAnnotator.collectInformation(KtlintAnnotator.kt:55) at 
com.nbadal.ktlint.KtlintAnnotator.collectInformation(KtlintAnnotator.kt:27) at 
com.intellij.codeInsight.daemon.impl.ExternalToolPass.collectInformationWithProgress(ExternalToolPass.java:135) at 
com.intellij.codeInsight.daemon.impl.ProgressableTextEditorHighlightingPass.doCollectInformation(ProgressableTextEditorHighlightingPass.java:88) at 
com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:70) at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:435) at com.intellij.platform.diagnostic.telemetry.helpers.TraceKt.use(trace.kt:28) at 
com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$3(PassExecutorService.java:431) at 
com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.tryRunReadAction$lambda$11(AnyThreadWriteThreadingSupport.kt:522) at 
com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.runWithTemporaryThreadLocal(AnyThreadWriteThreadingSupport.kt:204) at 
com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.tryRunReadAction(AnyThreadWriteThreadingSupport.kt:522) at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1064) at 
com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$4(PassExecutorService.java:421) at 
com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$14(CoreProgressManager.java:680) at 
com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:755) at 
com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:711) at 
com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:679) at 
com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:77) at 
com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:420) at 
com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:395) at 
com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.cacheFileTypesInside(FileTypeManagerImpl.java:834) at 
com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$1(PassExecutorService.java:395) at 
com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:197) at 
com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:393) at 
com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:267) at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source) at 
java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source) at 
java.base/java.util.concurrent.ForkJoinPool.scan(Unknown Source) at 
java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source) at 
java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source) 

Caused by: java.lang.AbstractMethodError: Method io/nlopez/compose/rules/ktlint/ComposableAnnotationNamingCheck.beforeVisitChildNodes(Lshadow/org/jetbrains/kotlin/com/intellij/lang/ASTNode;Lkotlin/jvm/functions/Function3;)V is abstract at 
io.nlopez.compose.rules.ktlint.ComposableAnnotationNamingCheck.beforeVisitChildNodes(ComposableAnnotationNamingCheck.kt) at 
com.pinterest.ktlint.rule.engine.internal.RuleExecutionContext.executeRuleWithAutocorrectApproveHandlerOnNodeRecursively(RuleExecutionContext.kt:176) at 
com.pinterest.ktlint.rule.engine.internal.RuleExecutionContext.executeRuleOnNodeRecursively(RuleExecutionContext.kt:102) at com.pinterest.ktlint.rule.engine.internal.RuleExecutionContext.executeRule(RuleExecutionContext.kt:75) ... 37 more

I'm using ktlint 1.5.0 and the plugin version is ktlint-0.26.1-dev-2.2025-01-19_15-53-47 (using dev channel because stable version isn't compatible with current IntelliJ beta).

It seems that the base rules don't mind the blank filename 🤔

Let me know if you need any more info 🙏

@mrmans0n
Copy link
Owner

You'll probably need to use the snapshot version of the compose-rules, as the stable version is not yet built against ktlint 1.5.0. I'm waiting (and starting to lose hope) for a detekt version that supports the current kotlin version to make the release, so in the mean time, snapshots it is, I'm afraid.

@enra64
Copy link
Author

enra64 commented Apr 22, 2025

Thanks for the reply! Where would i get such a snapshot build from? I couldn't find them on maven nor in the github releases 😅

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

No branches or pull requests

2 participants