Skip to content

feat(lint): flag fui_ string resources that nothing in the module references - #2522

Draft
demolaf wants to merge 1 commit into
auth/remove-unreferenced-stringsfrom
lint/unreferenced-resource-detector
Draft

demolaf wants to merge 1 commit into
auth/remove-unreferenced-stringsfrom
lint/unreferenced-resource-detector

Conversation

@demolaf

@demolaf demolaf commented Sep 21, 2026

Copy link
Copy Markdown
Member

Adds an UnreferencedResource lint check that fails the build on a fui_* string or plurals resource :auth never reads.

Changes

Why a custom check

UnusedResources is silent for a library module because lint cannot see its consumers, and checkDependencies against the demo app would flag nearly every resource.

The policy it encodes

No fui_* resource may be unreferenced within :auth itself. 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

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
demolaf force-pushed the lint/unreferenced-resource-detector branch from 5da60c0 to 109874d Compare September 21, 2026 17:28
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

Successfully merging this pull request may close these issues.

1 participant