Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kozaxinan/android-lints
Custom set of android lints rules.
https://github.com/kozaxinan/android-lints
android android-lint android-lint-rule kotlin
Last synced: 8 days ago
JSON representation
Custom set of android lints rules.
- Host: GitHub
- URL: https://github.com/kozaxinan/android-lints
- Owner: kozaxinan
- License: apache-2.0
- Created: 2020-03-23T18:52:04.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-11-12T07:23:35.000Z (8 days ago)
- Last Synced: 2024-11-12T08:24:33.830Z (8 days ago)
- Topics: android, android-lint, android-lint-rule, kotlin
- Language: Kotlin
- Homepage: https://medium.com/@sinankozak/android-lint-rule-for-immutable-kotlin-data-classes-5c91517c7611
- Size: 3.12 MB
- Stars: 65
- Watchers: 4
- Forks: 8
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Android lints
Custom set of android lints rules.[![](https://jitpack.io/v/kozaxinan/android-lints.svg)](https://jitpack.io/#kozaxinan/android-lints)
### ImmutableDataClassRule - Error
Kotlin data classes should be immutable by design. Having var in a data class is code smell. Use copy() method when instance needs to be modified.### NetworkLayerImmutableClassRule - Warning
Classes used in network layer should be immutable by design. This lint checks Retrofit interface methods' return type for immutability. Java classes need to have final fields and kotlin data classes need to have only val fields.If you want to use this rule, please configure you lint.xml.
``````
### NetworkLayerClassSerializedNameRule - Information
Classes used in network layer with Gson should use SerializedName annotation. This lint checks Retrofit interface methods' return type for SerializedName annotation. Adding annotation rule to prevent obfuscation errors. If you don't use Gson for Retrofit, this check is useless. That is why it is `infromation` level.If you want to use this rule, please configure you lint.xml.
``````
### NetworkLayerClassJsonRule - Information
Classes used in network layer with Moshi should use Json annotation. This lint checks Retrofit interface methods' return type for Json annotation. Adding annotation rule to prevent obfuscation errors. If you don't use Moshi for Retrofit, this check is useless. That is why it is `infromation` level.If you want to use this rule, please configure you lint.xml.
``````
### NetworkLayerClassJsonClassRule - Information
Classes used in network layer with Moshi should use JsonClass annotation to generate the adaptor class. This lint checks Retrofit interface methods' return type for JsonClass annotation. If you don't use Moshi for Retrofit, this check is useless. That is why it is `infromation` level.If you want to use this rule, please configure you lint.xml.
``````
### NetworkLayerBodyClassJsonClassRule
Classes used in as body with Moshi should use JsonClass annotation to generate the adaptor class. This lint checks Retrofit interface methods' body param for JsonClass annotation. If you don't use Moshi for Retrofit, this check is useless. That is why it is `infromation` level.```
```
# Usage
Library is published to jitpack.io. After adding implementation to your module, lint will include new rules.[![](https://jitpack.io/v/kozaxinan/android-lints.svg)](https://jitpack.io/#kozaxinan/android-lints)
```
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}dependencies {
implementation 'com.github.kozaxinan:android-lints:'
}
```# License
Copyright 2020 Kozaxinan - Sinan Kozak
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 athttp://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.