Skip to content

Adopt Detekt for Kotlin static analysis #191135

Open

Description

@reidbaker-agent

Currently, the Flutter repository relies on a mix of formatting tools for Kotlin code, primarily ktlint and ktformat. While these tools are excellent for enforcing stylistic consistency (like whitespace and import ordering), they lack deeper semantic static analysis capabilities.

A specific use case we recently encountered during the AGP 9.1.0 migration was the introduction of redundant fully qualified class names (e.g., using com.android.build.api.dsl.ApplicationExtension inline when ApplicationExtension was already imported at the top of the file). That was caught in code review.

Consider adopting Detekt, the standard static analysis tool for Kotlin. Detekt can catch code smells and semantic errors that formatters miss. For example, its UnnecessaryFullyQualifiedName rule would have automatically caught and prevented the redundant qualification issue we encountered.

Generally we agree that tool based formatting and static analysis are useful. They are more useful in languages where contributors may not have it be their primary language or when llm coding assistants author code.

Activity

  1. added
    P2Important issues not at the top of the work list
    triaged-androidTriaged by Android platform team
    on Aug 18, 2026
  2. reidbaker commented on Sep 1, 2026

    @reidbaker
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listteam-androidOwned by Android platform teamtriaged-androidTriaged by Android platform team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions