Code Monkey home page Code Monkey logo

lewis's Introduction

lewis

Rock your Android

Purpose

This is an extension for Android Lint, adding new rules:

  • RootPackage : Every .java file must be inside a custom package, not inside the root package. ERROR
  • MissingLauncher : Every application must have at least one launcher activity. WARNING
  • MoreThanOneLauncher : The application must have only one launcher activity. WARNING
  • LauncherActivityInLibrary : A library must not have a launcher activity. ERROR
  • IconInLibrary : A library must not have icons. ERROR
  • PermissionUsageInLibrary : A library must not use permissions. ERROR
  • InstanceVariableName : Every instance variable must be named beginning with 'm' and using camelCase. WARNING
  • ClassConstantName : Every class constant (static and final) must be named using UPPER_SNAKE_CASE. WARNING
  • HardcodedText : A string cannot be hardcoded inside layouts or menus. Now this is an error, not a warning. ERROR
  • LayoutIDFormat : Every id inside layouts or menus must be named using lowerCamelCase. ERROR

Exceptions to InstanceVariableName rule:

  1. The class is a model (should be inside a package called 'models').
  2. The variable is declared using @Bind or @InjectView (ButterKnife).

Getting started

Clone this repository

git clone https://github.com/inaka/lewis.git

Enter to the project

cd lewis/

Build it

./gradlew build

Install it

./gradlew install

Verify whether the issues are registered with lint

lint --show RootPackage

Go to any Android project and run lint

./gradlew lint

Note: If you can't run lint directly, you may want to include android tools PATH in your ~/.bash_profile. (i.e. PATH=$PATH:~/Library/Android/sdk/tools)

Then run source ~/.bash_profile.

How to disable an issue

Add on your build.gradle file

android {
    lintOptions {
        disable 'RootPackage','MoreThanOneLauncher'
        ...
    }
}

lewis's People

Contributors

griveroa-inaka avatar ramabit avatar tenmaster avatar

Stargazers

 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  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

lewis's Issues

Add rules for variables

  • Instance variables should begin with 'm' and be written in camelCase (except those in package 'models')
  • Class constants (static and final) should be written all in UPPER _SNAKE_CASE
  • Update README.md

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.