Skip to content

Support per-layer (crate-group) dependency boundaries within a workspace #891

Description

@adriendellagaspera

Is your feature request related to a problem? Please describe.

bans allows/denies crates workspace-wide, but there's no way to restrict specific crates within a workspace to a subset of dependencies. e.g. in DDD terms, a "domain" layer of crates that must never depend on tokio/hyper/reqwest (or even other crates in the same workspace).

Describe the solution you'd like

Config that declares named layers (crate → layer membership) and, per layer, a list of forbidden external crates. Something like

[[bans.layers]]
name = "dmn"
members = ["dmn1", "dmn2", "dmn3"]
deny = ["tokio", "hyper", "reqwest", "mio", "async-trait"]

Describe alternatives you've considered

A hand-made shell script doing this via cargo metadata and string matching. It works but it's fragile and not declarative.

Additional context

Related to: open #776, closed #409

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions