Giter Site home page Giter Site logo

lintdemo's Introduction

LintStudy

为什么需要自定义Lint

  • 原生Lint无法满足团队特有的需求,如:编码规范

  • 原生Lint存在一些检测缺陷或者缺少一些我们认为有必要的检测,如new Message等

自定义Lint,主要完成了以下功能

  • Actvity、Fragment布局文件名称前缀为actvity_fragment_的检查
  • Log、System.out.pritln打印必须为工程中自定义的AppLog检查(这个因项目而异)
  • 检测new Message,提醒使用Message.Obtain()/handler.obtainMessage
  • xml文件中各种控件命名规范化,如Buttion前缀为btn,适合规范化编程

依赖方式

采用LinkedIn提供了另一种思路 : 将jar放到一个aar中。这样我们就可以针对工程进行自定义Lint,lint.jar只对当前工程有效,使用前记得开启AS的支持自定义Lint检查功能,如下图

部分效果示意图

lintdemo's People

Contributors

xsfelvis avatar

Watchers

James Cloos avatar zhandroids 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.