jsotuyod
(Juan Martín Sotuyo Dodero)
July 8, 2015, 6:00pm
1
I believe this is a big issue. The Android rules for PMD need the auxclasspath to be able to correctly detect types. As stated in the docs :
To get better results, make sure that the auxclasspath is defined for type resolution to work.
Since Android has officially moved to Gradle for build automation, not being able to use it from Gradle forces developers to use PMD as stand alone.
What does this need to be set to in the Android case?
This looks like it would be quite simple to add, making it a good candidate for contribution. The existing support for classpath effectively just needs to be duplicated for the “auxclasspath”. That is, duplicating properties such as https://github.com/gradle/gradle/blob/master/subprojects/code-quality/src/main/groovy/org/gradle/api/plugins/quality/Pmd.groovy#L45-45
jsotuyod
(Juan Martín Sotuyo Dodero)
July 13, 2015, 12:07pm
4
For PMD, all libraries (Android’s compile classpath for the given build type) + a mockable-android-#.jar
to be able to see android SDK’s classes.
Actually, it’s the exact same thing as needed for Findbugs to work properly on Android without reporting missing classes (Findbugs plugin DOES include the auxclasspath
property).
jsotuyod
(Juan Martín Sotuyo Dodero)
July 13, 2015, 12:09pm
5
Thanks… if I have some spare time I’ll check the contribution guidelines and submit a PR for this.
jsotuyod
(Juan Martín Sotuyo Dodero)
July 20, 2015, 9:09pm
6
Thanks for the contribution Juan!