Android Lint was introduced back in December 2011. Since then its IDE integration became better and better. Today Lint is the Android developer’s essential smart companion guaranteeing a good quality of all your Android development assets. With the release of the most recent Android Studio version in January 2015 Lint features more than 200 default checks. It checks for potential bugs, bad coding habits, broken conventions and much more. However, several circumstances exist where it is necessary to extend the default set with custom Lint rules. This counts in particular for large projects with either a huge code base or big, distributed developer teams. Anyways, it is good practice to have additional team-, project- or company-wide conventions. But how to enforce them?
Although Lint is a fundamental part of the Android Developer Tools, the documentation on how to write custom Lint rules is rare and deprecated. Therefore, the objective of this workshop is to highlight the creation of custom Lint rules. It will showcase the usage of the most recent Lint API and it will demonstrate how to write different types of rules (e.g. code-, resource-, project-structure-related). It will also present how to build custom rules with Gradle and even how to bundle them with your app project (which improves the integration into CI environments). Furthermore, it will provide some insights of useful conventions in real-world scenarios we had to struggle with and where custom Lint rules saved a lot of time and money.
At the end, participants will be prepared and encouraged to write their own custom Lint rules.