feat(lint): add UncheckedFlagAccess, ExpiredFeatureFlag, and InvalidFlagReference detectors#176
Merged
kirich1409 merged 3 commits intomainfrom Apr 29, 2026
Merged
Conversation
Detects @BehindFlag/@AssumesFlag annotations whose flagName does not match any ConfigParam property in the same file. Skips files with no ConfigParam declarations to avoid false positives from generated code. Also fixes pre-existing compile errors in ExpiredFeatureFlagDetector and UncheckedFlagAccessDetector (ambiguous overload, missing uastContents API) and adds their test files that were present but never committed.
ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one. |
Detects ConfigParam properties annotated with @ExpiresAt where the date has passed. Rewrites the previous broken implementation to use getApplicableUastTypes + visitAnnotation, which avoids the duplicate-fire issue caused by Kotlin @target(PROPERTY, FIELD) generating two UAST annotation nodes from the same KtAnnotationEntry. Deduplicates remaining visits via sourcePsi identity tracking within the file handler. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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 three Android Lint detectors to
featured-lint-rules.Closes #157
Closes #158
Closes #159
Changes
UncheckedFlagAccessDetector
UAST scanner for
UCallExpression. Resolves@BehindFlagvia PSI (SOURCE retention workaround). Walks the UAST parent chain for guard contexts:if/whenreferencing the flag by name, or an enclosing@BehindFlag-annotated function. v1 scope: direct calls only — callable references, companion scope escape, and@AssumesFlagdeferred.ExpiredFeatureFlagDetector
Visits
@ExpiresAtannotations onConfigParamproperties. Parses the ISO-8601 date and reports if it is in the past. Deduplicates viavisitedSourceElementsto avoid double-firing from@Target(PROPERTY, FIELD).InvalidFlagReferenceDetector
File-level UAST scanner. Collects
ConfigParamproperty names in the file, then validates@BehindFlag/@AssumesFlagflagNamearguments against them. Skips files with noConfigParamdeclarations to avoid false positives on generated code.Tests
27/27 tests pass (positive + negative cases for each detector).