Kotlinter is not ignoring generated files
See original GitHub issueI have several generated kotlin files in my app (inside a build
directory) which creates kotlin code that ktlint
doesnt like. Since I have no control over the code generation and it is not being checked into git I would like ktlint to ignore the files within the build
directory.
I tried adding several variations of exclude("build/**")
but each time ktlint was failing on the generated files. Is there any way to ignore the build
directory?
Note: I added the exclude directory to "lintKotlinMain"(org.jmailen.gradle.kotlinter.tasks.LintTask::class) {
as stated in the README
Thanks so much!
Issue Analytics
- State:
- Created 2 years ago
- Comments:28 (14 by maintainers)
Top Results From Across the Web
Kotlin exclude ktlint directories in maven - Stack Overflow
I found the solution here https://github.com/gantsign/ktlint-maven-plugin/issues/341. And we just have to use below to avoid target files.
Read more >Exclude Kotlin files from gradle build - Help/Discuss
I want to exclude Kotlin files from a gradle build. ... fine but after converting them to Kotlin the files seem not to...
Read more >Step by Step: How to setup ktlint with spotless? - SourceLevel
Learn how to set up ktlint using spotless. Amadeu Cavalcante shows step by step how to configure ktlint using Gradle and spotless.
Read more >Static Analysis Tools - ktlint - The Android Arsenal
This rule does not apply in a number of situations. ... Check all '.kt' files in 'src/' directory, but ignore files ending with...
Read more >Ktlint
Some rules do allow further configuration, but in all cases a reasonable default is set when not provided. ktlint primarily uses the .editorconfig...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, will add it as an enhancement request. The Gradle Quality plugin has a similar extra param
excludeSources
http://xvik.github.io/gradle-quality-plugin/4.6.0/guide/exclusion/Could you explain how you make it work? Im facing the same issue, Im using a code generator plugin for my Graphql API (DGS codegen from netflix) and everything in goes into the /build/generated path outside the main project, and I cant make it work to ignore it, with ktlint gradle it works like a charm doing this:
But with this plugin it doesnt work at all
We need a standard way to fix this problem…This issue must be open.
EDIT: Found a solution