我正在尝试在一个使用Kotlin和detekt-maven-plugin的多模块Maven项目中使用detekt。
按照found here的说明生成一个包含现有问题的基线,我尝试运行:
mvn detekt:cb -Ddetekt.debug=true然而,这似乎并没有产生所提到的baseline.xml文件。
发布于 2020-01-17 16:52:00
原来,在生成基线时必须指定基线文件名:
mvn detekt:cb -Ddetekt.baseline=baseline.xml由于代码库已经有相当多的问题被detekt发现,我还必须使用自定义的detekt配置文件并增加允许的问题的数量-否则构建将失败,并且根本不会生成基线。
总而言之,以下配置使其正常工作:
detekt配置文件:
build:
maxIssues: 1000基线生成后的插件配置:
<plugin>
<groupId>com.github.ozsie</groupId>
<artifactId>detekt-maven-plugin</artifactId>
<version>1.1.1</version>
<configuration>
<baseline>detekt-baseline.xml</baseline>
<config>detekt-config.yml</config>
<buildUponDefaultConfig>true</buildUponDefaultConfig>
</configuration>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>生成基线后,可以将配置文件中的maxIssuses值降低到适当的值。
https://stackoverflow.com/questions/59783938
复制相似问题