简体   繁体   中英

Custom lint check for tests files

I integrated a custom lint check as explained here , However the checks have no effects on my test code, it generates errors for the java class inside the main folder but not the test` folder.

I tried to change Scope.JAVA_FILE_SCOPE to Scope.TEST_SOURCES and other values when creating the com.android.tools.lint.detector.api.Implementation however it did not work.

What am I doing wrong? is that not supported?

It is supported, however this only works reliable with Android Studio Plugin 3.0 and later. Also then you'll need to use the Lint Tools 26.0.0 just to be sure.

I construct my Implementation like this new Implementation(MyDetector.class, EnumSet.of(JAVA_FILE, TEST_SOURCES));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM