2

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 thetest` 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?

2 Answers 2

2

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));

Sign up to request clarification or add additional context in comments.

Comments

1

I had a similar issue and eventually figured out what I was doing wrong. I was calling gradlew <app>:lintInternalRelease, but release does not acknowledge test classes. gradlew <app>:lintInternalDebug did what I wanted.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.