我正在尝试从给klint错误中删除生成源目录,否则添加几个排除脚本作为替代。
从这里开始,我想我们可以在gradle https://github.com/JLLeitschuh/ktlint-gradle/issues/97做这个
gradle中的这个特性如下所示
ktlint {
filter {
exclude("**/generated/**")
include("**/kotlin/**")
}
} 到目前为止,我已经尝试过在Maven中这样做,但是它仍然可以在一些不可避免的生成源上进行分析。https://github.com/gantsign/ktlint-maven-plugin/issues/341
<sourcesExcludes>
<sourcesExcludes>directoryToExclude<sourcesExclude>
</sourcesExcludes>以上在maven插件中的使用
<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>任何关于我如何排除生成的源文件目录的帮助都是非常感谢的。
发布于 2022-02-09 07:13:13
我在这里找到了解决方案,https://github.com/gantsign/ktlint-maven-plugin/issues/341
我们只需在下面使用以避免目标文件。
<configuration>
<sourceRoots>${project.build.sourceDirectory}</sourceRoots>
</configuration>https://stackoverflow.com/questions/71045122
复制相似问题