CheckstyleExtension

Checkstyle 插件的配置选项。

属性

属性描述
config

要使用的 Checkstyle 配置。替换 configFile 属性。

configDirectory

其他 Checkstyle 配置文件路径。默认情况下,此路径为 $rootProject.projectDir/config/checkstyle

configFile

要使用的 Checkstyle 配置文件。

configProperties

可在配置文件中使用的属性。这些属性将替换到配置文件中。

enableExternalDtdLoad
孵化中

启用在配置中使用自定义 DTD 文件并从本项目中所有 Checkstyle 任务的某个位置加载它们的功能。由于安全原因,默认禁用。有关更多详细信息,请参见 Checkstyle 文档

ignoreFailures

是否存在警告时是否允许继续构建。示例:ignoreFailures = true

maxErrors

在中断构建或设置失败属性之前可容忍的最大错误数。默认为 0

maxWarnings

在中断构建或设置失败属性之前可容忍的最大警告数。默认为 Integer.MAX_VALUE

reportsDir

报告的生成目录。

showViolations

是否在控制台上显示规则违规。默认为 true。示例:showViolations = false

sourceSets

作为 checkbuild 任务一部分进行分析的源集。

toolVersion

要使用的代码质量工具的版本。

方法

无方法

脚本块

无脚本块

属性详情

要使用的 Checkstyle 配置。替换 configFile 属性。

默认与 checkstyle 插件一起使用
${configDirectory}/checkstyle.xml

DirectoryProperty configDirectory

其他 Checkstyle 配置文件路径。默认情况下,此路径为 $rootProject.projectDir/config/checkstyle

此路径将作为变量 config_loc 在 Checkstyle 的配置文件中公开。

默认与 checkstyle 插件一起使用
${rootProject.projectDir}/config/checkstyle

File configFile

要使用的 Checkstyle 配置文件。

默认与 checkstyle 插件一起使用
${configDirectory}/checkstyle.xml

Map<String, Object> configProperties

可在配置文件中使用的属性。这些属性将替换到配置文件中。

默认与 checkstyle 插件一起使用
[:]

Property<Boolean> enableExternalDtdLoad

注意:此属性处于孵化中,可能会在 Gradle 的未来版本中更改。

启用在配置中使用自定义 DTD 文件并从本项目中所有 Checkstyle 任务的某个位置加载它们的功能。由于安全原因,默认禁用。有关更多详细信息,请参见 Checkstyle 文档

默认与 checkstyle 插件一起使用
false

boolean ignoreFailures

是否存在警告时是否允许继续构建。示例:ignoreFailures = true

默认值
false

int maxErrors

在中断构建或设置失败属性之前可容忍的最大错误数。默认为 0

示例:maxErrors = 42

默认与 checkstyle 插件一起使用
0

int maxWarnings

在中断构建或设置失败属性之前可容忍的最大警告数。默认为 Integer.MAX_VALUE

示例:maxWarnings = 1000

默认与 checkstyle 插件一起使用
Integer.MAX_VALUE

File reportsDir

报告的生成目录。

boolean showViolations

是否在控制台上显示规则违规。默认为 true。示例:showViolations = false

默认与 checkstyle 插件一起使用
true

Collection<SourceSet> sourceSets

作为 checkbuild 任务一部分进行分析的源集。

默认值
project.sourceSets

String toolVersion

要使用的代码质量工具的版本。