forbidReachable

fun forbidReachable(from: String, to: String, because: String = "", severity: Severity = Severity.ERROR)(source)

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).

rules { forbidReachable(from = ":core:domain", to = ":platform:android", because = "keep domain pure") }