android/app/src/main/java/com/cardsnap/
├── data/ # Room DB, DAO, Repositories
├── domain/ # Models, OCR, Parser
├── ui/ # Screens, Navigation, Theme
├── util/ # Utilities
└── MainActivity.kt
ui→domain,data(via ViewModel)domain→ NO external dependenciesdata→domain(models)- ViewModels mediate between UI and data layers
- Screens:
*Screen.kt - ViewModels:
*ViewModel.kt - Repositories:
*Repository.kt - DAOs:
*Dao.kt - Models:
*Model.ktor data classes - Utils:
*Util.ktor*Helper.kt
- Max 200 lines per file (warn at 200, error at 300)
- Max 30 lines per function (warn at 30, error at 50)
- Complexity ≤ 8 (warn), ≤ 10 (error)
- Max nesting depth ≤ 4
- Max 3 parameters per function
If code exceeds these limits, REFACTOR immediately using Extract Method, Extract Class, or other patterns.
- NO direct Room/DB access from UI layer
- NO business logic in Composables
- NO circular dependencies between modules
- All external deps go through repositories
- Identify which layer the code belongs to
- Check dependency rules
- Keep composables focused on UI only
- Move business logic to ViewModels
- Keep files under 200 lines, functions under 30 lines
- Run:
./gradlew lintbefore commit