mirror of
https://github.com/yannh/kubeconform.git
synced 2026-02-20 18:37:01 +00:00
linting
This commit is contained in:
parent
0bbee68c49
commit
031f83cbde
3 changed files with 8 additions and 5 deletions
|
|
@ -80,7 +80,7 @@ func New(schemaLocation string, strict bool, skipTLS bool) (Registry, error) {
|
||||||
|
|
||||||
if strings.HasPrefix(schemaLocation, "http") {
|
if strings.HasPrefix(schemaLocation, "http") {
|
||||||
return newHTTPRegistry(schemaLocation, strict, skipTLS), nil
|
return newHTTPRegistry(schemaLocation, strict, skipTLS), nil
|
||||||
} else {
|
|
||||||
return newLocalRegistry(schemaLocation, strict), nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return newLocalRegistry(schemaLocation, strict), nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,10 @@ import (
|
||||||
"io"
|
"io"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Thank you https://github.com/helm/helm-classic/blob/master/codec/yaml.go#L90
|
// SplitYAMLDocument is a bufio.SplitFunc for splitting a YAML document into individual documents.
|
||||||
|
//
|
||||||
|
// This is from Kubernetes' 'pkg/util/yaml'.splitYAMLDocument, which is unfortunately
|
||||||
|
// not exported.
|
||||||
func SplitYAMLDocument(data []byte, atEOF bool) (advance int, token []byte, err error) {
|
func SplitYAMLDocument(data []byte, atEOF bool) (advance int, token []byte, err error) {
|
||||||
const yamlSeparator = "\n---"
|
const yamlSeparator = "\n---"
|
||||||
if atEOF && len(data) == 0 {
|
if atEOF && len(data) == 0 {
|
||||||
|
|
|
||||||
|
|
@ -157,9 +157,9 @@ func (val *v) ValidateResource(res resource.Resource) Result {
|
||||||
if schema == nil {
|
if schema == nil {
|
||||||
if val.opts.IgnoreMissingSchemas {
|
if val.opts.IgnoreMissingSchemas {
|
||||||
return Result{Resource: res, Err: nil, Status: Skipped}
|
return Result{Resource: res, Err: nil, Status: Skipped}
|
||||||
} else {
|
|
||||||
return Result{Resource: res, Err: fmt.Errorf("could not find schema for %s", sig.Kind), Status: Error}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Result{Resource: res, Err: fmt.Errorf("could not find schema for %s", sig.Kind), Status: Error}
|
||||||
}
|
}
|
||||||
|
|
||||||
resourceLoader := gojsonschema.NewGoLoader(r)
|
resourceLoader := gojsonschema.NewGoLoader(r)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue