当前位置: 首页 > 工具软件 > CodeNarc > 使用案例 >

Gradle 2.0 用户指南翻译——第三十章. CodeNarc 插件

太叔乐家
2023-12-01

翻译项目请关注Github上的地址:
https://github.com/msdx/gradledoc
本文翻译所在分支:
https://github.com/msdx/gradledoc/tree/2.0 。
在线浏览地址:
http://gradledoc.githang.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/84973184

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

 

第三十章. CodeNarc 插件

Chapter 30. The CodeNarc Plugin

CodeNarc 插件使 用CodeNarc对项目的 Groovy 源文件执行质量检查并生成报告。 
The CodeNarc plugin performs quality checks on your project's Groovy source files using CodeNarc and generates reports from these checks.

30.1. 用法

30.1. Usage

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

示例 30.1. 使用 CodeNarc 插件 - Example 30.1. Using the CodeNarc plugin

build.gradle

apply plugin: 'codenarc'

该插件向项目添加了许多执行质量检查的任务。你可以通过运行 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.

30.2. 任务

30.2. Tasks

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

表 30.1. CodeNarc 插件——任务 - Table 30.1. CodeNarc plugin - tasks

任务名称
Task name
依赖于
Depends on
类型
Type
描述
Description
codenarcMain-CodeNarc针对 Groovy 的生产源文件运行 CodeNarc。
Runs CodeNarc against the production Groovy source files.
codenarcTest-CodeNarc针对 Groovy 的测试源文件运行 CodeNarc。
Runs CodeNarc against the test Groovy source files.
codenarcSourceSet-CodeNarc针对给定的源的 Groovy 源文件运行 CodeNarc。
Runs CodeNarc against the given source set's Groovy source files.

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

表 30.2. CodeNarc 插件——附加的任务依赖 - Table 30.2. CodeNarc plugin - additional task dependencies

任务名称
Task name
依赖于
Depends on
check所有的 CodeNarc 任务,包括 codenarcMain 和 codenarcTest
All CodeNarc tasks, including codenarcMain and codenarcTest.

30.3. 项目布局

30.3. Project layout

CodeNarc 插件需要以下的项目布局:
The CodeNarc plugin expects the following project layout:

表 30.3. CodeNarc 插件——项目布局 - Table 30.3. CodeNarc plugin - project layout

File意义
Meaning
config/codenarc/codenarc.xmlCodeNarc 配置文件
CodeNarc configuration file

30.4. 依赖管理

30.4. Dependency management

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

表30.4. CodeNarc 插件——依赖配置 - Table 30.4. CodeNarc plugin - dependency configurations

名称
Name
意义
Meaning
codenarc使用的 CodeNarc 库
The CodeNarc libraries to use

30.5. 配置

30.5. Configuration

请参阅 CodeNarcExtension
See CodeNarcExtension.

 类似资料: