Git Product home page Git Product logo

okcheck's Introduction

OkCheck

Download

Incremental scan,integrate Lint、KtLint、UnitTest、Checkstyle、Findbugs、Pmd, powerful and easy to use.

中文文档

Basic Incremental Scan

  • Base on the Git version control, compare to the latest success scan => Only scan the changed module
  • Base on the local build cache => If there isn't any change compare to the last scan tasks will finish with up-to-data as far as possible

Example

How to Import

On the build.gradle at your root project:

buildscript {
    dependencies {
        classpath 'com.liulishuo.okcheck:gradle:0.2.8'
    }
}

allprojects {
    apply plugin: 'okcheck'
}

Done! Everything is ready to scan, now you can check with 6 job just run ./gradlew okcheckDebug and just see result, and all report is settle down the build/reports for the root project as default(But if you want all reports save on the origin directory, just set destination to project.buildDir).

There is Snapshot version also valid, if you want to use snapshot version, please add repository on the build.gradle:

buildscript {
  repositories {
      maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
  }
}

Task Description

When you run okcheck task, we will compile and check with all variant(As usual, there are two variant as debug and release), so, normally you just need to check with one variant to increase scan speed, such as okcheckDebug.

  • ./gradlew okcheckDebug: Run the okcheck task for the Debug build type.
  • ./gradlew cleanOkcheckDiff: Clean all cached success commit id(which is on the ~/.okcheck folder as default), since then the next time we will scan all module.
  • ./gradlew -PignoreOkcheckDiff okcheck: Run the okcheck task and ignore cached success commit id, which will raise run okcheck for whole module.
  • ./gradlew -PignoreOkCheckDiff :module1:okcheck: Run the okcheck task for the module1 and ignore its cached success commit id, which will raise run okcheck certainly even if there isn't any change compare to last success scan.

How to Customize

For the convenient, all value on the bellow is the default value as example, the follow code is write on the build.gradle at the root project.

allprojects {
    apply plugin: 'okcheck'

    okcheck {
        exclude = ['**/proto/*.java']
        destination = project.rootProject.buildDir

        unittest {
            enabled = true
        }
        lint {
            enabled = true
            exclude = ['**/proto/*.java']

        }
        ktlint {
            enabled = true
            exclude = ['**/proto/*.java']
            version = "0.22.0"
        }
        checkstyle {
            enabled = true
            exclude = ['**/proto/*.java']
            // We will use the default config build-in the okcheck
            configFile = null
        }
        findbugs {
            enabled = true
            exclude = ['**/proto/*.java']

            effort = "default"

            // Whether allow the build to continue if there are warnings
            ignoreFailures = false
            // We will use the default excludeFilter file build-in the okcheck
	    excludeFilter = null
        }
        pmd {
            enabled = true
            exclude = ['**/proto/*.java']

            // Whether allow the build to continue if there are warnings
            ignoreFailures = false
            // We will use the default ruleSetFiles build-in the okcheck
            ruleSetFiles = null
        }

        coverageReport {
            xml.enabled = false
            html.enabled = false 
            csv.enabled = false
        }
    }
}

Others

  • As you know, the first time of running okcheck will check all module as default
  • If you want to suppress some methods or lines for checkstyle task, as default build-in checkstyle config, you just need to add suppressions.xml file on your root project directory and define them on it.

Exclude

Following paths are exclude on checkstyle, findbugs, pmd as default:

**/gen/**
**/test/**
**/proto/*.java
**/protobuf/*.java
**/com/google/**/*.java

LICENSE

Copyright (c) 2018 LingoChamp Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

okcheck's People

Contributors

jacksgong avatar moomoon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

okcheck's Issues

incrementalLint invalidate for def inputFiles = Util.getAllInputs(project)

def inputFiles = Util.getAllInputs(project) //where change file?

    project.task(getTaskName(flavor, buildType), type: OkLint) {
        dependsOn getOriginTaskName(flavor, buildType)
        inputs.files(inputFiles)
        outputs.file(outputFile)

        setGroup("verification")
        if (flavor.length() <= 0 && buildType.length() <= 0) {
            setDescription("Run lint incremental for all variants")
        } else {
            setDescription("Run lint incremental for $flavor$buildType build.")
        }
    }

    String originTaskName = getOriginTaskName(flavor, buildType)//lint
    Set<Task> originTasks = project.getTasksByName(originTaskName, false)
    Task originTask = null
    if (originTasks != null && originTasks.size() > 0) originTask = originTasks[0]
    if (originTask == null) {
        project.tasks.whenTaskAdded { task ->
            if (task.name == originTaskName) {
                if (incrementalLint) addIncrementalAndReport(project, task, inputFiles, outputFile)
            }
        }
    } else {
        if (incrementalLint) addIncrementalAndReport(project, originTask, inputFiles, outputFile) //where change file?
    }

.okcheck folder dir is not create

static String okcheckHomePath(Project project) {
File firstCandidate = new File(project.rootProject.absoluteProjectPath("/.okcheck")) //:.okcheck
if (firstCandidate.exists()) return firstCandidate.absolutePath

    return "${System.getProperty("user.home")}/.okcheck"  
}

//here is false forever
private static boolean isFirstBlood(Project project) {//okcheck is exist
String projectHomePath = "${ChangeFile.okcheckHomePath(project)}/${project.rootProject.name}"
// not exist means first time to invoke okcheck(maybe just clean time).
return !new File(projectHomePath).exists()
}

求助:配置不对吗?

image
配置入上图;
插件版本
classpath 'com.liulishuo.okcheck:gradle:0.2.0'

错误信息:
image


去掉

exclude = ['**/proto/*.java']
destination = project.rootProject.buildDir

错误信息:
image

我是不是哪儿用的不对?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.