Add debug information to help understand failures finding schemas (#133)

* Add debug information to help understand failures finding schemas

* Add debug information to help understand failures finding schemas
This commit is contained in:
Yann Hamon 2022-10-16 12:28:11 +02:00 committed by GitHub
parent 3cb76bc5e6
commit f68d6ec6ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 67 additions and 24 deletions

View file

@ -10,6 +10,7 @@ import (
type Config struct {
Cache string
CPUProfileFile string
Debug bool
ExitOnError bool
Files []string
SchemaLocations []string
@ -67,6 +68,7 @@ func FromFlags(progName string, args []string) (Config, string, error) {
flags.Var(&schemaLocationsParam, "schema-location", "override schemas location search path (can be specified multiple times)")
flags.StringVar(&skipKindsCSV, "skip", "", "comma-separated list of kinds to ignore")
flags.StringVar(&rejectKindsCSV, "reject", "", "comma-separated list of kinds to reject")
flags.BoolVar(&c.Debug, "debug", false, "print debug information")
flags.BoolVar(&c.ExitOnError, "exit-on-error", false, "immediately stop execution when the first error is encountered")
flags.BoolVar(&c.IgnoreMissingSchemas, "ignore-missing-schemas", false, "skip files with missing schemas instead of failing")
flags.Var(&ignoreFilenamePatterns, "ignore-filename-pattern", "regular expression specifying paths to ignore (can be specified multiple times)")

View file

@ -112,9 +112,10 @@ func TestFromFlags(t *testing.T) {
{
[]string{"-cache", "cache", "-ignore-missing-schemas", "-kubernetes-version", "1.16.0", "-n", "2", "-output", "json",
"-schema-location", "folder", "-schema-location", "anotherfolder", "-skip", "kinda,kindb", "-strict",
"-reject", "kindc,kindd", "-summary", "-verbose", "file1", "file2"},
"-reject", "kindc,kindd", "-summary", "-debug", "-verbose", "file1", "file2"},
Config{
Cache: "cache",
Debug: true,
Files: []string{"file1", "file2"},
IgnoreMissingSchemas: true,
KubernetesVersion: "1.16.0",