Overview › Dependency Injection (Hilt)
Dependency Injection (Hilt)
Comprehensive Hilt graph with 60+ modules and constructor injection.
82
SCORE
Summary
Hilt is the DI framework, used pervasively. CostcoApplication is annotated @HiltAndroidApp, and 60+ @Module files are spread across the app and shared modules. Constructor injection is the norm.
Findings
PASS
Constructor injection across the codebase
Repositories, UseCases, and Mappers are constructor-injected — testable and explicit.
PASS37+
37+ @HiltViewModel classes
ViewModels are correctly scoped via Hilt rather than manual factories.
MEDIUM
Concentration of modules in app
28 modules sit under
Costco/src/main/java/com/costco/app/android/di/ — bindings for shared concerns ought to live closer to the implementation in shared modules.Recommendation: Move bindings (e.g.
VolleyManagerModule, ConfigManagerModule) to the shared module that owns the implementation, exposing them via @InstallIn(SingletonComponent::class).LOW
Scope discipline
Verify scoping (
@Singleton vs @ViewModelScoped vs unscoped) is intentional. Misuse of @Singleton on stateful types is a common leak source.Recommendation: Audit every
@Provides/@Binds for the smallest correct scope.INFO
Test-time replaceability
Hilt test bindings (
@TestInstallIn, @UninstallModules) usage was not surveyed.Recommendation: Document which modules support test substitution; add fakes in
:shared:testfixtures.Costco Android · Code Review Report · Generated 2026-05-07 · 626 machine-curated findings