Skip to content

[FEATURE] Independence contracts (mutual independence) #40

Description

@LukasNiessen

In short

Say three feature modules should never import each other. Today you'd write a separate rule for every pair. This lets you say it once: 'these modules are mutually independent.'

Problem

Enforcing that a group of sibling modules stay decoupled is a common need; expressing it today requires N×(N-1) pairwise should_not().depend_on_files() rules that are easy to get wrong or leave incomplete. A single independence assertion is declarative and complete.

Proposal

Add a mutual-independence assertion to the existing slices API, e.g. project_slices("src/").defined_by("src.features.(*)").should_not().depend_on_each_other() — one rule instead of N×(N-1) pairwise file rules.

Acceptance criteria

  • project_slices("src/").defined_by("src.features.(*)").should_not().depend_on_each_other() fails if any slice imports another, naming the edge.
  • Works with the existing defined_by / defined_by_regex slice definitions.
  • Empty-test protection applies.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions