Issue
I am trying to remove generate-sources directory from giving klint errors, else adding a few scripts in exclude as an alternative
From here I figured we could do this in gradle https://github.com/JLLeitschuh/ktlint-gradle/issues/97
This feature in gradle is shown as follows
ktlint {
filter {
exclude("**/generated/**")
include("**/kotlin/**")
}
}
So far I have tried doing this in Maven, but it still does linting on some unavoidable generated sources. https://github.com/gantsign/ktlint-maven-plugin/issues/341
<sourcesExcludes>
<sourcesExcludes>directoryToExclude<sourcesExclude>
</sourcesExcludes>
Using above in maven plugin
<plugin>
<groupId>com.github.gantsign.maven</groupId>
<artifactId>ktlint-maven-plugin</artifactId>
<version>1.7.0</version>
<executions>
<execution>
<configuration>
<sourcesExcludes>
<sourcesExclude>**/generated-sources/graphql/com/expediagroup/dataquality/api/utils/**</sourcesExclude>
</sourcesExcludes>
</configuration>
<phase>prepare-package</phase>
<goals>
<goal>format</goal>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
Any help on how I can exclude generated-sources directory is appreciated.
Solution
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.
<configuration>
<sourceRoots>${project.build.sourceDirectory}</sourceRoots>
</configuration>
Answered By - Akshay Hazari
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.