Add detekt with compose-rules and sort dependencies - #43
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
config/detekt/detekt.yml, throughbuild-logicand applies it to every module,apple,desktopandwebincluded.detektAllruns every module's detekt tasks.com.squareup.sort-dependenciesand sorts everybuild.gradle.kts.network's js/wasmJsnpm()calls are pulled into locals so theirimplementationlines sort cleanly.countryListPresenter,countryDetailPresenter), since they return state rather than emit UI.PreviewAppScreen/PreviewComponentWidth.ContinentsDropdownMenuBoxandActiveFilterChipsare extracted fromSearchAndFilterUi.listCollapsedis no longer passed as aMutableState(MutableStateParam).CountriesAppnow has a stateless overload that takeslistCollapsed: Boolean+onListCollapsedChange, which:desktopuses for its keyboard shortcut, and a stateful overload that keeps the state itself, so:appand:webare unchanged.RepositoryProviders, the high/medium-contrast colour schemes andasEqualsOperator.movableContentOfnow wraps the pane content inCountriesAppandListDetailNavDecoration, so UI state inside a pane survives layout changes.alias(libs.plugins.*), andorg.jetbrains.compose.hot-reloadis declared ready for hot reload.Test plan
./gradlew ktfmtCheck detektAll:ui,:desktop,:web(wasmJs) and:appcompile./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