config

package
v0.0.0-...-1f0868a Latest Latest
Warning

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

Go to latest
Published: May 30, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name: "config",
	Doc:  "loads configuration for the current package tree",
	Run: func(pass *analysis.Pass) (interface{}, error) {
		if len(pass.Files) == 0 {
			cfg := DefaultConfig
			return &cfg, nil
		}

		path := pass.Fset.PositionFor(pass.Files[0].Pos(), true).Filename
		dir := filepath.Dir(path)
		cfg, err := Load(dir)
		if err != nil {
			return nil, fmt.Errorf("error loading staticcheck.conf: %s", err)
		}
		return &cfg, nil
	},
	RunDespiteErrors: true,
	ResultType:       reflect.TypeOf((*Config)(nil)),
}
View Source
var DefaultConfig = Config{
	Checks: []string{"all", "-ST1000", "-ST1003", "-ST1016"},
	Initialisms: []string{
		"ACL", "API", "ASCII", "CPU", "CSS", "DNS",
		"EOF", "GUID", "HTML", "HTTP", "HTTPS", "ID",
		"IP", "JSON", "QPS", "RAM", "RPC", "SLA",
		"SMTP", "SQL", "SSH", "TCP", "TLS", "TTL",
		"UDP", "UI", "GID", "UID", "UUID", "URI",
		"URL", "UTF8", "VM", "XML", "XMPP", "XSRF",
		"XSS", "SIP", "RTP",
	},
	DotImportWhitelist:      []string{},
	HTTPStatusCodeWhitelist: []string{"200", "400", "404", "500"},
}

Functions

This section is empty.

Types

type Config

type Config struct {
	Checks                  []string `toml:"checks"`
	Initialisms             []string `toml:"initialisms"`
	DotImportWhitelist      []string `toml:"dot_import_whitelist"`
	HTTPStatusCodeWhitelist []string `toml:"http_status_code_whitelist"`
}

func For

func For(pass *analysis.Pass) *Config

func Load

func Load(dir string) (Config, error)

func (Config) Merge

func (cfg Config) Merge(ocfg Config) Config

Jump to

Keyboard shortcuts

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