You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ktlint should report an error of no-consecutive-blank-lines violation
Observed Behavior
NPE
~/workspace > vim dummy.kt 48s 16:32:07
~/workspace > ktlint dummy.kt 5s 16:32:18
dummy.kt:1:23: Internal Error (rule 'standard:no-consecutive-blank-lines') in dummy.kt at position '1:23. 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 'standard:no-consecutive-blank-lines' throws exception in file 'dummy.kt' at position (1:23)
Rule maintainer: KtLint
Issue tracker : https://github.com/pinterest/ktlint/issues
Repository : https://github.com/pinterest/ktlint
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:542)
at com.pinterest.ktlint.cli.internal.KtlintCommandLine.process(KtlintCommandLine.kt:467)
at com.pinterest.ktlint.cli.internal.KtlintCommandLine.access$process(KtlintCommandLine.kt:64)
at com.pinterest.ktlint.cli.internal.KtlintCommandLine$lintFiles$3.invoke$lambda$0(KtlintCommandLine.kt:416)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.NullPointerException: Cannot invoke "org.jetbrains.kotlin.com.intellij.lang.ASTNode.getElementType()" because the return value of "org.jetbrains.kotlin.com.intellij.lang.ASTNode.getTreeNext()" is null
at com.pinterest.ktlint.ruleset.standard.rules.NoConsecutiveBlankLinesRule.isBetweenClassAndPrimaryConstructor(NoConsecutiveBlankLinesRule.kt:65)
at com.pinterest.ktlint.ruleset.standard.rules.NoConsecutiveBlankLinesRule.beforeVisitChildNodes(NoConsecutiveBlankLinesRule.kt:30)
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.access$executeRuleOnNodeRecursively(RuleExecutionContext.kt:29)
at com.pinterest.ktlint.rule.engine.internal.RuleExecutionContext$executeRuleOnNodeRecursively$2$1.invoke(RuleExecutionContext.kt:100)
at com.pinterest.ktlint.rule.engine.internal.RuleExecutionContext$executeRuleOnNodeRecursively$2$1.invoke(RuleExecutionContext.kt:99)
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:99)
at com.pinterest.ktlint.rule.engine.internal.RuleExecutionContext.executeRule(RuleExecutionContext.kt:61)
... 13 more
Steps to Reproduce
Create a file with just :
sealedclassHello
run ktlint on the file
Your Environment
Version of ktlint used: 0.49.0
Relevant parts of the .editorconfig settings: None
Name and version (or code for custom task) of integration used (Gradle plugin, Maven plugin, command line, custom Gradle task): CLI
Version of Gradle used (if applicable): N/A
Operating System and version: MacOS
The text was updated successfully, but these errors were encountered:
Expected Behavior
Ktlint should report an error of
no-consecutive-blank-lines
violationObserved Behavior
NPE
Steps to Reproduce
Your Environment
.editorconfig
settings: NoneThe text was updated successfully, but these errors were encountered: