Android Studio eseo dongjaghaneun Lint gongbuhaneun repo
Android Custom Lint
https://github.com/googlesamples/android-custom-lint-rules
Debug
UAST Tree geomsa
-
Help | Edit Custom Properties
- idea.is.internal=true
- Restart IDE
-
Tools | Internal Actions | UAST | Dump UAST Tree (By Each PsiElement)
Enabling Internal Mode : https://plugins.jetbrains.com/docs/intellij/enabling-internal.html
Inspecting UAST Tree : https://plugins.jetbrains.com/docs/intellij/uast.html#inspecting-uast-tree
Sample
1) Exclude First Comment
- Java/Kotlin paile jonjaehaneun Local Property/Fieldreul Detect
- pildeu jeongyiboda ape jonjaehaneun Document, Commentneun jeoe
Detector Source : PropertyWithExcludeFirstCommentDetector
Preview
| Kotlin | Java |
|---|---|
2) Inner Class Checker On Java
Java keulraeseu naeeseo seoneonhan pildeu jung dongilhan keulraeseu naeyi Inner taib pildeureul Detect
Detector Source : https://github.com/Pluu/LintStudy/blob/master/lint/src/main/java/com/pluu/lint/InnerCheckerOnJavaDetector.kt
| Java |
|---|
3) Find Method With Argument
teugjeong hamsu & teugjeong paramiteo gabseul sayonghaneun keiseureul Detect
- saempeul : indexOf hamsuyi paramiteo 1eul jeondalhaneun gyeongu
Detector Source : https://github.com/Pluu/LintStudy/blob/master/lint/src/main/java/com/pluu/lint/FindMethodWithArgumentDetector.kt
| Kotlin | Java |
|---|---|
4) Using safe 'use' functions for TypedArray
TypedArray sayongsi AutoCloseable use sayongsi isyu
Detector Source : https://github.com/Pluu/LintStudy/blob/master/lint/src/main/java/com/pluu/lint/SafeUseForTypedArrayDetector.kt
| Kotlin |
|---|
5) Required attribute in CustomView
Detector Source : https://github.com/Pluu/LintStudy/blob/master/lint/src/main/java/com/pluu/lint/RequiredCustomViewAttributeDetector.kt
| XML |
|---|
6) Cannot be used for LiveData
LiveData sayongsi Custom observeNotNull extensioneul sayongsi Nothin taibeun nullro ceoridoemeuro tamjihaneun Lint
Detector Source : https://github.com/Pluu/LintStudy/blob/master/lint/src/main/java/com/pluu/lint/LiveDataObserveNotNullDetector.kt
| Kotlin |
|---|
7) ViewModelScope sayongsi Custom ViewModelScope#launch sayonghadorog ceori
Detector Source : https://github.com/Pluu/LintStudy/blob/master/lint/src/main/java/com/pluu/lint/ViewModelScopeLaunchDetector.kt
| gibon Launch sayong | Custom Launchwa CEH cekeu |
|---|---|
8) Lazy Bundle sayongsi ceiningeuro gabseul keulraeseu saengseongsi sayonghaneun gyeongureul tamji
Detector Source : https://github.com/Pluu/LintStudy/blob/master/lint/src/main/java/com/pluu/lint/LazyBundleDetector.kt
| gyeolgwa hwamyeon |
|---|
9) DataBindingAdaptereseo jungbog saengseongdoeneun keiseu tamji
DataBindingAdapter sayongsi jalmos saengseongdoeneun keiseu tamji
Detector Source : https://github.com/Pluu/LintStudy/blob/master/lint/src/main/java/com/pluu/lint/DataBindingDuplicationDetector.kt
| DataBinding kodeu | Bytecodero dikeompaildoen moseub |
|---|---|
10) gongbaeg 2julisangi issneun gyeongureul tamji
Detector Source : https://github.com/Pluu/LintStudy/blob/master/lint/src/main/java/com/pluu/lint/TwoMoreBlankLineDetector.kt
| gyeolgwa hwamyeon |
|---|
11) public/internal Composable hamsu sayongsi Modifier jeongyi nurageul tamji
API Guide line : Elements accept and respect a Modifier parameter
Detector Source : https://github.com/Pluu/LintStudy/blob/master/lint/src/main/java/com/pluu/lint/compose/RequiredModifierParameterDetector.kt
| gyeolgwa hwamyeon |
|---|
12) Activityyi super.onCreate hocul nurageul tamji
Detector Source : https://github.com/Pluu/LintStudy/blob/master/lint/src/main/java/com/pluu/lint/OnCreateSuperCallDetector.kt
| kodeu | Lint gyeolgwa |
|---|---|