Skip to content

ci: add Android linting with Detekt#388

Open
jkmassel wants to merge 1 commit intotrunkfrom
jkmassel/android-ci-lint
Open

ci: add Android linting with Detekt#388
jkmassel wants to merge 1 commit intotrunkfrom
jkmassel/android-ci-lint

Conversation

@jkmassel
Copy link
Contributor

@jkmassel jkmassel commented Mar 19, 2026

What?

Adds Detekt static analysis for Android/Kotlin code and a corresponding Buildkite CI step.

Why?

The JavaScript and Swift sides of the project already have linting in CI (ESLint, SwiftLint), but Android had no static analysis. This closes that gap so Kotlin code quality issues are caught in CI.

Next Steps

In a future PR we can address the baseline issues, I just wanted to get this started for now.

How?

  • Added Detekt 1.23.7 as a Gradle plugin applied to all Android subprojects
  • Created android/detekt.yml with tuned thresholds for the codebase
  • Generated baseline files (detekt-baseline.xml) for both the Gutenberg library and app modules so existing violations don't block CI — new violations will be caught going forward
  • Added make lint-android target (runs ./gradlew detekt)
  • Added a :android: Lint Android step to the Buildkite pipeline on the android queue

Testing Instructions

  1. Run make lint-android — should pass with no errors.
  2. Introduce a Detekt violation in Kotlin code (e.g., an unused private function) and verify make lint-android catches it.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jkmassel jkmassel added the [Type] Build Tooling Issues or PRs related to build tooling label Mar 19, 2026
@jkmassel jkmassel requested a review from ParaskP7 March 19, 2026 21:16
@jkmassel jkmassel marked this pull request as ready for review March 19, 2026 21:16
@jkmassel jkmassel requested review from adalpari and nbradbury March 19, 2026 21:16
Copy link

@adalpari adalpari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice improvement, LGTM and works as expected!

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Detekt-based static analysis to the Android/Kotlin portion of the repo and wires it into local tooling + Buildkite CI, bringing Android in line with existing JS/Swift linting.

Changes:

  • Add Detekt Gradle plugin (via version catalog) and apply/configure it across Android subprojects.
  • Introduce a shared android/detekt.yml config and module baselines to avoid blocking on existing violations.
  • Add make lint-android and a corresponding Buildkite step.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
android/gradle/libs.versions.toml Adds Detekt plugin + version to the Android version catalog.
android/detekt.yml Defines the repo’s initial Detekt rule configuration and thresholds.
android/build.gradle.kts Applies Detekt to Android subprojects and points to shared config + per-module baseline.
android/app/detekt-baseline.xml Baselines existing Detekt findings for the app module.
android/Gutenberg/detekt-baseline.xml Baselines existing Detekt findings for the Gutenberg library module.
Makefile Adds lint-android target to run Detekt consistently locally/CI.
.buildkite/pipeline.yml Adds an Android lint step to CI using make lint-android.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@ParaskP7 ParaskP7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋 @jkmassel thanks for adding Detekt on this repo for Android, and for the ping! 🥇

I am approving this as well, with just a few suggestions for you:

  • Suggestion (💡): I see version 1.23.7 (Sep 8, 2024) being used, with a newer 1.23.8 (Feb 21, 2025) being available. I am not sure why 1.23.7 got chosen, so maybe consider using the newest 1.X version instead. FYI: There is also a couple of alpha 2.X versions available, but I would go that far.
  • Suggestion (💡): The app baseline contain 18 FunctionNaming entries for @Composable functions (e.g. AddConfigurationDialog, EditorScreen). Compose conventions require PascalCase for composable functions, which conflicts with Detekt's default camelCase rule. Rather than baselining all of these, consider adding this configuration to detekt.yml, which will then eliminate those baseline entries and prevent future false positives on new composables.:
naming:
  FunctionNaming:
    ignoreAnnotated:
      - 'Composable'

Everything else LGTM! 🚀

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

Labels

[Type] Build Tooling Issues or PRs related to build tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants