Documentation ¶
Overview ¶
Package buildifier implements processing of Starlark files via buildifier.
Buildifier is primarily intended for Bazel files. We try to disable as much of Bazel-specific logic as possible, keeping only generally useful Starlark rules.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrActionableFindings is returned by Lint if there are actionable findings. ErrActionableFindings = errors.New("some *.star files have linter warnings, please fix them") )
Functions ¶
func Visit ¶
func Visit(loader interpreter.Loader, paths []string, v Visitor) errors.MultiError
Visit parses Starlark files using Buildifier and calls the callback for each parsed file, in parallel.
Collects all errors from all callbacks in a single joint multi-error.
Types ¶
type Finding ¶
type Finding struct { Path string `json:"path"` Start *Position `json:"start,omitempty"` End *Position `json:"end,omitempty"` Category string `json:"string,omitempty"` Message string `json:"message,omitempty"` Actionable bool `json:"actionable,omitempty"` }
Finding is information about one linting or formatting error.
Implements error interface. Non-actionable findings are assumed to be non-blocking errors.
func Lint ¶
func Lint(loader interpreter.Loader, paths []string, lintChecks []string) (findings []*Finding, err error)
Lint appliers linting and formatting checks to the given files.
Returns all findings and a non-nil error (usually a MultiError) if some findings are blocking.