Skip to content

chore: Resolve static analysis warnings and reduce detekt baseline suppressions - #3924

Open
shobhitagarwal1612 wants to merge 4 commits into
masterfrom
lint
Open

chore: Resolve static analysis warnings and reduce detekt baseline suppressions#3924
shobhitagarwal1612 wants to merge 4 commits into
masterfrom
lint

Conversation

@shobhitagarwal1612

Copy link
Copy Markdown
Member

This PR addresses several static analysis findings identified by Android Lint, Detekt, and the Kotlin compiler, tunes analyzer configurations for tests, and significantly reduces suppressions in baseline.xml (from 8 down to 2).

All changes are non-breaking, verified with ./gradlew checkCode, and accompanied by passing unit tests across all modules.

Key Changes

  • Compiler & Lint:
    • Adopted Android KTX extensions (toColorInt, toUri, bitmap[x, y]).
    • Fixed accessibility (android:focusable="true") and layout performance (android:baselineAligned="false").
    • Updated deprecated hiltViewModel Compose import and removed redundant Elvis operator.
    • Replaced unmanaged SavedStateHandle instantiation in HomeScreenViewModel with a plain property.
    • Stubbed default remoteConfig.getString(...) in TestFirebaseModule to match Firebase contracts.
  • Detekt Baseline Reduction (8 $\to$ 2):
    • Eliminated labeled returns (@getMapAsync, @withReady) in GoogleMapsFragment and DataCollectionViewModel.
    • Simplified getDraftSubmission() in HomeScreenViewModel and reduced nesting depth in SubmissionDataConverter.
    • Removed obsolete DataCollectionTaskFragment suppression.
  • Configuration:
    • Excluded test source sets from Detekt's LargeClass rule (removing DataCollectionFragmentTest from baseline).
    • Documented rationale for display_700.xml lint exclusion.

@andreia-ferreira PTAL?

@codecov

codecov Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 57.69231% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.80%. Comparing base (8b167b3) to head (9fb1b5f).

Files with missing lines Patch % Lines
...ta/local/room/converter/SubmissionDataConverter.kt 36.36% 5 Missing and 2 partials ⚠️
...droid/ui/datacollection/DataCollectionViewModel.kt 78.57% 2 Missing and 4 partials ⚠️
...dplatform/android/ui/map/gms/GoogleMapsFragment.kt 0.00% 3 Missing ⚠️
...undplatform/android/ui/home/HomeScreenViewModel.kt 0.00% 1 Missing and 1 partial ⚠️
...org/groundplatform/android/ui/main/MainActivity.kt 0.00% 2 Missing ⚠️
...roundplatform/android/ui/map/gms/mog/MogTileExt.kt 0.00% 1 Missing ⚠️
...va/org/groundplatform/android/ui/util/ColorUtil.kt 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master    #3924   +/-   ##
=========================================
  Coverage     69.79%   69.80%           
  Complexity     1987     1987           
=========================================
  Files           415      415           
  Lines         11380    11379    -1     
  Branches       1486     1484    -2     
=========================================
  Hits           7943     7943           
+ Misses         2670     2669    -1     
  Partials        767      767           
Files with missing lines Coverage Δ
...oundplatform/android/ui/home/HomeScreenFragment.kt 73.91% <100.00%> (ø)
...rg/groundplatform/android/ui/main/MainViewModel.kt 67.21% <100.00%> (+1.63%) ⬆️
...g/groundplatform/android/ui/signin/SignInScreen.kt 63.07% <ø> (ø)
...latform/android/util/image/TileImageTransformer.kt 92.30% <100.00%> (ø)
...roundplatform/android/ui/map/gms/mog/MogTileExt.kt 20.00% <0.00%> (ø)
...va/org/groundplatform/android/ui/util/ColorUtil.kt 80.00% <0.00%> (ø)
...undplatform/android/ui/home/HomeScreenViewModel.kt 80.43% <0.00%> (+2.88%) ⬆️
...org/groundplatform/android/ui/main/MainActivity.kt 44.31% <0.00%> (+0.49%) ⬆️
...dplatform/android/ui/map/gms/GoogleMapsFragment.kt 18.10% <0.00%> (ø)
...droid/ui/datacollection/DataCollectionViewModel.kt 80.93% <78.57%> (ø)
... and 1 more

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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