Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Odd implementation of partial analysis in VectorDrawableCompatDetector #73

Open
Lingviston opened this issue May 10, 2022 · 1 comment

Comments

@Lingviston
Copy link

Hi!
Please, read the whole issue, before rejecting it, as I think at least part of it is directly related to this project.

The chapter about partial analysis says, that we must fill the partialResult map and then process it in the checkPartialResults method. However, VectorDrawableCompatDetector seems to do it the other way around.

It fills the map in visitElement method, but processes it within the visitAttribute method. The oddest thing is that inside of the visitAttribute method the partial results of other projects are checked as well, however in my experiment (I copied the source code to my project and added some extra logging) at this point partial results were only containing the results of the scanned module. It makes the usage of the partial results redundant, doesn't it?

I wonder, if this VectorDrawableCompatDetector uses partial results in the expected manner. If yes, then could you also clarify the following:

  • When partial results are checked out of the checkPartialResults method, results of which projects must be available? All of those, on which the scanned project depend?
  • Does access to partial results break the highlighting in the Android Studio? In the custom detector of mine just adding a call to getPartialResult removed the highlighting immediately. My detector check issues in multiple types of files, in some of which the data from the other modules is required, but in some it is not. The documentation has the following section, which made me think that maybe, to make the detector work under the AS I need to protect those branches, which don't need data from all modules, with isGlobalAnalysis check. If my assumption is correct, then it might make a good addition to the doc.

Thanks in advance for the answers.

@Lingviston
Copy link
Author

I have a feeling that the approach from VectorDrawableCompatDetector works only when checkDependencies is set to true in lint config. But this is not mentioned anywhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@Lingviston and others