Rock your Android
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:
- The class is a
model
(should be inside a package called 'models').- The variable is declared using
@Bind
or@InjectView
(ButterKnife).
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 toolsPATH
in your~/.bash_profile
. (i.e.PATH=$PATH:~/Library/Android/sdk/tools
)Then run
source ~/.bash_profile
.
Add on your build.gradle
file
android {
lintOptions {
disable 'RootPackage','MoreThanOneLauncher'
...
}
}