Skip to content

Add detekt with compose-rules and sort dependencies - #43

Merged
solcott merged 5 commits into
mainfrom
feature/compose_stability
Sep 29, 2026
Merged

solcott merged 5 commits into
mainfrom
feature/compose_stability

Conversation

@solcott

@solcott solcott commented Sep 29, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Static analysis. Wires detekt, with the compose-rules plugin and a central config/detekt/detekt.yml, through build-logic and applies it to every module, apple, desktop and web included. detektAll runs every module's detekt tasks.
  • Dependency sorting. Applies com.squareup.sort-dependencies and sorts every build.gradle.kts. network's js/wasmJs npm() calls are pulled into locals so their implementation lines sort cleanly.
  • Fixes the new rules forced:
    • The presenter functions are now lowercase (countryListPresenter, countryDetailPresenter), since they return state rather than emit UI.
    • The multipreview annotations are renamed to PreviewAppScreen / PreviewComponentWidth.
    • ContinentsDropdownMenuBox and ActiveFilterChips are extracted from SearchAndFilterUi.
    • listCollapsed is no longer passed as a MutableState (MutableStateParam). CountriesApp now has a stateless overload that takes listCollapsed: Boolean + onListCollapsedChange, which :desktop uses for its keyboard shortcut, and a stateful overload that keeps the state itself, so :app and :web are unchanged.
    • Removes unused code: RepositoryProviders, the high/medium-contrast colour schemes and asEqualsOperator.
  • movableContentOf now wraps the pane content in CountriesApp and ListDetailNavDecoration, so UI state inside a pane survives layout changes.
  • Build. The Kotlin jvm/multiplatform plugins move into the version catalog behind alias(libs.plugins.*), and org.jetbrains.compose.hot-reload is declared ready for hot reload.

Test plan

  • ./gradlew ktfmtCheck detektAll
  • :ui, :desktop, :web (wasmJs) and :app compile
  • CI
  • ./gradlew :desktop:run: in two-pane width with a country open, the toolbar button and the keyboard shortcut both toggle the list

🤖 Generated with Claude Code

Reorders `api` and `implementation` declarations across all modules to maintain alphabetical sorting. In the `network` module's JS and Wasm targets, `npm()` calls are extracted to local variables so their `implementation` lines can be sorted cleanly.
Applies the `detekt` and `com.squareup.sort-dependencies` Gradle plugins across the project, backed by a central `detekt.yml` configuration. To satisfy the new rules and clean up the codebase:
- Rename presenter functions (`countryListPresenter`, `countryDetailPresenter`) to lowercase, conforming to Compose naming conventions for functions that return state.
- Rename custom preview annotations to standard prefixes (`PreviewAppScreen`, `PreviewComponentWidth`).
- Extract `ContinentsDropdownMenuBox` and `ActiveFilterChips` in `SearchAndFilterUi` to resolve function length and complexity warnings.
- Hoist `listCollapsed` using a boolean and callback rather than leaking `MutableState` into `CountriesApp`.
- Remove unused code, including `RepositoryProviders`, high/medium contrast color schemes in `Theme.kt`, and the `asEqualsOperator` extension in `CountriesApi`.

Additionally, pane content in `CountriesApp` and `ListDetailNavDecoration` is now wrapped in `movableContentOf` to preserve internal UI state across layout changes.
Rearrange dependency declarations in `apple/build.gradle.kts`, `desktop/build.gradle.kts`, and `web/build.gradle.kts` to maintain a consistent order. Dependencies are now grouped by type (local projects first, followed by external `compose.*` and `libs.*` coordinates), and sorted alphabetically within each block.

Comments explaining specific dependencies were correctly preserved alongside their respective declarations.
Moves `org.jetbrains.kotlin.jvm` and `org.jetbrains.kotlin.multiplatform` to `libs.versions.toml` and replaces hardcoded string plugin IDs with type-safe `alias(libs.plugins.*)` accessors in the `apple`, `desktop`, and `web` modules.

Additionally declares the `org.jetbrains.compose.hot-reload` (1.3.0-alpha02) plugin in the catalog and root `build.gradle.kts` to prepare for hot reload support.
Adds `id("detekt")` and `alias(libs.plugins.dependency.sorter)` to the `apple`, `desktop`, and `web` `build.gradle.kts` scripts, extending static analysis and dependency sorting rules to these platform entry-point modules.
@solcott
solcott merged commit 569568a into main Sep 29, 2026
1 check passed
@solcott
solcott deleted the feature/compose_stability branch September 29, 2026 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant