Documentation ¶
Index ¶
Constants ¶
View Source
const ConfigName = "staticcheck.conf"
Variables ¶
View Source
var Analyzer = &analysis.Analyzer{ Name: "config", Doc: "loads configuration for the current package tree", Run: func(pass *analysis.Pass) (interface{}, error) { dir := dirAST(pass.Files, pass.Fset) if dir == "" { cfg := DefaultConfig return &cfg, nil } 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", "-ST1020", "-ST1021", "-ST1022", "-ST1023"}, 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", "AMQP", "DB", "TS", }, DotImportWhitelist: []string{}, HTTPStatusCodeWhitelist: []string{"200", "400", "404", "500"}, }
Functions ¶
func Dir ¶
Dir looks at a list of absolute file names, which should make up a single package, and returns the path of the directory that may contain a staticcheck.conf file. It returns the empty string if no such directory could be determined, for example because all files were located in Go's build cache.
Types ¶
Click to show internal directories.
Click to hide internal directories.