Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@luhring
Copy link
Contributor

@luhring luhring commented Jan 22, 2021

Closes #311

This PR changes the parsing of package.json such that files that don't include the minimally required fields (currently name and version) will not be surfaced as packages. A DEBUG level message is logged in this case.

@luhring luhring requested review from alfredodeza and zhill January 22, 2021 19:01
@luhring luhring self-assigned this Jan 22, 2021
}

if !p.hasMinimumRequiredValues() {
log.Debug("encountered package.json file without the minimum number of field values required for" +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which fields? (I know, but a user will probably not)

}

if len(actual) != 0 {
t.Errorf("no packages should've been returned")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
t.Errorf("no packages should've been returned")
t.Errorf("no packages should've been returned, but got %d", len(actual))

@@ -1,2 +1,5 @@
FROM alpine:latest
RUN apk add tzdata vim alpine-sdk
FROM alpine@sha256:d9a7354e3845ea8466bb00b22224d9116b183e594527fb5b6c3d30bc01a20378
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yassss

@luhring luhring force-pushed the omit-empty-packages branch from e5bfbaa to 9ec3ad5 Compare January 22, 2021 19:03
@luhring luhring requested a review from alfredodeza January 22, 2021 20:25
@luhring luhring merged commit 7bcdafe into main Jan 22, 2021
@luhring luhring deleted the omit-empty-packages branch January 22, 2021 21:10
GijsCalis pushed a commit to GijsCalis/syft that referenced this pull request Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Partial package.json files lead to empty packages in output

3 participants