From 528cbd94c4ba2c6371cc2d74b1262ad98336649a Mon Sep 17 00:00:00 2001 From: Jason Ross Date: Wed, 1 Jul 2026 15:28:25 -0500 Subject: [PATCH] chore(preflight): add ktlintCheck + detekt to the fast gate CI's "Static analysis" job runs :app:ktlintCheck :app:detekt, which the local preflight gate did not, so style violations in test/androidTest source sets (which lintDebug skips) failed the merge gate only after push. Add both to the /preflight skill and mirror the change in CLAUDE.md. Co-Authored-By: Claude Opus 4.8 --- .claude/skills/preflight/SKILL.md | 20 ++++++++++++++------ CLAUDE.md | 7 +++++-- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/.claude/skills/preflight/SKILL.md b/.claude/skills/preflight/SKILL.md index 07fc071..6bd417a 100644 --- a/.claude/skills/preflight/SKILL.md +++ b/.claude/skills/preflight/SKILL.md @@ -1,6 +1,6 @@ --- name: preflight -description: Run LibreMail's fast CI gate locally (assembleDebug + testDebugUnitTest + lintDebug) before pushing or opening a PR. Mirrors the merge gate; does NOT run emulator E2E. Use before treating a change as done. +description: Run LibreMail's fast CI gate locally (assembleDebug + testDebugUnitTest + lintDebug + ktlintCheck + detekt) before pushing or opening a PR. Mirrors the merge gate; does NOT run emulator E2E. Use before treating a change as done. --- # /preflight @@ -16,20 +16,28 @@ Run the same fast checks CI enforces on every PR, in order, and report the outco ## Steps -Run these three, stopping at the first failure: +Run these, stopping at the first failure: ```bash ./gradlew :app:assembleDebug ./gradlew :app:testDebugUnitTest ./gradlew :app:lintDebug +./gradlew :app:ktlintCheck :app:detekt ``` -To keep going and collect every failure in one pass, add `--continue`. +`ktlintCheck` + `detekt` are exactly what CI's **Static analysis** job runs — they cover the +`test`/`androidTest` source sets that `lintDebug` does not, so a style violation there fails the +merge gate even when the build and lint are green. Add `--continue` to any command (e.g. +`:app:ktlintCheck :app:detekt --continue`) to collect every failure in one pass instead of +stopping at the first. ## Reporting -- If all three pass, say so plainly (e.g. "preflight green: build, unit tests, lint"). -- On failure, surface the actual Gradle error. For test failures, point at the report under - `app/build/reports/tests/testDebugUnitTest/`; for lint, `app/build/reports/lint-results-debug.html`. +- If everything passes, say so plainly (e.g. "preflight green: build, unit tests, lint, ktlint, detekt"). +- On failure, surface the actual Gradle error and point at the relevant report: + - unit tests → `app/build/reports/tests/testDebugUnitTest/` + - lint → `app/build/reports/lint-results-debug.html` + - ktlint → `app/build/reports/ktlint/` (per source set, e.g. `ktlintTestSourceSetCheck/`) + - detekt → `app/build/reports/detekt/` - Do **not** run emulator/E2E (`connectedDebugAndroidTest`) here — that's CI's job unless the user explicitly asks. diff --git a/CLAUDE.md b/CLAUDE.md index 46ccb4c..8c0bcf7 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -15,6 +15,7 @@ Use a **JDK 17–21** for the Gradle daemon. AGP 9.2 does **not** support JDK 25 ./gradlew :app:assembleDebug # build debug APK ./gradlew :app:testDebugUnitTest # JVM unit tests ./gradlew :app:lintDebug # Android lint +./gradlew :app:ktlintCheck :app:detekt # static analysis (CI's "Static analysis" gate) # single unit test: ./gradlew :app:testDebugUnitTest --tests "org.libremail.data.SomeClassTest" ``` @@ -25,8 +26,10 @@ or via Gradle Managed Devices `./gradlew e2eGroupDebugAndroidTest` (whole matrix `app/build.gradle.kts` must stay in lockstep with the E2E matrix in `.github/workflows/ci.yml`. **Before treating a change as done**, run the fast CI gate: `assembleDebug` + -`testDebugUnitTest` + `lintDebug` (the `/preflight` skill does this). Emulator E2E is -left to CI unless asked. +`testDebugUnitTest` + `lintDebug` + `ktlintCheck` + `detekt` (the `/preflight` skill does +this). `ktlintCheck`/`detekt` cover the `test`/`androidTest` source sets that `lintDebug` +skips, so they catch style violations that would otherwise fail CI's Static analysis gate. +Emulator E2E is left to CI unless asked. ## Build-config gotchas -- 2.47.3