config

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConsoleOutput = "console"
	JSONOutput    = "json"
	GithubOutput  = "github"

	ErrorLevel   = "error"
	WarningLevel = "warning"
	InfoLevel    = "info"
)

Variables

This section is empty.

Functions

func ApplyModInfo added in v0.9.0

func ApplyModInfo(conf *Config) error

ApplyModInfo add the the mod info to all analyzers are in need of such info

func GenerateConfig

func GenerateConfig()

Types

type Config

type Config struct {
	Analyzers  map[string]map[string]string `json:"analyzers" yaml:"analyzers"`
	Module     string                       `json:"module" yaml:"module"`
	Debug      string                       `json:"debug" yaml:"debug"`
	CPUProfile string                       `json:"cpuprofile" yaml:"cpuprofile"`
	MemProfile string                       `json:"memprofile" yaml:"memprofile"`
	Trace      string                       `json:"trace" yaml:"trace"`
	Output     string                       `json:"output" yaml:"output"`
	GoVersion  string                       `json:"go_version" yaml:"go_version"`
	Args       []string                     `json:"-" yaml:"-"`
	Severity   []*SeverityRule              `json:"severity" yaml:"severity"`
	Exclude    []*Rule                      `json:"exclude" yaml:"exclude"`
	Test       bool                         `json:"test" yaml:"test"`
	Fix        bool                         `json:"fix" yaml:"fix"`
}

func ParseConfig

func ParseConfig() *Config

type ModInfo added in v0.9.0

type ModInfo struct {
	Path      string `json:"Path"`
	GoVersion string `json:"GoVersion"`
}

ModInfo contains the version of go and module name

func GetModInfo added in v0.9.0

func GetModInfo() (*ModInfo, error)

GetModInfo returns the base info about module name and go version TODO: support path in case of monorepo

type Rule added in v0.8.0

type Rule struct {
	PackageRE *regexp.Regexp `json:"-" yaml:"-"`
	PathRE    *regexp.Regexp `json:"-" yaml:"-"`
	MessageRE *regexp.Regexp `json:"-" yaml:"-"`
	Package   string         `json:"package" yaml:"package"`
	Analyzer  string         `json:"analyzer" yaml:"analyzer"`
	Path      string         `json:"path" yaml:"path"`
	Message   string         `json:"message" yaml:"message"`
	Severity  string         `json:"severity" yaml:"severity"`
	GitRef    string         `json:"git_ref" yaml:"git_ref"`
}

type SeverityRule added in v0.8.0

type SeverityRule struct {
	Level string  `json:"level" yaml:"level"`
	Rules []*Rule `json:"rules" yaml:"rules"`
}

Jump to

Keyboard shortcuts

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