-
-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
filter license when undefined to fix error in /discussions/1255 #1256
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0c81b3d
Test filter license when undefined to fix error in /discussions/1255,…
122ef38
Remove multi license test since it already exits and fix formatting -…
10d9917
Run pnpm to fix linting issuse - Signed-off-by: Cory Fitzpatrick fitz…
3cae487
Enable getRepoLicense and getGoPkgLicense tests - Signed-off-by: Cory…
e83f871
Cleanup package json - Signed-off-by: Cory Fitzpatrick [email protected]
8293f36
Cleanup package json - Signed-off-by: Cory Fitzpatrick [email protected]
f9ab213
Formatting fix in utils.test - Signed-off-by: Cory Fitzpatrick fitzmx…
42b3324
Ran pnpm again to fix formatting - Signed-off-by: Cory Fitzpatrick fi…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,3 +125,6 @@ roots/ | |
.python-version | ||
build/ | ||
.mise.toml | ||
|
||
# Ignore IntelliJ IDEA module file | ||
cdxgen.iml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,10 +8,12 @@ import { | |
findLicenseId, | ||
getCratesMetadata, | ||
getDartMetadata, | ||
getGoPkgLicense, | ||
getLicenses, | ||
getMvnMetadata, | ||
getNugetMetadata, | ||
getPyMetadata, | ||
getRepoLicense, | ||
guessPypiMatchingVersion, | ||
hasAnyProjectType, | ||
isValidIriReference, | ||
|
@@ -2246,76 +2248,82 @@ test("parsePomMetadata", async () => { | |
const data = await getMvnMetadata(deps); | ||
expect(data.length).toEqual(deps.length); | ||
}); | ||
/* | ||
|
||
test("get repo license", async () => { | ||
let license = await utils.getRepoLicense( | ||
"https://github.com/ShiftLeftSecurity/sast-scan" | ||
let license = await getRepoLicense( | ||
"https://github.com/ShiftLeftSecurity/sast-scan", | ||
{ | ||
group: "ShiftLeftSecurity", | ||
name: "sast-scan", | ||
}, | ||
); | ||
expect(license).toEqual({ | ||
id: "GPL-3.0-or-later", | ||
url: "https://github.com/ShiftLeftSecurity/sast-scan/blob/master/LICENSE" | ||
id: "Apache-2.0", | ||
url: "https://github.com/ShiftLeftSecurity/sast-scan/blob/master/LICENSE", | ||
}); | ||
|
||
license = await utils.getRepoLicense("https://github.com/cyclonedx/cdxgen", { | ||
group: "", | ||
name: "cdxgen" | ||
license = await getRepoLicense("https://github.com/cyclonedx/cdxgen", { | ||
group: "cyclonedx", | ||
name: "cdxgen", | ||
}); | ||
expect(license).toEqual({ | ||
id: "Apache-2.0", | ||
url: "https://github.com/cyclonedx/cdxgen/blob/master/LICENSE" | ||
url: "https://github.com/CycloneDX/cdxgen/blob/master/LICENSE", | ||
}); | ||
|
||
license = await utils.getRepoLicense("https://cloud.google.com/go", { | ||
// These tests are disabled because they are returning undefined | ||
/* | ||
license = await getRepoLicense("https://cloud.google.com/go", { | ||
group: "cloud.google.com", | ||
name: "go" | ||
}); | ||
expect(license).toEqual("Apache-2.0"); | ||
|
||
license = await utils.getRepoLicense(undefined, { | ||
license = await getRepoLicense(undefined, { | ||
group: "github.com/ugorji", | ||
name: "go" | ||
}); | ||
expect(license).toEqual({ | ||
id: "MIT", | ||
url: "https://github.com/ugorji/go/blob/master/LICENSE" | ||
}); | ||
*/ | ||
}); | ||
|
||
test("get go pkg license", async () => { | ||
jest.setTimeout(120000); | ||
let license = await utils.getGoPkgLicense({ | ||
let license = await getGoPkgLicense({ | ||
group: "github.com/Azure/azure-amqp-common-go", | ||
name: "v2" | ||
name: "v2", | ||
}); | ||
expect(license).toEqual([ | ||
{ | ||
id: "MIT", | ||
url: "https://pkg.go.dev/github.com/Azure/azure-amqp-common-go/v2?tab=licenses" | ||
} | ||
url: "https://pkg.go.dev/github.com/Azure/azure-amqp-common-go/v2?tab=licenses", | ||
}, | ||
]); | ||
|
||
license = await utils.getGoPkgLicense({ | ||
license = await getGoPkgLicense({ | ||
group: "go.opencensus.io", | ||
name: "go.opencensus.io" | ||
name: "go.opencensus.io", | ||
}); | ||
expect(license).toEqual([ | ||
{ | ||
id: "Apache-2.0", | ||
url: "https://pkg.go.dev/go.opencensus.io?tab=licenses" | ||
} | ||
url: "https://pkg.go.dev/go.opencensus.io?tab=licenses", | ||
}, | ||
]); | ||
|
||
license = await utils.getGoPkgLicense({ | ||
license = await getGoPkgLicense({ | ||
group: "github.com/DataDog", | ||
name: "zstd" | ||
name: "zstd", | ||
}); | ||
expect(license).toEqual([ | ||
{ | ||
id: "BSD-3-Clause", | ||
url: "https://pkg.go.dev/github.com/DataDog/zstd?tab=licenses" | ||
} | ||
url: "https://pkg.go.dev/github.com/DataDog/zstd?tab=licenses", | ||
}, | ||
]); | ||
}); | ||
*/ | ||
|
||
test("get licenses", () => { | ||
let licenses = getLicenses({ license: "MIT" }); | ||
|
@@ -2398,6 +2406,11 @@ test("get licenses", () => { | |
expression: "GPL-3.0-only WITH Classpath-exception-2.0", | ||
}, | ||
]); | ||
|
||
licenses = getLicenses({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the test for my code change. The rest of the changes are me uncommenting some other tests and fixing them so they pass. |
||
license: undefined, | ||
}); | ||
expect(licenses).toEqual(undefined); | ||
}); | ||
|
||
test("parsePkgJson", async () => { | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from formatting this was my only real change in this file