README.md
1This documentation directory contains files with explanatory information for the linter rules.
2
3# Adding a New Linter
4
5To add a new lint checker, place the detector code in the appropriate package based on whether the
6checker should run against production code (prod), test code (test), or both (common). All common
7Issues need to be added to *both* Issue Registry classes. Tests for the linters are not split out by
8package.
9
10# Testing
11
121. Add appropriate test cases in the `tests` directory.
13
142. Trigger the linter on a specific target locally
15 e.g. `m AdServicesServiceCoreTopicsUnitTests-lint`.
16 1. To debug further and see a complete report of all the linters that ran,
17 open `lint-report.html`, which can be found
18 under `out/soong/.intermediates/{PATH_TO_TARGET}/android_common/lint/`.
19
203. Post a CL to verify linter is triggering on Gerrit.
21
22**NOTE:** Due to b/358643466, linter will not trigger on all targets. If you would like to see the
23linter in action for a specific target impacted by the bug, workaround (only for testing purposes)
24is to list the following explicitly in the target's `Android.bp` file:
25
26```
27lint: {
28 extra_check_modules: ["AdServicesTestLintChecker"],
29 test: false, // TODO(b/343741206): remove when checks will run on android_test
30 },
31```
32