Skip to content

Validation

TangleGuard is also a structural linter, which keeps your project’s architecture in place. It verifies the source code regarding predefined rules. Later custom rules will be enabled again too.

Define architectural boundaries by organizing your codebase into layers and specifying allowed dependencies between them.

Create a tangleguard-rules.yaml file in your project root:

  • Directorysrc/
  • Cargo.toml
  • tangleguard-rules.yaml

Example configuration:

layers:
- name: apps
description: "Application entry points"
paths:
- "apps/**"
- name: core
description: "Business logic"
paths:
- "core/**"
rules:
# Apps can depend on core
- from:
layer: apps
to:
layer: core
description: "Applications can use core business logic"

How it works:

  • Define layers using filesystem paths (e.g., apps/** matches everything under apps/)
  • Define rules to allow dependencies from one layer to another
  • Any dependency not explicitly allowed is flagged as a violation

You can validate the dependencies of your codebase in multiple ways:

  • Using the CLI: tangleguard validate. Gives you a small report with the terminal
  • Via GitHub Action, see GitHub Actions, which can be used to reject code which violate the rules from getting merged. That’s one of TangleGuard main strength.
  • Using the UI in the VS Code extension or the desktop app: Highlights the edges which violate rules in the diagram

The design of a codebase is according to the requirements of the application, therefore each design is tailored to its purpose. However there are design concepts, which are bad practice and should be avoided within every bodycode. TangleGuard checks for those anti patterns. Currently the following predefined rules are available:

  • Circular Dependencies: Checks for circular dependencies between components