Hi!
My team has been working on integration some custom rules in our build
process, and we have a few questions:
- Is it possible to enable custom rules to run within Android Studio and
highlight errors like built-in rules do?
- Is it possible (and practical!) to run Android Lint on non Android java
projects?
- We are generating our custom lint jar as part of the build, and declare a
dependent task to all lint tasks that makes it available to the lint tool.
ANDROID_LINT_JARS is not convenient for us, since we can't modify an env
variable from within the process, and the home directory won't work in
shared servers. Copying the jar file into ${buildDir}/lint/lint.jar works,
but it feels hacky. What is your recommendation? Also, would it be possible
to add a list of custom rule jar files to lintOptions?
- I couldn't find a way to pass configuration parameters for my rules
through the Lint options and I have been using Java system properties, but
it feels ugly. It would be great to be able to configure rules in the lint
configuration file. What is your recommendation for passing configuration
into custom lint rules?
- Lint tries to load rules from every jar file in the lint directory,
making it impossible for me to add dependent jar files. Is there a way to
use custom rule jar files that have external dependencies?
- Your sample code doesn't include support for unit tests, which would be
really useful for debugging rules. How can I set them up?
Also, I have a couple of minor questions about writing the rules themselves:
- ResolvedClass has getMethods() but not getFields() (which would be
useful, for example, to validate immutability). Is that an intentional
omission?
- applicableSuperClasses() can't be used with generic base classes, since
the Java visitor seems to check against the full signature (which includes
type parameters). We are working around this by selecting all classes
instead and checking manually, but it seems wasteful. Would it make sense
for the visitor to look up the class name as well?
- Super minor nit: Lint only admits "//noinspection" to disable issues,
while AS will also take "// noinspection". We've been using the latter, and
it took me a while to figure out the problem!
Sorry about the long email!
Thanks,
César
--
You received this message because you are subscribed to the Google Groups
"adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.