# detekt

Published articles for detekt.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## 51 Detekt Rules for Koin: Catch Anti-Patterns Your Compiler Misses

DevFeed: [51 Detekt Rules for Koin: Catch Anti-Patterns Your Compiler Misses](<https://devfeed.tech/articles/51-detekt-rules-for-koin-catch-anti-patterns-your-compiler-misses-25957.md>)

Original publisher: [Read original article](<https://blog.insert-koin.io/detekt-rules-koin-c0b6330fc37b?source=rss-7a0a233f88a2------2>)

Author: Kirill Rozov

Published: 2026-03-02T08:17:18Z

Content type: tutorial

Language: en

Sources: [Stories by Kirill Rozov on Medium](<https://devfeed.tech/sources/stories-by-kirill-rozov-on-medium.md>)

Topics: [koin](<https://devfeed.tech/topics/koin.md>), [Android](<https://devfeed.tech/topics/android.md>), [ci](<https://devfeed.tech/topics/ci.md>)

Tags: [analysis](<https://devfeed.tech/tags/analysis.md>), [android](<https://devfeed.tech/tags/android.md>), [best-practices](<https://devfeed.tech/tags/best-practices.md>), [ci](<https://devfeed.tech/tags/ci.md>), [dependencies](<https://devfeed.tech/tags/dependencies.md>), [detekt](<https://devfeed.tech/tags/detekt.md>), [errors](<https://devfeed.tech/tags/errors.md>), [koin](<https://devfeed.tech/tags/koin.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-multiplatform](<https://devfeed.tech/tags/kotlin-multiplatform.md>), [tests](<https://devfeed.tech/tags/tests.md>)

### AI overview

This article explains how the detekt-rules-koin Detekt extension identifies Koin dependency-injection anti-patterns that compile successfully but can fail at runtime. It covers misuse of get(), service-locator access through KoinComponent, singleton registration for mutable use cases, and installation in an existing Detekt setup.

### Source excerpt

Your Koin module compiles. Unit tests pass. CI is green. Then production crashes with NoBeanDefFoundException on first launch -- and the offending line has been sitting in your codebase for weeks. Koin's runtime graph resolution means the compiler never sees these bugs; it only surfaces them when Koin tries to wire everything together. No red underlines, no warnings, no build failures -- just a crash on a user's device. This is the fundamental tension with Koin: its DSL is concise and readable, but none of the structure it creates is visible to the type system. The three examples below compile without errors on any Android project. All three will cause real problems at runtime. Static analysis is the standard answer to this class of problem -- but generic Detekt rules were not written with Koin's semantics in mind. A rule that flags unused variables or improper nullability checks has no concept of a Koin scope, a module definition block, or the difference between single and factory. What you need is a rule set that understands Koin. That's exactly what detekt-rules-koin provides. Problem 1 -- `NoGetOutsideModuleDefinition`// ❌ get() called outside a Koin module - compiles, crashes at runtime class UserRepositoryImpl : UserRepository { // KoinComponent not implemented, no scope active private val db: AppDatabase = get() private val api: UserApi = get() } get() is only valid inside a Koin module definition block, where the Koin container is active and providing dependencies. Calling it here triggers IllegalStateException: KoinApplication has not been started -- or silently resolves to the wrong scope -- depending on how your app is wired. Problem 2 -- NoKoinComponentInterface// ❌ Repository using Service Locator via KoinComponent class UserRepository : KoinComponent { private val db: AppDatabase by inject() private val api: UserApi by inject() fun getUser(id: String) = api.fetchUser(id) }// ✅ Constructor injection - dependencies are explicit and testable class UserRepository

## Using Google Gemini in a Python Script to Fix Static Analysis Issues

DevFeed: [Using Google Gemini in a Python Script to Fix Static Analysis Issues](<https://devfeed.tech/articles/linting-automated-ai-powered-static-analysis-with-gemini-24911.md>)

Original publisher: [Read original article](<https://blog.blundellapps.co.uk/linting-automated-ai-powered-static-analysis-with-gemini/>)

Author: blundell

Published: 2025-09-23T16:24:26Z

Content type: tutorial

Language: en

Sources: [Blundell](<https://devfeed.tech/sources/blundell.md>)

Topics: [Artificial Intelligence](<https://devfeed.tech/topics/ai.md>), [Code quality](<https://devfeed.tech/topics/code-quality.md>), [Python](<https://devfeed.tech/topics/python.md>), [Google](<https://devfeed.tech/topics/google.md>), [Large Language Model](<https://devfeed.tech/topics/llm.md>), [Refactoring](<https://devfeed.tech/topics/refactoring.md>), [context window](<https://devfeed.tech/topics/context-window.md>)

Tags: [ai](<https://devfeed.tech/tags/ai.md>), [androiddev](<https://devfeed.tech/tags/androiddev.md>), [build](<https://devfeed.tech/tags/build.md>), [code-quality](<https://devfeed.tech/tags/code-quality.md>), [context-window](<https://devfeed.tech/tags/context-window.md>), [detekt](<https://devfeed.tech/tags/detekt.md>), [gemini](<https://devfeed.tech/tags/gemini.md>), [google](<https://devfeed.tech/tags/google.md>), [intermediate](<https://devfeed.tech/tags/intermediate.md>), [python](<https://devfeed.tech/tags/python.md>), [refactoring](<https://devfeed.tech/tags/refactoring.md>), [reference](<https://devfeed.tech/tags/reference.md>), [reference-ai-androiddev-detekt-gemini](<https://devfeed.tech/tags/reference-ai-androiddev-detekt-gemini.md>)

### AI overview

This tutorial describes building a Python script that uses Google Gemini to automatically fix static analysis issues. It discusses the limitations of one-shot fixes, including LLM context-window limits, and explains how to curate the context sent to the model.

### Source excerpt

Tired of fixing endless linting errors? What if an AI could do it for you? In this post, we'll walk through how to build a Python script that uses Google's Gemini to automatically fix static analysis issues, exploring the process and the lessons learned along the way. This is a journey from a simple idea [...] The post Linting, Automated: AI-Powered Static Analysis with Gemini first appeared on Blundell.

## Static Code Analysers

DevFeed: [Static Code Analysers](<https://devfeed.tech/articles/static-code-analysers-39217.md>)

Original publisher: [Read original article](<https://kt.academy/article/ak-static-analysis>)

Published: 2024-01-22T00:15:00Z

Content type: tutorial

Language: en

Sources: [Kt. Academy](<https://devfeed.tech/sources/kt-academy.md>)

Topics: [detekt](<https://devfeed.tech/topics/detekt.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [code reviews](<https://devfeed.tech/topics/code-reviews.md>), [compilers](<https://devfeed.tech/topics/compilers.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [code-reviews](<https://devfeed.tech/tags/code-reviews.md>), [compilers](<https://devfeed.tech/tags/compilers.md>), [detekt](<https://devfeed.tech/tags/detekt.md>), [generics](<https://devfeed.tech/tags/generics.md>), [java](<https://devfeed.tech/tags/java.md>), [jvm](<https://devfeed.tech/tags/jvm.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [workshop-learning-programming](<https://devfeed.tech/tags/workshop-learning-programming.md>)

### AI overview

This tutorial introduces static analysis as a way to identify bugs and recurring code patterns without running the code. It explains how static analysers can automate and enforce coding patterns in large Kotlin codebases, then begins a practical walkthrough of detekt, a popular Kotlin static analyser.

### Source excerpt

All you need to know about Static Code Analysers and Detekt.

## Setting up precommit lints for all team members

DevFeed: [Setting up precommit lints for all team members](<https://devfeed.tech/articles/setting-up-precommit-lints-for-all-team-members-29054.md>)

Original publisher: [Read original article](<https://dmitrysamoylenko.com/2020/12/06/configure_lints.html>)

Author: Dmitry Samoylenko

Published: 2020-12-06T00:00:00Z

Content type: tutorial

Language: en

Sources: [Dmitry Samoylenko - Android Developer Blog](<https://devfeed.tech/sources/dmitry-samoylenko-android-developer-blog.md>)

Topics: [Script](<https://devfeed.tech/topics/script.md>), [Git](<https://devfeed.tech/topics/git.md>), [Unix](<https://devfeed.tech/topics/unix.md>), [Command-line interface](<https://devfeed.tech/topics/cli.md>), [Windows](<https://devfeed.tech/topics/windows.md>)

Tags: [androidstudio](<https://devfeed.tech/tags/androidstudio.md>), [command-line](<https://devfeed.tech/tags/command-line.md>), [detekt](<https://devfeed.tech/tags/detekt.md>), [git](<https://devfeed.tech/tags/git.md>), [pre-commit](<https://devfeed.tech/tags/pre-commit.md>), [script](<https://devfeed.tech/tags/script.md>), [unix](<https://devfeed.tech/tags/unix.md>), [windows](<https://devfeed.tech/tags/windows.md>)

### AI overview

A tutorial on configuring Detekt and ktlint, running lint checks before each Git commit with a pre-commit script, and sharing the setup with team members. The script supports Unix systems and requires edits for Windows.

### Source excerpt

What lints?

## Hello8Ball: Exploring Coroutine Testing with a Kotlin Sampler App

DevFeed: [Hello8Ball: Exploring Coroutine Testing with a Kotlin Sampler App](<https://devfeed.tech/articles/hello8ball-32055.md>)

Original publisher: [Read original article](<https://www.maiatoday.net/p/hello8ball/>)

Published: 2019-11-23T21:36:11Z

Content type: tutorial

Language: en

Sources: [maiatoday](<https://devfeed.tech/sources/maiatoday.md>)

Topics: [Coroutines](<https://devfeed.tech/topics/coroutines.md>), [Testing](<https://devfeed.tech/topics/testing.md>), [test](<https://devfeed.tech/topics/test.md>), [CircleCI](<https://devfeed.tech/topics/circleci.md>), [test-coverage](<https://devfeed.tech/topics/test-coverage.md>), [App](<https://devfeed.tech/topics/app.md>)

Tags: [circleci](<https://devfeed.tech/tags/circleci.md>), [code](<https://devfeed.tech/tags/code.md>), [code-coverage](<https://devfeed.tech/tags/code-coverage.md>), [coroutine-testing](<https://devfeed.tech/tags/coroutine-testing.md>), [coroutines](<https://devfeed.tech/tags/coroutines.md>), [detekt](<https://devfeed.tech/tags/detekt.md>), [jacoco](<https://devfeed.tech/tags/jacoco.md>), [kotlinx](<https://devfeed.tech/tags/kotlinx.md>), [test](<https://devfeed.tech/tags/test.md>), [testing](<https://devfeed.tech/tags/testing.md>), [tests](<https://devfeed.tech/tags/tests.md>)

### AI overview

Hello8Ball is a toy sampler app for exploring coroutine testing in Kotlin. It simulates an 8 Ball and includes examples involving network calls, calculations, password generation, synonym lookup, and prime-number checks. The repository includes tests using kotlinx-coroutine-test, CircleCI test execution, detekt, JaCoCo coverage, and a branch converted to JUnit 5.

### Source excerpt

A sampler app to explore Coroutine testing. This is a toy app that simulates an 8 Ball. It can answer questions, find synonmyms, generate a password or check if a number is prime. It was created to make a situation where it makes sense to use coroutines to e.g. go on the network or make a calculation. Then I added tests for all the pieces using kotlinx-coroutine-test. As a bonus the repo is set up to run the tests on CircleCi. It has detekt setup and jacoco code coverage. There is also a branch where all the tests are converted to junit5. Devfest 2019 video This is the companion repo to the KotlinEveryWhereZA 2019 and DevFestZa 2019 talk. Slides are in the repo. code