Skip to content

Commit 58c15e1

Browse files
authored
Merge pull request #58 from Nordix/validation-for-empty-dir
Add validation for empty directories
2 parents e95a15c + 8388b2f commit 58c15e1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pkg/spdx/implementation.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,9 @@ func (di *spdxDefaultImplementation) PackageFromDirectory(opts *Options, dirPath
803803

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

808811
pkg = NewPackage()

0 commit comments

Comments
 (0)