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" )
Click to show internal directories.
Click to hide internal directories.