From b8daaf6c2d74e6b506dcbd56d6f71831f5f5c44f Mon Sep 17 00:00:00 2001 From: Logan Rosen Date: Wed, 22 Jul 2026 23:01:44 -0400 Subject: [PATCH 1/3] Document Detekt static analysis Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2d266459-462b-4648-b82b-c82060787b17 --- docs/android/codestyle.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/android/codestyle.md b/docs/android/codestyle.md index 97a6aea3195..49ed2868a75 100644 --- a/docs/android/codestyle.md +++ b/docs/android/codestyle.md @@ -45,6 +45,28 @@ You can use KTLint through Gradle to automatically reformat your code: If a KTLint error is detected, the CI will fail, and GitHub will report it as a comment in the PR using the generated [SARIF](/docs/android/tips/sarif_reports.md) report. +## Detekt static analysis + +While KTLint handles Kotlin formatting and style, [Detekt](https://detekt.dev/) performs static analysis for maintainability and correctness issues. + +### Running Detekt + +Run Detekt for the entire repository, including the convention plugins in the included build: + +```bash +./gradlew detekt :build-logic:convention:detekt --continue +``` + +To analyze a single module, run its `detekt` task: + +```bash +./gradlew :app:detekt +``` + +### CI integration + +Existing findings are recorded in baselines. New Detekt violations fail CI and are reported using the generated [SARIF](/docs/android/tips/sarif_reports.md) report. + ## Yamllint We use [Yamllint](https://github.com/adrienverge/yamllint) to enforce YAML formatting. The `github` format is followed for all YAML files in the repository. From 8795dd413b5b587f2804d479b49f51e964813324 Mon Sep 17 00:00:00 2001 From: Logan Rosen Date: Mon, 27 Jul 2026 21:49:19 -0400 Subject: [PATCH 2/3] Update Detekt task guidance Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2d266459-462b-4648-b82b-c82060787b17 --- docs/android/codestyle.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/android/codestyle.md b/docs/android/codestyle.md index 49ed2868a75..da74b1866f4 100644 --- a/docs/android/codestyle.md +++ b/docs/android/codestyle.md @@ -51,21 +51,23 @@ While KTLint handles Kotlin formatting and style, [Detekt](https://detekt.dev/) ### Running Detekt -Run Detekt for the entire repository, including the convention plugins in the included build: +Run type-resolved analysis for production code across the entire repository, including the convention plugins in the included build: ```bash -./gradlew detekt :build-logic:convention:detekt --continue +./gradlew detektMain :build-logic:convention:detektMain --continue ``` -To analyze a single module, run its `detekt` task: +To generate or update the corresponding baselines, run: ```bash -./gradlew :app:detekt +./gradlew detektBaselineMain :build-logic:convention:detektBaselineMain --continue ``` ### CI integration -Existing findings are recorded in baselines. New Detekt violations fail CI and are reported using the generated [SARIF](/docs/android/tips/sarif_reports.md) report. +Existing findings are recorded in baselines. Android modules use per-variant files such as `detekt-baseline-fullDebug.xml`, while JVM modules use source-set-specific files such as `detekt-baseline-main.xml`. New Detekt violations fail CI and are reported using the generated [SARIF](/docs/android/tips/sarif_reports.md) report. + +The generic `detekt` task and its baseline remain because the Detekt Gradle plugin includes that task in `check`. ## Yamllint From 8ef17fbeff26a9f8a705650e23f7fc8d11beb513 Mon Sep 17 00:00:00 2001 From: Logan Rosen Date: Mon, 27 Jul 2026 22:00:50 -0400 Subject: [PATCH 3/3] Document focused Detekt tasks Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2d266459-462b-4648-b82b-c82060787b17 --- docs/android/codestyle.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/android/codestyle.md b/docs/android/codestyle.md index da74b1866f4..a1134d60c1c 100644 --- a/docs/android/codestyle.md +++ b/docs/android/codestyle.md @@ -57,12 +57,24 @@ Run type-resolved analysis for production code across the entire repository, inc ./gradlew detektMain :build-logic:convention:detektMain --continue ``` +For focused Android analysis, use `::detekt`. For example: + +```bash +./gradlew :app:detektFullDebug +``` + To generate or update the corresponding baselines, run: ```bash ./gradlew detektBaselineMain :build-logic:convention:detektBaselineMain --continue ``` +To refresh only one Android variant baseline, use `::detektBaseline`. For example: + +```bash +./gradlew :app:detektBaselineFullDebug +``` + ### CI integration Existing findings are recorded in baselines. Android modules use per-variant files such as `detekt-baseline-fullDebug.xml`, while JVM modules use source-set-specific files such as `detekt-baseline-main.xml`. New Detekt violations fail CI and are reported using the generated [SARIF](/docs/android/tips/sarif_reports.md) report.