models

package
v0.0.0-...-7b22c59 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2020 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 PackageRule

type PackageRule struct {
	Type    RuleType `yaml:"type"`
	Imports []string `yaml:"imports"`
	Except  []string `yaml:"except"`
}

PackageRule contains allowed and disallowed import path prefixes

func (PackageRule) IsValidImport

func (r PackageRule) IsValidImport(fpath, imp string) error

IsValidImport checks whether the given import can be used in the given package or not It takes 2 arguments 1: file path that contains imports 2: import path being used

func (PackageRule) Validate

func (r PackageRule) Validate() error

Validate validates whether the Rules struct is valid or not

type RuleType

type RuleType string

RuleType signifies the type of the rule for given package

const (
	// RuleTypeAllowlist showcases the imports mentioned
	// are allowlisted and all other (except "except" ones)
	// should not be used in the package
	RuleTypeAllowlist RuleType = "allowlist"

	// RuleTypeBlocklist showcases the imports mentioned
	// are blocklisted and all other (including the "except" ones)
	// can be used in the package
	RuleTypeBlocklist RuleType = "blocklist"
)

Jump to

Keyboard shortcuts

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