A set of useful lint checks developed with Android Lint API to keep the app follow a solid design system
Large-scale mobile apps often involve large teams of developers. Without proper lint checks in a large project's codebase, one might fall into the pitfall of inconsistent UI designs with different colors being used in layouts and other resources, making the app theme hard to maintain.
For more details, check Lint Checks for a Solid Design System session presented at Droidcon Egypt 2022.
To use Linta in your project, add the following line to build.gradle
file.
lintChecks "com.swvl.lint:linta-android:x.y.z"
The following are the lint checks currently implemented by Linta [please add the documentation to any recent addition and/or any missing ones]:
Lint Issue ID | Severity | Description |
---|---|---|
DuplicateColors |
warning | When a duplicate color is defined in a resource file |
DuplicateResourceFiles |
warning | When there are two or more duplicate resource files containing the same exact attributes, regardless of differences in whitespaces, attributes order, comments, or used tools namespace if any |
HardcodedColorSrcCode |
error | When a hardcoded color is used in a source code file (Java or Kotlin) |
HardcodedColorXml |
error | When a hardcoded color is used in a resource file (drawables, layouts, etc.) |
RedundantStyles |
warning | When a style is created without adding any new attributes |
To see how these checks work in action, check the generated lint report in our sample app.
Copyright 2022 Swvl
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.