func ExpandDirectories(args *[]string) ([]string, error)
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 GetParser(inputType string) func(filename string, data []byte) (*build.File, error)
GetParser returns a parser for a given file type
func Lint(f *build.File, lint string, warningsList *[]string, verbose bool) []*warn.Finding
Lint calls the linter and returns a list of unresolved findings
Diagnostics contains diagnostic information returned by formatter and linter
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 }
func NewDiagnostics(fileDiagnostics ...*FileDiagnostics) *Diagnostics
NewDiagnostics returns a new Diagnostics object
func (d *Diagnostics) Format(format string, verbose bool) string
Format formats a Diagnostics object either as plain text or as json
FileDiagnostics contains diagnostics information for a file
type FileDiagnostics struct { Filename string `json:"filename"` Formatted bool `json:"formatted"` Valid bool `json:"valid"` Warnings []*warning `json:"warnings"` }
func InvalidFileDiagnostics(filename string) *FileDiagnostics
InvalidFileDiagnostics returns a new FileDiagnostics object for an invalid file
func NewFileDiagnostics(filename string, warnings []*warn.Finding) *FileDiagnostics
NewFileDiagnostics returns a new FileDiagnostics object
TempFile keeps track of temporary files and cleans them up in the end
type TempFile struct {
// contains filtered or unexported fields
}
func (tf *TempFile) Clean() error
Clean removes all created temporary files
func (tf *TempFile) WriteTemp(data []byte) (file string, err error)
WriteTemp writes data to a temporary file and returns the name of the file.