翻译项目请关注Github上的地址:
https://github.com/msdx/gradledoc
本文翻译所在分支:
https://github.com/msdx/gradledoc/tree/2.0 。
在线浏览地址:
http://gradledoc.qiniudn.com/2.0/userguide/userguide.html 。
另外,Android 手机用户可通过我写的一个程序浏览文档,带缓存功能的,目前0.6开发中版本兼容 Android 2.3以上系统,项目地址如下:
https://github.com/msdx/gradle-doc-apk
翻译不易,转载请注明本文在CSDN博客上的出处:

https://blog.csdn.net/maosidiaoxian/article/details/84935563

关于我对Gradle的翻译,以Github上的项目及http://gradledoc.qiniudn.com 上的文档为准。如发现翻译有误的地方,将首先在以上两个地方更新。因时间精力问题,博客中发表的译文基本不会同步修改。

 

第二十九章. Checkstyle 插件

Chapter 29. The Checkstyle Plugin

Checkstyle 插件使用 Checkstyle 对你的项目的 Java 源文件执行质量检查,并从这些检查结果生成报告。 
The Checkstyle plugin performs quality checks on your project's Java source files using Checkstyle and generates reports from these checks.

29.1. 用法

29.1. Usage

要使用 Checkstyle 插件,请在构建脚本中包含以下内容:
To use the Checkstyle plugin, include in your build script:

示例 29.1. 使用 Checkstyle 插件 - Example 29.1. Using the Checkstyle plugin

build.gradle

apply plugin: 'checkstyle'

该插件向项目添加了许多执行质量检查的任务。你可以通过运行 gradle check 来执行这些检查。
The plugin adds a number of tasks to the project that perform the quality checks. You can execute the checks by running gradle check.

29.2. 任务

29.2. Tasks

Checkstyle 插件将以下任务添加到项目中:
The Checkstyle plugin adds the following tasks to the project:

表 29.1. Checkstyle 插件——插件 - Table 29.1. Checkstyle plugin - tasks

任务名称
Task name
依赖于
Depends on
类型
Type
描述
Description
checkstyleMainclassesCheckstyle针对生产 Java 源文件运行 Checkstyle。
Runs Checkstyle against the production Java source files.
checkstyleTesttestClassesCheckstyle针对测试 Java 源文件运行 Checkstyle。
Runs Checkstyle against the test Java source files.
checkstyleSourceSetsourceSetClassesCheckstyle针对给定源集的 Java 源文件运行 Checkstyle。
Runs Checkstyle against the given source set's Java source files.

Checkstyle 插件向 Java 插件所定义的任务添加了以下依赖。
The Checkstyle plugin adds the following dependencies to tasks defined by the Java plugin.

表 29.2. Checkstyle 插件——额外的任务依赖 - Table 29.2. Checkstyle plugin - additional task dependencies

任务名称
Task name
依赖于
Depends on
check所有 Checkstyle 任务,包括 checkstyleMain 和 checkstyleTest
All Checkstyle tasks, including checkstyleMain and checkstyleTest.

29.3. 项目布局

29.3. Project layout

Checkstyle 插件希望是以下的项目布局:
The Checkstyle plugin expects the following project layout:

表 29.3. Checkstyle 插件——项目布局 - Table 29.3. Checkstyle plugin - project layout

File意义
Meaning
config/checkstyle/checkstyle.xmlCheckstyle 配置文件
Checkstyle configuration file

29.4. 依赖管理

29.4. Dependency management

Checkstyle 插件添加了以下依赖配置:
The Checkstyle plugin adds the following dependency configurations:

表29.4. Checkstyle 插件——依赖配置 - Table 29.4. Checkstyle plugin - dependency configurations

名称
Name
意义
Meaning
checkstyle要使用的 Checkstyle 库
The Checkstyle libraries to use

29.5. 配置

29.5. Configuration

请参阅 CheckstyleExtension
See CheckstyleExtension.

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐