config

package
v0.21.3 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterIgnoredPaths added in v0.8.0

func FilterIgnoredPaths(paths, ignore []string, checkFileExists bool, rootDir string) ([]string, error)

func FindConfig

func FindConfig(path string) (*os.File, error)

func FindRegalDirectory

func FindRegalDirectory(path string) (*os.File, error)

FindRegalDirectory searches for a .regal directory first in the directory of path, and if not found, in the parent directory, and if not found, in the parent's parent directory, and so on.

func ToMap added in v0.8.0

func ToMap(config Config) map[string]any

Types

type Builtin added in v0.12.0

type Builtin struct {
	Decl Decl `json:"decl" yaml:"decl"`
}

type Capabilities added in v0.12.0

type Capabilities struct {
	Builtins       map[string]*Builtin `json:"builtins"        yaml:"builtins"`
	FutureKeywords []string            `json:"future_keywords" yaml:"future_keywords"`
	Features       []string            `json:"features"        yaml:"features"`
}

func CapabilitiesForThisVersion added in v0.12.0

func CapabilitiesForThisVersion() *Capabilities

CapabilitiesForThisVersion returns the capabilities for the current OPA version Regal depends on.

type Category

type Category map[string]Rule

type Config

type Config struct {
	Rules        map[string]Category `json:"rules"                  yaml:"rules"`
	Ignore       Ignore              `json:"ignore,omitempty"       yaml:"ignore,omitempty"`
	Capabilities *Capabilities       `json:"capabilities,omitempty" yaml:"capabilities,omitempty"`

	// Defaults state is loaded from configuration under rules and so is not (un)marshalled
	// in the same way.
	Defaults Defaults `json:"-" yaml:"-"`
}

func FromMap

func FromMap(confMap map[string]any) (Config, error)

func (Config) MarshalYAML added in v0.19.0

func (config Config) MarshalYAML() (any, error)

func (*Config) UnmarshalYAML added in v0.12.0

func (config *Config) UnmarshalYAML(value *yaml.Node) error

type Decl added in v0.12.0

type Decl struct {
	Args   []string `json:"args"   yaml:"args"`
	Result string   `json:"result" yaml:"result"`
}

type Default added in v0.19.0

type Default struct {
	Level string `json:"level" yaml:"level"`
}

Default represents global or category settings for rules, currently only the level is supported.

type Defaults added in v0.19.0

type Defaults struct {
	Global     Default
	Categories map[string]Default
}

Defaults is used to store information about global and category defaults for rules.

type ExtraAttributes

type ExtraAttributes map[string]any

type Ignore added in v0.5.0

type Ignore struct {
	Files []string `json:"files,omitempty" yaml:"files,omitempty"`
}

type Rule

type Rule struct {
	Level  string
	Ignore *Ignore `json:"ignore,omitempty" yaml:"ignore,omitempty"`
	Extra  ExtraAttributes
}

func (Rule) MarshalJSON

func (rule Rule) MarshalJSON() ([]byte, error)

func (Rule) MarshalYAML added in v0.8.0

func (rule Rule) MarshalYAML() (interface{}, error)

func (*Rule) UnmarshalJSON

func (rule *Rule) UnmarshalJSON(data []byte) error

func (*Rule) UnmarshalYAML added in v0.8.0

func (rule *Rule) UnmarshalYAML(value *yaml.Node) error

Jump to

Keyboard shortcuts

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