Extending Detekt for Android Code Quality
Article Summary
Costa Fotiadis from Just Eat Takeaway shows how custom Detekt rules caught edge-to-edge violations before they hit production. No more relying on reviewers to remember Android 15's breaking changes.
Just Eat Takeaway's Android team extended Detekt (Kotlin's static analysis tool) with custom rules tailored to their codebase. They built a separate module that enforces team-specific patterns and catches issues that generic linters miss, all integrated into their CI pipeline with automated PR comments.
Key Takeaways
- Custom rule enforces enableEdgeToEdge() calls for Android 15 compatibility
- Prevents banned APIs like GlobalScope and android.util.Log automatically
- Uses danger-kotlin to post violation comments directly on pull requests
- Unit tests allow quick iteration on arcane Detekt APIs
Critical Insight
Custom Detekt rules automate code quality enforcement for team-specific patterns, removing the burden from human reviewers and preventing platform-specific bugs before merge.