android-custom-lint-rules icon indicating copy to clipboard operation
android-custom-lint-rules copied to clipboard

Custom lint rules ignored for :library module

Open mosofsky opened this issue 3 years ago • 1 comments

When I tried moving the Test.kt file from the :app module to the :library module, lint stopped reporting the expected warning.

Steps to reproduce:

  1. git clone https://github.com/googlesamples/android-custom-lint-rules.git
  2. cd android-custom-lint-rules
  3. Move Test.kt to library module:
    1. mkdir -p library/src/main/java/com/example/lint/library
    2. mv app/src/main/java/com/android/example/Test.kt library/src/main/java/com/example/lint/library
    3. sed -i '' 's/com.android.example/com.example.lint.library/' library/src/main/java/com/example/lint/library/Test.kt
  4. Run either of these lint commands:
    1. ./gradlew :library:lint
    2. ./gradlew lint
  5. Expected "Warning: This code mentions lint: Congratulations [SampleId]" but got none

This may be related to Custom lint checks stopped running for multi-module Android project after upgrading to Android Gradle Plugin 4.2.2

mosofsky avatar Jan 07 '22 17:01 mosofsky

We have a similar problem in a multi module project. Basically in the non-android modules we are unable to run our custom lints. @tnorbye there a way to fix it?

andrefrsousa avatar Feb 08 '22 15:02 andrefrsousa