mirror of
https://github.com/yannh/kubeconform.git
synced 2026-04-14 08:24:45 +00:00
count empty files in the number of parsed files in text output
This commit is contained in:
parent
54d899f8f6
commit
51732e6a21
5 changed files with 24 additions and 5 deletions
|
|
@ -65,7 +65,12 @@ func ValidateStream(r io.Reader, regs []registry.Registry, k8sVersion string, c
|
|||
return []validationResult{{err: fmt.Errorf("failed reading file: %s", err)}}
|
||||
}
|
||||
|
||||
|
||||
validationResults := []validationResult{}
|
||||
if len(rawResources) == 0 {
|
||||
// In case a file has no resources, we want to capture that the file was parsed - and therefore send a message with an empty resource and no error
|
||||
validationResults = append(validationResults, validationResult{kind: "", version: "", Name: "", err: nil, skipped: false})
|
||||
}
|
||||
|
||||
for _, rawResource := range rawResources {
|
||||
var sig resource.Signature
|
||||
|
|
@ -75,6 +80,7 @@ func ValidateStream(r io.Reader, regs []registry.Registry, k8sVersion string, c
|
|||
}
|
||||
|
||||
if sig.Kind == "" {
|
||||
validationResults = append(validationResults, validationResult{kind: "", version: "", Name: "", err: nil, skipped: false})
|
||||
continue // We skip resoures that don't have a Kind defined
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue