Skip to content

Commit

Permalink
Merge pull request #58 from Nordix/validation-for-empty-dir
Browse files Browse the repository at this point in the history
Add validation for empty directories
  • Loading branch information
k8s-ci-robot authored Feb 2, 2022
2 parents e95a15c + 8388b2f commit 58c15e1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/spdx/implementation.go
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,9 @@ func (di *spdxDefaultImplementation) PackageFromDirectory(opts *Options, dirPath

// Apply the ignore patterns to the list of files
fileList = di.ApplyIgnorePatterns(fileList, patterns)
if len(fileList) == 0 {
return nil, errors.Errorf("directory %s has no files to scan", dirPath)
}
logrus.Infof("Scanning %d files and adding them to the SPDX package", len(fileList))

pkg = NewPackage()
Expand Down

0 comments on commit 58c15e1

Please sign in to comment.