RulesConfig
Configures rules inside the rules { } block.
aalekh {
rules {
rule("layer-dependency") {
severity = Severity.WARNING
suppressFor(":legacy:**")
}
noTransitiveDependenciesExceeding(30)
rule("no-cyclic-dependencies") {
preventRegression = true
}
}
}Functions
Registers a user-defined com.aalekh.aalekh.analysis.rules.ArchRule implementation by its fully qualified class name.
Forbids modules matching from from transitively depending on modules matching to - the indirect counterpart to forbid { }, which only checks direct edges. Follows the full production dependency closure, so a banned module reached through any chain is a violation. Reports forbidden-transitive-dependency at severity (default ERROR).
Forbids dependencies declared in the sourceSet source set (e.g. "iosMain", "androidMain") from targeting modules matching to - the general form of noCommonMainPlatformDependencies. Every graph edge records its owning source set, so this enforces per-source-set direction with no compiler. Reports source-set-dependency at severity (default ERROR).
Forbids dependencies declared in the sourceSet source set from targeting any module of moduleType - e.g. iosMain must not depend on any ANDROID_LIBRARY. Reports source-set-dependency at severity (default ERROR).
Adds a rule that warns when the module graph's longest dependency chain (its height) exceeds max modules. Graph height is the floor on build parallelism - a tall graph forces long sequential compile chains. Default severity is WARNING. Override with rule("max-graph-height") { severity = ERROR }.
Forbids a KMP module's commonMain source set from depending on a platform-only (JVM- or Android-only) module - such a dependency does not compile for the module's other targets. Reports kmp-common-main-platform-dependency at ERROR (override with rule("kmp-common-main-platform-dependency") { severity = WARNING }). No-op on projects with no KMP source-set dependencies.
Adds a rule that warns about "orphan" modules - modules that neither depend on anything nor are depended on by anything over production edges. Orphans are dead weight in the build. Default severity is WARNING. Override with rule("no-orphan-modules") { severity = ERROR }.
Adds a rule that warns when a module pulls in more than max transitive dependencies. Default severity is WARNING. Override with rule("max-transitive-dependencies") { severity = ERROR }.
Requires every module to belong to a declared layers { } layer. A module matched by no layer pattern is invisible to layer enforcement and can depend on anything; this makes layer coverage exhaustive. Reports the uncovered-module rule at WARNING (promote with rule("uncovered-module") { severity = ERROR }). Does nothing until at least one layer is declared.