spec

package
v1.11.2 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Component

type Component interface {
	// RelativePaths can contain glob's
	// example:
	// 	- internal/service/*/models/**
	// 	- /
	// 	- tests/**
	RelativePaths() []models.Glob
}

type ComponentName

type ComponentName = string

ComponentName is abstraction useful for mapping real packages to one Component.

type Components

type Components = map[ComponentName]common.Referable[Component]

type DependencyRule

type DependencyRule interface {
	// MayDependOn is list of Component names, that can be imported to described component
	MayDependOn() []common.Referable[string]

	// CanUse is list of Vendor names, that can be imported to described component
	CanUse() []common.Referable[string]

	// AnyProjectDeps allow component to import any other local namespace packages
	AnyProjectDeps() common.Referable[bool]

	// AnyVendorDeps allow component to import any other vendor namespace packages
	AnyVendorDeps() common.Referable[bool]

	// DeepScan overrides deepScan global option
	DeepScan() common.Referable[bool]
}

type Document

type Document interface {
	// Version of spec (scheme of document)
	Version() common.Referable[int]

	// WorkingDirectory relative to root, prepend this to all path's from spec
	WorkingDirectory() common.Referable[string]

	// Options is global spec options
	Options() Options

	// ExcludedDirectories from analyze, each contain relative directory name
	// List of directories
	// examples:
	// 	- internal/test
	//	- vendor
	//	- .idea
	ExcludedDirectories() []common.Referable[string]

	// ExcludedFilesRegExp from analyze, each project file will be matched with this regexp rules
	// List of regexp's
	// examples:
	// 	- "^.*_test\\.go$"
	ExcludedFilesRegExp() []common.Referable[string]

	// Vendors (map)
	Vendors() Vendors

	// CommonVendors is list of Vendors that can be imported to any project package
	CommonVendors() []common.Referable[string]

	// Components (map)
	Components() Components

	// CommonComponents is List of Components that can be imported to any project package
	CommonComponents() []common.Referable[string]

	// Dependencies map between Components and DependencyRule`s
	Dependencies() Dependencies
}

type Options

type Options interface {
	// IsDependOnAnyVendor allows all project code depend on any third party vendor lib
	// analyze will not check imports with not local namespace's
	IsDependOnAnyVendor() common.Referable[bool]

	// DeepScan turn on usage of advanced AST linter
	// this is default behavior since v3+ configs
	DeepScan() common.Referable[bool]
}

type Vendor

type Vendor interface {
	// ImportPaths is list of full import vendor qualified path
	// example:
	// 	- golang.org/x/mod/modfile
	// 	- example.com/*/libs/**
	ImportPaths() []models.Glob
}

type VendorName

type VendorName = string

VendorName is abstraction useful for mapping real vendor packages to one Vendor.

type Vendors

type Vendors = map[VendorName]common.Referable[Vendor]

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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