CheckStyle

Gradle 設定


專案的 Gradle 需要加上 checkstyletask

在 fly/build.gradle 新增以下

repositories {
    mavenCentral() // 這一行.
}
apply plugin: 'checkstyle'
task checkstyle(type: Checkstyle) {
    //toolVersion = "2.0.1"
    ignoreFailures = true
    //config= files("$rootProject.projectDir/config/checkstyle/checkstyle.xml")
    source = fileTree('src/main/java')
    classpath = files()
    reports{
        xml {
            destination "build/checkstyle-result.xml"
        }
    }
}

設定檔


將 checkstyle.xml 放在 fly/config/checkstyle 裡面,內容如下

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC  
   "-//Puppy Crawl//DTD Check Configuration 1.3//EN"  
    "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
    <module name="FileTabCharacter" />
    <module name="TreeWalker">
        <module name="UnusedImports" />
    </module>
</module>

安裝


設定


報告


results matching ""

    No results matching ""