question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question for failed of step ktlintMainSourceSetCheck

See original GitHub issue

Hi,

Thank you for make by good lint tool.

I will plan for using kotlin in production code, I have some issue.

I need to lint tool for kotlin code. So, I decided this tool use.

It’s use and then build failed.

It’s failed ktlintMainSourceSetCheck in build step.

  • Kotlin version: 1.3.50
  • Ktlint version: 9.2.1
  • Java version: 1.8.222 (openjdk)
Exception in thread "main" java.util.concurrent.ExecutionException: java.lang.ClassCastException: org.jetbrains.kotlin.com.intellij.psi.impl.file.PsiLargeTextFileImpl cannot be cast to org.jetbrains.kotlin.psi.KtFile
	at java.util.concurrent.FutureTask.report(FutureTask.java:122)
	at java.util.concurrent.FutureTask.get(FutureTask.java:192)
	at com.pinterest.ktlint.KtlintCommandLine.parallel(Main.kt:531)
	at com.pinterest.ktlint.KtlintCommandLine.parallel$default(Main.kt:505)
	at com.pinterest.ktlint.KtlintCommandLine.lintFiles(Main.kt:264)
	at com.pinterest.ktlint.KtlintCommandLine.run(Main.kt:232)
	at com.pinterest.ktlint.Main.main(Main.kt:61)
Caused by: java.lang.ClassCastException: org.jetbrains.kotlin.com.intellij.psi.impl.file.PsiLargeTextFileImpl cannot be cast to org.jetbrains.kotlin.psi.KtFile
	at com.pinterest.ktlint.core.KtLint.lint(KtLint.kt:137)
	at com.pinterest.ktlint.internal.FileUtilsKt.lintFile(FileUtils.kt:51)
	at com.pinterest.ktlint.KtlintCommandLine.process(Main.kt:357)
	at com.pinterest.ktlint.KtlintCommandLine.access$process(Main.kt:115)
	at com.pinterest.ktlint.KtlintCommandLine$lintFiles$2$1.call(Main.kt:256)
	at com.pinterest.ktlint.KtlintCommandLine$lintFiles$2$1.call(Main.kt:115)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

> Task :apps:api:ktlintMainSourceSetCheck FAILED

Why cause this situation?

You need to help me.

Thank you.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
Tapchicomacommented, Mar 8, 2020

@seungdols take care of yourself, it is not urgent.

2reactions
Tapchicomacommented, Feb 20, 2020

Theoretically tasks should only take .kt or .kts files based on this line: https://github.com/JLLeitschuh/ktlint-gradle/blob/cac79c462a90e5806352907fd80d08ed4ecb13dd/plugin/src/main/kotlin/org/jlleitschuh/gradle/ktlint/BaseKtlintCheckTask.kt#L126

Could it be that you try to configure SourceTask in your project setup?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Question for failed of step ktlintMainSourceSetCheck #698
It's failed ktlintMainSourceSetCheck in build step. Kotlin version: 1.3.50; Ktlint version: 9.2.1; Java version: 1.8.222 (openjdk). Exception ...
Read more >
Ktlint error in Android build with multiple flavors - Stack Overflow
When I run ktlintCheck my build fails with the following error: ... at org.gradle.internal.execution.steps. ... Improve this question.
Read more >
Formatting Android code with Ktlint and Git Hooks | by Barros
It is a solution for this problem, with ktlint and git hooks we can check if code is correctly formatted and ... Task...
Read more >
How to fix "Execution failed for task ':app ... - GeeksforGeeks
Step 1: Open your app's build.gradle (not the one in the project root). · Step 2: Add this Code Snippet.
Read more >
'org.jlleitschuh.gradle.ktlint', version: '10.1.0'] : KT-47116
What steps will reproduce the issue? ... I get below error ... Could not create task ':ktlintMainSourceSetCheck'. at org.gradle.api.internal.tasks.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found