Documentation ¶
Overview ¶
Package utils contains shared methods that can be used by different implementations of buildifier binary
Index ¶
- func ExpandDirectories(args *[]string) ([]string, error)
- func GetParser(inputType string) func(filename string, data []byte) (*build.File, error)
- func Lint(f *build.File, lint string, warningsList *[]string, verbose bool) []*warn.Finding
- func ValidateFormat(format, mode *string) error
- func ValidateInputType(inputType *string) error
- func ValidateModes(mode, lint *string, dflag *bool, additionalModes ...string) error
- func ValidateWarnings(warnings *string, allWarnings, defaultWarnings *[]string) ([]string, error)
- type Diagnostics
- type FileDiagnostics
- type TempFile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExpandDirectories ¶
ExpandDirectories takes a list of file/directory names and returns a list with file names by traversing each directory recursively and searching for relevant Starlark files.
func ValidateFormat ¶
ValidateFormat validates the value of --format
func ValidateInputType ¶
ValidateInputType validates the value of --type
func ValidateModes ¶
ValidateModes validates flags --mode, --lint, and -d
Types ¶
type Diagnostics ¶
type Diagnostics struct { Success bool `json:"success"` // overall success (whether all files are formatted properly and have no warnings) Files []*FileDiagnostics `json:"files"` // diagnostics per file }
Diagnostics contains diagnostic information returned by formatter and linter
func NewDiagnostics ¶
func NewDiagnostics(fileDiagnostics ...*FileDiagnostics) *Diagnostics
NewDiagnostics returns a new Diagnostics object
type FileDiagnostics ¶
type FileDiagnostics struct { Filename string `json:"filename"` Formatted bool `json:"formatted"` Valid bool `json:"valid"` Warnings []*warning `json:"warnings"` }
FileDiagnostics contains diagnostics information for a file
func InvalidFileDiagnostics ¶
func InvalidFileDiagnostics(filename string) *FileDiagnostics
InvalidFileDiagnostics returns a new FileDiagnostics object for an invalid file
func NewFileDiagnostics ¶
func NewFileDiagnostics(filename string, warnings []*warn.Finding) *FileDiagnostics
NewFileDiagnostics returns a new FileDiagnostics object