Chris Johnson
03/16/2022, 8:48 PMChris Johnson
03/16/2022, 8:55 PMDaniel B Duval
03/17/2022, 4:04 PMDetector()
that implements SourceCodeScanner
First, in your override
of getApplicableUastTypes
, you’d specify listOf(UIMethod::class.java)
Second, in your override
of `createUastHandler`you’ll want to implement override fun visitMethod(node: UIMethod)
In this method, you’ll look at the node.name
to see it has the method you do not want. The context.getLocation(node)
will let you know where you are. You can decide to first look at the node or the location.
Just be aware of the scopes you pass into the Implementation
. By default, TEST_SOURCES
aren’t in there, so if you want tests, you need to add them.
You can find the official guide here - https://googlesamples.github.io/android-custom-lint-rules/api-guide.html
If you’re not already using custom lint, I’d also suggest that you put `lintPublish. project(':customLintProject')`and lintChecks project(':customLintProject')
in a module that all your modules are dependent on in your build script. This will force all projects to pick it up and it can bring the checks into studio.Daniel B Duval
03/17/2022, 4:07 PMlint().files
needs to resolve. E.g., if you have
import androidx.compose.material.OutlinedButton
Daniel B Duval
03/17/2022, 4:15 PMChris Johnson
03/18/2022, 7:11 PM