Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a new custom Android Lint detector, UnreferencedResourceDetector, designed to identify and flag unused fui_* string and plurals resources within library modules, along with its corresponding unit tests. Feedback on the implementation highlights a performance bottleneck in the XML scanning logic, where visiting every element and attribute and using element.textContent can lead to quadratic complexity. The reviewer suggests optimizing this by scanning XML files textually in beforeCheckFile and limiting element scanning to only string and plurals tags.
demolaf
force-pushed
the
auth/remove-unreferenced-strings
branch
from
September 21, 2026 16:07
1457f75 to
7ed73c8
Compare
demolaf
force-pushed
the
lint/unreferenced-resource-detector
branch
from
September 21, 2026 16:08
e80d7da to
5da60c0
Compare
demolaf
force-pushed
the
lint/unreferenced-resource-detector
branch
from
September 21, 2026 17:28
5da60c0 to
109874d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an
UnreferencedResourcelint check that fails the build on afui_*string or plurals resource:authnever reads.Changes
values/folders, and references fromR.string.andR.plurals.in Kotlin and Java and@string/and@plurals/in XML and the manifest.tools:attributes, which is what found the last of the strings deleted in chore(auth): delete 35 unreferenced fui_ string resources and their translations #2521.Why a custom check
UnusedResourcesis silent for a library module because lint cannot see its consumers, andcheckDependenciesagainst the demo app would flag nearly every resource.The policy it encodes
No
fui_*resource may be unreferenced within:authitself. Normally the wrong rule for a library; it holds because the README documents these names as ones an app overrides rather than reads.Maintainer note: Fixes internal CPRN-488