googlesamples / googlesamples/android-custom-lint-rules

How to detect "Convert to 'data object'" in lint

Open
#95 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
1k
Forks
176
PR merge metrics
No merged PRs in 30d

Description

![image](https://github.com/user-attachments/assets/2e282094-193e-477e-b9d5-ee76aa288765)

Hi,

Currently, I’ve `allWarningsAsErrors` set to true in my project, but for some reason the Convert to 'data object' warning is not failing the build (unlike other warnings). I got to know that this is an IDE warning and can’t be caught with lint. So I thought of writing a custom lint doing the same.

I was trying to do that and am not able to figure out how to detect even an `object` keyword.
I tried playing with a custom `Detector(), SourceCodeScanner` with `getApplicableUastTypes` and `getApplicablePsiTypes` but am not able to understand what exact param i need to pass or which exact method i need to observe in the c`reatePsiVisitor / createUastHandler`

Any help would be highly appreciated?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.