Clarify debug message for package.json omissions

Signed-off-by: Dan Luhring <dan.luhring@anchore.com>
This commit is contained in:
Dan Luhring 2021-01-22 15:20:24 -05:00
parent 9ec3ad58c8
commit d5779a9822
No known key found for this signature in database
GPG Key ID: 9CEE23D079426CEF

View File

@ -174,9 +174,8 @@ func parsePackageJSON(_ string, reader io.Reader) ([]pkg.Package, error) {
return nil, fmt.Errorf("failed to parse package.json file: %w", err) return nil, fmt.Errorf("failed to parse package.json file: %w", err)
} }
if !p.hasMinimumRequiredValues() { if !p.hasNameAndVersionValues() {
log.Debug("encountered package.json file without the minimum number of field values required for" + log.Debug("encountered package.json file without a name and/or version field, ignoring this file")
" consideration as a package")
return nil, nil return nil, nil
} }
@ -204,6 +203,6 @@ func parsePackageJSON(_ string, reader io.Reader) ([]pkg.Package, error) {
return packages, nil return packages, nil
} }
func (p PackageJSON) hasMinimumRequiredValues() bool { func (p PackageJSON) hasNameAndVersionValues() bool {
return p.Name != "" && p.Version != "" return p.Name != "" && p.Version != ""
} }