fix(lint): disable hanging androidx.fragment lifecycle detector#36
Merged
Conversation
:app:lintDebug hangs for hours inside androidx.fragment's UnsafeFragmentLifecycleObserverDetector — its recursive call-graph walk degrades to near-exponential cost on our oversized Fragment/Activity methods (DeployFragment ~2.7k LOC, MainActivity). CI's lint step ran ~50 min, up to 3 h on heavy branches. Disable the detector's 3 issue IDs (FragmentBackPressedCallback, FragmentLiveDataObserve, FragmentAddMenuProvider) — the only ones it emits — so lint completes in minutes. The other 450+ checks (and abortOnError + baseline) stay active. Re-enable once the god classes are split (TECH_DEBT_PLAN.md).
…debt Logs the lintOptions workaround in TECH_DEBT_PLAN.md (Progress log + Phase 3 cross-ref) with the explicit re-enable condition: drop the disable once DeployFragment/MainActivity are carved up. Keeps the comment in build.gradle honest — the debt is now tracked, not just referenced.
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.
Problem
:app:lintDebugdoesn't run slow — it hangs, burning CPU indefinitely inside one detector that ships withandroidx.fragment:UnsafeFragmentLifecycleObserverDetector. ItsRecursiveMethodVisitorwalks the call graph recursively per Fragment method; on our oversized Fragment/Activity methods (DeployFragment~2.7k LOC,MainActivity, full of nested lambdas) this degrades to near-exponential cost and never finishes. CI's lint step ran ~50 min normally, up to ~3 h on heavy branches.Fix
Disable the detector's 3 issue IDs — the only ones it emits — in
lintOptions:Lint then completes in minutes. The other 450+ checks stay active, and
abortOnError true+ the committedlint-baseline.xmlgate is unchanged.Why it's safe / scoped
Out of scope (follow-ups)
lint-baseline.xml(drop ~10 stale entries; fix the fresh warnings instead of forgiving them).TrustAllX509TrustManager,UnspecifiedRegisterReceiverFlag,MissingSuperCall, …).DeployFragment/MainActivity(seecontroller/docs/TECH_DEBT_PLAN.md); once methods shrink, drop thisdisableand re-enable the 3 checks.Verification
CI's
Run Android Lintstep on this PR should drop from ~50 min to a few minutes and stay green (no new lint errors). Local lint couldn't be run in the prep environment (no Android SDK).