Git Product home page Git Product logo

easelint's Introduction

EaseLint

EaseLint是对Android Lint的二次开发,通过Hook AGP 源码来实现自定义扫描功能。你可以用它快速在开发工作流中搭建起Lint扫描, 或者作为一个学习kts构建,AGP开发,熟悉AGP源码的练习项目。

从实践来看,每个团队的CI技术服务技术栈都存在较大区别,标准化服务与适应性不可兼得,EaseLint也是一样, 你需要熟悉它的每个环节,以适合当下环境的方式引入你的团队。

Tips: 关于首次编译的"请在local.properties添加私有仓库的用户名(repositoryUserName)和密码(repositoryPassword)" 这是用于发布的私有密钥,如果无需发布注释掉 整个 publishing 代码即可

AGP 4.x ✅

lintPlugin Lint-gradle Lint-checks

功能名称 完成状态 备注
自定义扫描文件目标 无反射
动态修改LintOptions 无反射
基于Git diff 抓取目标文件 支持基于分支与commitId
动态导入 lint-checks
结果解析

AGP 7.x ✅

lintPlugin lint-api module

功能名称 完成状态 备注
自定义扫描文件目标 无反射
动态修改LintOptions 无反射
基于Git diff 抓取目标文件 支持基于分支与commitId
动态导入 lint-checks
结果解析 -

使用

4.x 版本支持外部指定扫描目标,7.x 之后不再支持,只提供给予分支或commitId进行diff的方式

  • 引入插件
plugins {
    id("com.android.application")
    id("org.jetbrains.kotlin.android")
    //一定要晚于 com.android.application 插件
    id("ease.lint")
}
  • 方式1:命令行传参(参数优先级高于module内的配置)
./gradlew easeLint 
 -PfileWhiteList="src/main/java/com/example1,src/main/java/com/example2"
 -PsuffixWhiteList="md,xml"
 -PcompareBranch="master"
 -PcompareCommitId="id12345"
  • 方式2:module 配置
easeLintExt {
    fileWhiteList = LinkedList<String>().apply {
        add("buildSrc/src/main/java/com/buildsrc")
    }
    suffixWhiteList = LinkedList<String>().apply {
        add(".md")
    }
    setGitDiffConfig("main", "")
}

lint-code-backup 目录说明

AndroidLintAnalysisTask为APG 7.x 中的核心Lint task,内部创建了 lint 运行的arguments,此目录下的3个文件为hook AndroidLintAnalysisTask 时解决了全部包引用的问题。

  • buildSrc 需要的依赖库
    implementation("com.android.tools.build:gradle:7.4.2")
    implementation(kotlin("stdlib"))
    compileOnly("com.android.tools.lint:lint-api:30.4.2")
    compileOnly("com.android.tools.lint:lint:30.4.2")
    compileOnly("com.android.tools.lint:lint-model:30.4.2")
    compileOnly("com.android.tools:common:30.4.2")
    compileOnly("com.android.tools:sdk-common:30.4.2")

easelint's People

Contributors

juziml avatar lijingjiu123 avatar

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.