Documentation ¶
Index ¶
- Variables
- func ExpandDirectories(args []string) ([]string, error)
- func GetPackageName(filename string) string
- func GetParser(inputType string) func(filename string, data []byte) (*build.File, error)
- func Lint(f *build.File, pkg, lint string, warningsList []string, verbose bool) bool
- func ValidateInputType(inputType string) error
- func ValidateModes(mode, lint string, dflag bool, additionalModes ...string) error
- func ValidateWarnings(warnings string, allWarnings, defaultWarnings *[]string) ([]string, error)
- func WriteTemp(data []byte) (file string, err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var FmtCommand = &cli.Command{ Name: "fmt", Usage: "Format build and skylark files", Flags: []cli.Flag{ cli.StringFlag{ Name: "mode", Usage: `Buildifier mode, one of "check", "diff", "fix", "print_if_changed"`, Value: "fix", }, cli.StringFlag{ Name: "lint", Usage: `lint mode, one of "warn", "fix"`, Value: "fix", }, cli.StringSliceFlag{ Name: "disable", Usage: "Disable rewrites on target", }, cli.StringSliceFlag{ Name: "allow_sort", Usage: "Allow sorting on target", }, cli.StringSliceFlag{ Name: "warning", Usage: "Warning flags", }, cli.StringFlag{ Name: "type", Usage: "Input type (build|workspace|bzl)", Value: "build", }, cli.StringFlag{ Name: "add_tables", Usage: "Path to tables file that will be merged with {SOMETHING}", Value: "build", }, cli.BoolFlag{ Name: "no_recursive", Usage: "Do not process files recursively", }, }, Action: func(c *cli.Context) error { exitCode, err := execute(c) if err != nil { return cli.NewExitError(stdfmt.Sprintf("fmt failed: %v", err), exitCode) } return nil }, }
View Source
var LintCommand = &cli.Command{ Name: "lint", Usage: "Lint build and skylark files", Flags: []cli.Flag{ cli.StringFlag{ Name: "mode", Usage: `Buildifier mode, one of "check", "diff", "fix", "print_if_changed"`, Value: "check", }, cli.StringFlag{ Name: "lint", Usage: `lint mode, one of "warn", "fix"`, Value: "warn", }, cli.StringSliceFlag{ Name: "disable", Usage: "Disable rewrites on target", }, cli.StringSliceFlag{ Name: "allow_sort", Usage: "Allow sorting on target", }, cli.StringSliceFlag{ Name: "warning", Usage: "Warning flags", }, cli.StringFlag{ Name: "type", Usage: "Input type (build|workspace|bzl)", Value: "build", }, cli.StringFlag{ Name: "add_tables", Usage: "Path to tables file that will be merged with {SOMETHING}", Value: "build", }, cli.BoolFlag{ Name: "no_recursive", Usage: "Do not process files recursively", }, }, Action: func(c *cli.Context) error { exitCode, err := execute(c) if err != nil { return cli.NewExitError(stdfmt.Sprintf("fmt failed: %v", err), exitCode) } return nil }, }
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 GetPackageName ¶
GetPackageName returns the package name of a file by searching for a WORKSPACE file
func ValidateInputType ¶
ValidateInputType validates the value of --type
func ValidateModes ¶
ValidateModes validates flags --mode, --lint, and -d
func ValidateWarnings ¶
ValidateWarnings validates the value of the --warnings flag
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.