boundaries

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 22, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package boundaries provides module boundary enforcement for monox.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Checker

type Checker struct {
	// contains filtered or unexported fields
}

Checker checks module boundaries.

func NewChecker

func NewChecker(config *Config, projects map[string]*api.Project, workspaceRoot string) *Checker

NewChecker creates a new boundary checker.

func (*Checker) Check

func (c *Checker) Check() ([]Violation, error)

Check checks all projects for boundary violations.

type Config

type Config struct {
	Rules []Rule `json:"rules" yaml:"rules"`
}

Config holds boundary checking configuration.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns sensible default boundary configuration.

type Rule

type Rule struct {
	// SourceTag is the tag that this rule applies to
	SourceTag string `json:"sourceTag" yaml:"sourceTag"`

	// AllowedTags are tags that can be depended on
	AllowedTags []string `json:"allowedTags" yaml:"allowedTags"`

	// DisallowedTags are tags that cannot be depended on
	DisallowedTags []string `json:"disallowedTags" yaml:"disallowedTags"`

	// AllowCircular allows circular dependencies
	AllowCircular bool `json:"allowCircular" yaml:"allowCircular"`

	// NotDependOnLibsWithTags disallows depending on libs with these tags
	NotDependOnLibsWithTags []string `json:"notDependOnLibsWithTags" yaml:"notDependOnLibsWithTags"`

	// OnlyDependOnLibsWithTags only allows depending on libs with these tags
	OnlyDependOnLibsWithTags []string `json:"onlyDependOnLibsWithTags" yaml:"onlyDependOnLibsWithTags"`
}

Rule defines a boundary rule.

func DefaultRules

func DefaultRules() []Rule

DefaultRules returns sensible default boundary rules.

type Violation

type Violation struct {
	Project    string `json:"project"`
	File       string `json:"file"`
	Line       int    `json:"line"`
	Column     int    `json:"column"`
	Message    string `json:"message"`
	Rule       string `json:"rule"`
	Dependency string `json:"dependency"`
	Severity   string `json:"severity"`
}

Violation represents a boundary violation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL