Gradle 1.12 User Guide translation-Chapter 2. CodeNarc plug-in, gradlecodenarc
For translation of other chapters, see:
Http://blog.csdn.net/column/details/gradle-translation.html
Please pay attention to the address on Github for translation projects:
Https://github.com/msdx/gradledoc/tree/1.12.
To view the bilingual documents directly, visit:
Http://gradledoc.qiniudn.com/1.12/userguide/userguide.html.
In addition, Android mobile users can browse documents through a program I have written, with the cache function. Currently, Android 0.2 is compatible with Android 2.1 and later versions (not tested in versions 5.0 and later). The address is as follows:
Http://www.wandoujia.com/apps/com.githang.gradledoc
It is not easy to translate. For more information, see the source of this article on the CSDN blog:
Http://blog.csdn.net/maosidiaoxian/article/details/45640323
For my translations of Gradle, refer to the project on Github and documents on the http://gradledoc.qiniudn.com. If any translation error is found, it will be updated in the above two places first. Due to time and energy problems, the translations published in the blog are basically not modified simultaneously.
Chapter 2. CodeNarc plug-in
The CodeNarc plug-in uses CodeNarc to perform quality checks on the Groovy source files of the project and generate reports.
30.1. Usage
To use the CodeNarc plug-in, include the following statement in the build script:
Example 30.1. Use the CodeNarc plug-in
build.gradle
apply plugin: 'codenarc'
This plug-in adds a large number of quality check tasks to your project. You can rungradle check
Run the check.
30.2. Task
The CodeNarc plug-in adds the following tasks to the project:
Table 30.1. CodeNarc plug-in-task
Task Name |
Dependent on |
Type |
Description |
codenarcMain |
- |
codenarc |
Run CodeNarc for the Groovy source file. |
codenarcTest |
- |
codenarc |
Run CodeNarc for the Groovy source file. |
codenarcSourceSet |
- |
codenarc |
Run CodeNarc for the Groovy source file of the given source set. |
The CodeNarc plug-in adds the following dependencies to the tasks added to the Groovy plug-in.
Table 30.2. CodeNarc plug-in-attached task dependencies
Task Name |
Dependent on |
check |
All CodeNarc tasks, includingcodenarcMain AndcodenarcTest . |
30.3. Project Layout
The CodeNarc plug-in is expected to have the following project layout:
Table 30.3. CodeNarc plug-in-Project Layout
File |
Meaning |
config/codenarc/codenarc.xml |
CodeNarc configuration file |
30.4. Dependency Management
The CodeNarc plug-in adds the following dependency configurations:
Table 30.4. CodeNarc plug-in-dependency Configuration
Name |
Meaning |
codenarc |
CodeNarc library used |
30.5. Configuration
SeeCodeNarcExtension
.