Skip to content

Commit

Permalink
fix: don't scan empty files when --only-k8s-files flag is used datree…
Browse files Browse the repository at this point in the history
…io#934

Co-authored-by: Alon Zylberberg <alon@Alons-MBP.Home>
  • Loading branch information
alonzyl and Alon Zylberberg committed May 8, 2023
1 parent 6221ac0 commit 5daac43
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bl/validation/k8sValidator.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ func (val *K8sValidator) GetK8sFiles(filesConfigurationsChan chan *extractor.Fil
}

func (val *K8sValidator) isK8sFile(fileConfigurations []extractor.Configuration) bool {
// if the file is empty, the array is empty and doesn't enter the for loop
if len(fileConfigurations) == 0 {
return false
}
for _, configuration := range fileConfigurations {
has_apiVersion := configuration.ApiVersion != ""
has_kind := configuration.Kind != ""
Expand Down

0 comments on commit 5daac43

Please sign in to comment.