Skip to content

Make swing-ui-detekt self-contained: its own rule sets replace Android Lint - #47

Merged
Ivan Matkov (MatkovIvan) merged 8 commits into
masterfrom
ivan.matkov/self-contained-static-analysis
Nov 19, 2026
Merged

Ivan Matkov (MatkovIvan) merged 8 commits into
masterfrom
ivan.matkov/self-contained-static-analysis

Conversation

@MatkovIvan

@MatkovIvan Ivan Matkov (MatkovIvan) commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator
  • Rule API
    • swing-ui-detekt exposes ComposeSwingRule, ComposeSwingRuleReporter, ComposeSwingRuleConfig, and ComposeSwingRuleSets for hosts that analyze Kotlin PSI.
    • The concrete Detekt rule classes move to the host-neutral rule API (breaking).
  • Rule sets
    • androidx-annotations checks range, size, restricted access, and visibility for tests. compose-runtime checks state, effects, and composable declarations.
    • Settings and qualified suppressions use the owning rule set ID. Swing rules recognize SwingModifier, SwingNode, and MenuNode.
  • Build
    • The library runs the same artifact as consumers. staticAnalysis runs with type resolution and treats warnings as build failures.

@MatkovIvan
Ivan Matkov (MatkovIvan) force-pushed the ivan.matkov/self-contained-static-analysis branch 2 times, most recently from b15b7dd to 3bbfa45 Compare November 18, 2026 19:47
…rule API

A rule written against detekt's Rule class runs nowhere else. Rules implement ComposeSwingRule, a
visitor API free of detekt types, and one adapter in the detekt package runs them, so another host
can run the same rules. Every existing rule moves onto the API with unchanged findings, and
detekt.yml forbids a detekt import in the rules package.
@MatkovIvan
Ivan Matkov (MatkovIvan) force-pushed the ivan.matkov/self-contained-static-analysis branch 2 times, most recently from 9249626 to d432215 Compare November 19, 2026 12:56
… rule sets

Consumers copy a Compose block into their detekt.yml to point compose-rules at this library's types,
and the IDE cannot run those rules. The library adapts compose-rules' host-neutral visitors as its
own rules with the library's types built in and ports its eight detekt-only checks and their tests
onto the rule API, so a consumer needs no compose-rules detekt artifact or configuration. The
catalog entry io.nlopez.compose.rules:detekt becomes common-detekt, still at 0.6.8. Flagged call
sites are fixed or carry a reasoned suppression: Canvas drawing slot, two modifier factories.
Adds the shared helpers forked from androidx compose/lint/common and forks the RememberReturnType,
OpaqueUnitKey and RememberInComposition detectors onto the host-neutral rule API, registered in the
compose-runtime rule set with their issue ids, messages and test cases. The fixtures source set
compiles against androidx.compose.runtime. Test windows take their state from rememberWindowState.
…report

Forks androidx's ProduceState, ComposableCoroutineCreation and ComposableFlowOperator detectors onto
the host-neutral rule API, registered in the compose-runtime rule set with their issue ids,
messages and test cases.
…port

Forks androidx's AutoboxingStateValueProperty, ComposableStateFlowValue,
MutableCollectionMutableState and FrequentlyChangingValue detectors onto the host-neutral rule API,
registered in the compose-runtime rule set with their issue ids, messages and test cases.
…cks report

Forks androidx's RetainDetector and RememberSaveableDetector onto the host-neutral rule API,
registered in the compose-runtime rule set with their issue ids, messages and test cases. The
catalog gains androidx.compose.runtime:runtime-retain; the test classpath gains runtime-retain and
runtime-saveable, and the fixtures classpath runtime-retain.
Forks androidx's ComposableLambdaParameterDetector with its issue ids, messages and test cases, and
adds a rule that checks a constant argument against its parameter's declared IntRange or FloatRange,
for Gradle consumers and in the IDE. RestrictedApi ports androidx's RestrictToDetector; without
Maven coordinates, every library scope means declared outside the module under analysis. The test
and fixtures classpaths gain androidx.annotation.
Android Lint hosted only the Compose runtime checks and the Range, RestrictedApi and VisibleForTests
contracts. The library's rule sets report the Compose runtime contracts, declared ranges and
restricted APIs, including APIs restricted to tests, so the standalone Lint plugin, its checks
dependency and its configuration leave the build.

Rule sets and implementation packages follow the APIs they check.
@MatkovIvan
Ivan Matkov (MatkovIvan) force-pushed the ivan.matkov/self-contained-static-analysis branch from d432215 to 113925e Compare November 19, 2026 20:27
@MatkovIvan
Ivan Matkov (MatkovIvan) merged commit 113925e into master Nov 19, 2026
4 checks passed
@MatkovIvan
Ivan Matkov (MatkovIvan) deleted the ivan.matkov/self-contained-static-analysis branch November 19, 2026 20:43

This branch was previously deployed

1 inactive deployment
github-pages — 113925e7 Deployed Nov 19, 2026 by MatkovIvan via Publish API Reference #57
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